Rio Archetype
Using the Rio Archetype
The Rio archetype allows you to create a Rio application in seconds.
If you don't have Maven, you can get it here. Install it and then invoke:
mvn archetype:generate -DarchetypeGroupId=org.rioproject -DarchetypeArtifactId=rio-archetype -DarchetypeRepository=http://www.rio-project.org/maven2 -DarchetypeVersion=5.6.6

Or, you can simply run:
RIO_HOME/bin/rio create-project


You will be prompted to enter the artifactId, service to create (this will be the classname of the service interface), the groupId, version and package name. The following output shows the interaction:
[INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [archetype:generate] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] Preparing archetype:generate [INFO] No goals needed for project - skipping [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [archetype:generate {execution: default-cli}] [INFO] Generating project in Interactive mode [INFO] Archetype defined by properties Define value for artifactId: : myexample Define value for service: : Hello Define value for groupId: : example Define value for version: 1.0-SNAPSHOT: : Define value for package: example: : com.foo.example Confirm properties configuration: artifactId: myexample service: Hello groupId: example artifactId: myexample version: 1.0-SNAPSHOT package: com.foo.example Y: : [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 39 seconds [INFO] Finished at: Wed Jan 06 17:40:02 EST 2010 [INFO] Final Memory: 13M/80M [INFO] ------------------------------------------------------------------------
Simply 'cd' into your newly created project directory and type 'mvn install' and the service will be built, packaged, tested and installed.
Generated Project Features
The generated Maven project is a multi-module project with the following structure:
The project has the following items generated:
- The pom.xml
- artifactId-api/pom.xml
- artifactId-api/src/main/java/package/artifactId/api/Service.java (interface)
- artifactId-service/src/main/java/package/artifactId/service/ServiceImpl.java (implementation)
- artifactId-service/src/test/java/package/artifactId/service/ITAbstractServiceTest.java (used as a base class for service testing)
- artifactId-service/src/test/java/package/artifactId/service/ITServiceTest.java (uses a StaticCybernode for testing your service)
- artifactId-service/src/test/java/package/artifactId/service/ITServiceDeployTest.java (starts Rio services and deploys your service for testing)
- artifactId-service/src/test/conf/test-config.groovy
- src/main/opstring/artifactId.groovy (OperationalString)

IDE Integration
Maven also comes pre-packaged with plugins for getting up and running with your favorite IDE. Try using mvn idea:idea or mvn eclipse:eclipse for each respective editor.