Tuscany Maven Archetypes
Tuscany provides some Maven archetypes to make it easy to get going using Tuscany. Maven archetypes provide a simple way to create a project thats configured with exactly what you need to develop your application. You don't need to download, install, or pre-configure Tuscany or your environment, thats all done for you automatically, all you need pre-installed is Maven and Java.
To give it a try run the following command:
mvn archetype:generate -DarchetypeCatalog=http:
That will list out the available archetypes and ask you to choose which one you want:
Choose archetype:
1: http:2: http:3: http:4: http:Choose a number: (1/2/3/4):
You are then prompted to answer several questions about the project such as the Maven group and artifact IDs, Java package names etc. Some of those will show default values before the prompt so you can just hit enter to take the default. Thats it, and then the Maven project is created in a folder in the current directory named after the artifactid you entered.
The following shows the console session for creating an SCA contribution JAR:
Choose a number: (1/2/3/4): 4
Define value for groupId: : org.myco.sca.test
Define value for artifactId: : scatest
Define value for version: 1.0-SNAPSHOT: :
Define value for package: org.myco.sca.test: :
Confirm properties configuration:
groupId: org.myco.sca.test
artifactId: scatest
version: 1.0-SNAPSHOT
package: org.myco.sca.test
Y: :
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 15 seconds
[INFO] Finished at: Tue Mar 31 15:08:45 BST 2009
[INFO] Final Memory: 8M/14M
[INFO] ------------------------------------------------------------------------
That will create a Maven project in a folder named scatest with the following directory structure and files:
scatest\pom.xml
scatest\src\main\java\org\myco\sca\test\HelloworldImpl.java
scatest\src\main\java\org\myco\sca\test\HelloworldService.java
scatest\src\main\resources\helloworld.composite
scatest\src\main\resources\META-INF\sca-contribution.xml
When using one of the archetypes which create webapp projects the pom.xml is configured with the maven Jetty plugin so you can run the webapp right away without needing to install the WAR file into an appserver by using the command "mvn jetty:run". The following shows an examaple of this using the tuscany-quickstart archetype:
> mvn archetype:generate -DarchetypeCatalog=http:[INFO] Scanning for projects...
. . .
Choose archetype:
1: http:2: http:3: http:4: http:5: http:Choose a number: (1/2/3/4/5): 3
Define value for groupId: : mygroup
Define value for artifactId: : mytest
Define value for version: 1.0-SNAPSHOT: :
Define value for package: mygroup: :
Confirm properties configuration:
groupId: mygroup
artifactId: mytest
version: 1.0-SNAPSHOT
package: mygroup
Y: :
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
> cd mytest
> mvn jetty:run
. . .
[INFO] Started Jetty Server
The webapp runs at the context path of the artifact name on port 8080 so on a web browser go to http://localhost:8080/mytest/ and you should see a page showing:
Calling HelloworldService sayHello("world") returns:
Hello world
|