当前位置: 首页 > 工具软件 > Spring Roo > 使用案例 >

Spring Roo 命令行说明

屠嘉
2023-12-01

参考文档:http://projects.spring.io/spring-roo/#running-from-shell

$ roo.sh 
                _                               
 ___ _ __  _ __(_)_ __   __ _   _ __ ___   ___  
/ __| '_ \| '__| | '_ \ / _` | | '__/ _ \ / _ \ 
\__ \ |_) | |  | | | | | (_| | | | | (_) | (_) |
|___/ .__/|_|  |_|_| |_|\__, | |_|  \___/ \___/ 
    |_|                 |___/          2.0.0.RC2

Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.
roo> 
roo> 
roo> help

COMMAND INDEX 

!g                  Passes a command directly through to the Felix shell
                    infrastructure.

!os                 Allows execution of operating system (OS) commands. Ex.:
                    `!os mkdir test_dir`

*/                  End of block comment

/*                  Start of block comment

//                  Inline comment markers (start of line only)

;                   Inline comment markers (start of line only)

addon create advanced 
                    Create a new advanced add-on for Spring Roo (commands + 
                    operations + metadata + trigger annotation + dependencies).

addon create i18n   Create a new internationalization add-on for Spring Roo,
                    with a new language.
                    with a new language.Created add-on can be installed later 
                    into a project for localizing the project to that new 
                    language.

addon create simple Create a new simple add-on for Spring Roo (commands +
                    operations).

addon create suite  Create a new Spring Roo Addon Suite for Spring Roo (two
                    sample addons + repository + suite generator).

addon create wrapper 
                    Create a new add-on for Spring Roo which wraps a maven 
                    artifact to create a OSGi compliant bundle.

addon development mode 
                    Switches the system into development mode, which enables 
                    add-on development commands and shows greater diagnostic 
                    information.

addon info bundle   Provide information about a specific Spring Roo Add-on from
                    installed repositories.

addon install bundle 
                    Install Spring Roo Add-on from installed repositories.

addon install url   Install Spring Roo Add-on using an URL.

addon list          List all installed addons.

addon remove        Removes an installed Spring Roo Add-on.

addon repository add 
                    Adds a new OBR Repository to ROO Shell.

addon repository introspect 
                    Introspects all installed OBR Repositories and list all 
                    their addons.

addon repository list 
                    Lists installed OBR Repositories.

addon repository remove 
                    Removes an existing OBR Repository from ROO Shell.

addon search        Search all known Spring Roo Add-ons from installed
                    repositories.

addon suite install name 
                    Installs some 'Roo Addon Suite' from installed OBR 
                    Repository.

addon suite install url 
                    Installs some 'Roo Addon Suite' from URL.

addon suite list    Lists all installed 'Roo Addon Suite'. If you want to list
                    all available 'Roo Addon Suites' on Repository, use 
                    --repository parameter.

addon suite start   Starts some installed 'Roo Addon Suite'. By default, an
                    installed 'Roo Addon Suite' is started automatically.

addon suite stop    Stops some started 'Roo Addon Suite'.

addon suite uninstall 
                    Uninstalls some installed 'Roo Addon Suite'.

backup              Backups your project to a zip file located in root
                    directory.

cache setup         Installs support for using intermediate memory in generated
                    project by using Spring Cache abstraction. Users can specify
                    different providers to use for managing it.

class               Creates a new Java class source file in any project path

constructor         Creates a class constructor.

dto                 Creates a new DTO (Data Transfer Object) class in the
                    directory _src/main/java_ of the selected project module (if
                    any) with @RooDTO annotation.

email receiver setup 
                    Installs a Spring JavaMailReceiver in your project.

email sender setup  Install a Spring JavaMailSender in your project

embeddable          Creates a new Java class source file with the JPA
                    `@Embeddable` annotation in the directory _src/main/java_ of
                    the selected project module (if any).

entity jpa          Creates a new JPA persistent entity in the directory
                    _src/main/java_ of the selected project module (if any) with
                    `@RooEntity` annotation.

entity projection   Creates new projection classes from entities in the
                    directory _src/main/java_ of the selected project module (if
                    any) annotated with `@RooEntityProjection`. Transient, 
                    static and entity collection fields are not valid for 
                    projections.

enum constant       Inserts a new enum constant into an enum class.

enum type           Creates a new Java enum source file in any project path.

equals              Add `equals()` and `hashCode()` methods to a class.

exit                Waits until all metadata and files are refreshed and
                    updated, then exits the shell. You can also use `exit` 
                    command.

field boolean       Adds a private boolean field to an existing Java source
                    file.

field date          Adds a private date field to an existing Java source file.

field embedded      Adds a private `@Embedded` field to an existing Java source
                    file. This command is only available for entities annotated 
                    with `@RooJpaEntity` (Roo JPA entities). Therefore, you 
                    should focus the desired entity in the Roo Shell to make 
                    this command available.

field enum          Adds a private enum field to an existing Java source file.
                    The field type must be a Java enum type.

field file          Adds a byte array field for storing uploaded file contents.

field list          Adds a private `List` field to an existing Java source file,
                    representing (always) a bidirectional relation with other 
                    entity. Therefore, this command will also add a field on the
                    other side of the relation (the owner side, with `mappedBy` 
                    attribute), which will be a `List` field for 'many-to-many' 
                    relations, or a *not* `Collection` field for a 'one-to-many'
                    relation. All added fields will have the needed JPA 
                    annotations to properly manage bidirectional relations.This 
                    command is only available for entities annotated with 
                    `@RooJpaEntity` (Roo JPA entities). Therefore, you should 
                    focus the desired entity in the Roo Shell to make this 
                    command available.

field number        Adds a private numeric field to an existing Java source
                    file. User can choose the field type between a wide range of
                    numeric types.

field other         Inserts a private field into the specified file. User can
                    choose a custom type for the field by specifying its fully 
                    qualified name.

field reference     Adds a private reference field, representing (always) a
                    bidirectional 'one-to-one' relation, to an existing Java 
                    source file. Therefore, this command will add as well a 
                    'one-to-one' field on the other side of the relation. This 
                    command is only available for entities annotated with 
                    `@RooJpaEntity`, so you should focus the desired entity in 
                    the Roo Shell to make this command available.

field set           Adds a private `Set` field to an existing Java source file,
                    representing (always) a bidirectional relation with other 
                    entity. Therefore, this command will also add a field on the
                    other side of the relation (the owner side, with `mappedBy` 
                    attribute), which will be a `Set` field for 'many-to-many' 
                    relations, or a *not* `Collection` field for a 'one-to-many'
                    relation. All added fields will have the needed JPA 
                    annotations to properly manage bidirectional relations. This
                    command is only available for entities annotated with 
                    `@RooJpaEntity` (Roo JPA entities). Therefore, you should 
                    focus the desired entity in the Roo Shell to make this 
                    command available.

field string        Adds a private String field to an existing Java source file.

finder add          Installs a finder in the given target (must be an entity).
                    This command needs an existing repository for the target 
                    entity, you can create it with `repository jpa` command. The
                    finder will be added to targeted entity associated 
                    repository and associated service if exists or when it will 
                    be created.

focus               Changes Roo Shell focus to a different type in the project.

help                Shows a summary of all Spring Roo commands.

hint                Provides step-by-step hints and context-sensitive guidance.

interface           Creates a new Java interface source file in any project
                    path.

jms receiver        Creates an JMS receiver.

jms sender          Creates an JMS sender.

jpa audit add       Adds support for auditing a JPA entity. This will add JPA
                    and Spring listeners to this entity to record the entity 
                    changes.

jpa audit setup     Installs audit support into your project, preparing it to
                    audit entity changes.

jpa setup           Installs or updates a JPA persistence provider in your
                    project. User can execute this command for diferent profiles
                    with different persistence configurations.

metadata cache      Shows detailed metadata for the indicated type.

metadata for id     Shows detailed information about the metadata item.

metadata for module Shows the ProjectMetadata for the indicated project module.

metadata for type   Shows detailed metadata for the indicated type.

metadata status     Shows metadata statistics of the current project.

metadata trace      Traces metadata event delivery notifications.

module create       Creates a new Maven module in current *multimodule* project.

module focus        Changes Roo Shell focus to a different project module, when
                    in a multimodule project.

process manager debug 
                    Indicates if process manager debugging is desired. It is 
                    only available if 'addon development mode' is true.

project scan now    Performs a manual file system scan, calling thread monitors
                    and checking that all files are updated.

project scan speed  Changes the time inteval between file system scans.

project scan status Displays file system scanning information such as the time
                    lasted for last scan and scanning frequency.

project setup       Creates a new Maven project.

property add        Adds or updates a particular property from application
                    config properties file.

property list       Lists all properties from an application config properties
                    file.

property remove     Removes a particular property from application config
                    properties file.

push-in             Allows to push-in elements declared in the ITDs to its .java
                    files. You could specify `--all` option to apply push-in on 
                    every component of generated project, or you could define 
                    any package, class or method to apply push-in, combining 
                    them.

quit                Waits until all metadata and files are refreshed and
                    updated, then exits the shell. You can also use `exit` 
                    command.

reference guide     Writes the reference guide XML fragments (in DocBook format)
                    into the current working directory. It is only available if 
                    'development mode' is `true`.

repository jpa      Generates new Spring Data repository for specified entity or
                    for all entities in generated project.

script              Parses the specified resource file and executes its Roo
                    commands. You can as well execute _*.roo_ example scripts in
                    the Roo classpath. Ex.: `script --file clinic.roo`.

security authorize  Includes `@PreAuthorize` annotation to an specific method
                    for controlling access to its invocation.

security filtering  Include `@PreFilter`/`@PostFilter` annotation to an specific
                    method to filter results of a method invocation based on an 
                    expression.

security setup      Install Spring Security into your project.

service             Creates new service interface and its implementation related
                    to an entity, or for all the entities in generated project, 
                    with some basic management methods by using Spring Data 
                    repository methods.

settings add        Adds or updates a Roo project setting, which can modify the
                    configuration of some commands acting in the current 
                    project. These settings are located in 
                    _[PROJECT-ROOT]/.roo/config/project.properties_.

settings list       Lists all settings added into Roo project configuration.
                    These settings are located in 
                    _[PROJECT-ROOT]/.roo/config/project.properties_.

settings remove     Removes a specific setting from Roo project configuration.
                    Use 'settings list' to see the Roo settings added to the 
                    project.

system properties   Shows the shell's properties such as if 'addon development
                    mode' is enabled, JVM version, file encoding...

test integration    Creates a new integration test class for the specified
                    class. The generated test class will contain a basic 
                    structure and the necessary testing components.

test unit           Creates a unit test class with a basic structure and with
                    the necessary testing components, for the specified class.

version             Displays Roo Shell banner and version.

web flow            Installs a Spring Web Flow into your project.

web mvc controller  Generates new `@RooController's` in the directory
                    _src/main/java_ of the selected project module (if any). The
                    generated controllers should manage specific entities in the
                    project.

web mvc detail      Generates new `@RooController` for relation fields which
                    detail wants to be managed. It must be a `@OneToMany` field.
                    Generated controllers will have `@RooDetail` with info about
                    the parent entity and the parent views where the detail will
                    be displayed.

web mvc exception handler 
                    Adds methods to handle an application exception in a 
                    specified controller or a class annotated with 
                    `@ControllerAdvice`.

web mvc finder      Publishes existing finders to web layer, generating
                    controllers and additional views for them. It adds 
                    `@RooWebFinder` annotation to MVC controller type.

web mvc language    Installs new language in generated project views. Also,
                    could be used to specify the default language of the 
                    project.

web mvc setup       Includes Spring MVC configuration on generated project.
                    Needed for several MVC related commands.

web mvc templates setup 
                    Includes view generation templates on current project. Will 
                    allow developers to customize view generation by modifying 
                    the templates from _[PROJECT-ROOT]/.roo/templates/..._

web mvc view setup  Includes all necessary resources of provided response type
                    on generated project. This response type will be needed by 
                    `web mvc controller`, `web mvc detail` and `web mvc 
                    templates setup` commands.

ws client           Generates a new Web Service client by the provided WSDL
                    file.

ws endpoint         Generates a new Service Endpoint Interface (SEI) and its
                    implementation.


** Type 'hint' (without the quotes) and hit ENTER for step-by-step guidance **

roo> hint
Welcome to Roo! We hope you enjoy your stay!

Before you can use many features of Roo, you need to start a new project.

To do this, type 'project setup' (without the quotes) and then hit TAB.

Enter a --topLevelPackage like 'com.mycompany.projectname' (no quotes).
When you've finished completing your --topLevelPackage, press ENTER.
Your new project will then be created in the current working directory.

Note that Roo frequently allows the use of TAB, so press TAB regularly.
Once your project is created, type 'hint' and ENTER for the next suggestion.
You're also welcome to visit http://stackoverflow.com/questions/tagged/spring-roo
for Roo help.
roo> 
 类似资料: