Now, we are going to create our first SU module in our project.
Using a Maven archetype to create the service unit project
ServiceMix provides several Maven archetypes to help you create your projects more rapidly and reliably.
We start off by using the servicemix-http-consumer-service-unit
archetype, which is used for creating a http consumer service unit project. The groupId for this archetype is org.apache.servicemix.tooling
.
From our tutorial project directory, where we already have the parent pom.xml, we run this command to create a service unit project named http-consumer-su
:
mvn archetype:create \ -DarchetypeGroupId=org.apache.servicemix.tooling \ -DarchetypeArtifactId=servicemix-http-consumer-service-unit \ -DgroupId=org.apache.servicemix.examples \ -DartifactId=http-consumer-su
Maven executes the archetype and reports BUILD SUCCESSFUL
when it's done.
[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ---------------------------------------------------------------------------- [INFO] Building Simple HTTP Upload example [INFO] task-segment: [archetype:create] (aggregator-style) [INFO] ---------------------------------------------------------------------------- ... [INFO] ********************* End of debug info from resources from generated POM *********************** [INFO] Archetype created in dir: /home/lhe/example/http-consumer-su [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 seconds [INFO] Finished at: Wed Nov 28 09:55:17 CET 2007 [INFO] Final Memory: 6M/77M [INFO] ------------------------------------------------------------------------
What is being generated?
First of all, the archetype creates the project directory, containing:
- a pom.xml file for building the service unit project
- a directory src/main/resources containing a template xbean.xml file for configuring the service unit
Because we started Maven's archetype:create from the directory containing our parent pom.xml, Maven has also added a module to the parent pom.xml
... <modules> <module>http-consumer-su</module> </modules> ...
Now, we will have to configure the service unit to provide the services we want.
Further reading
- Maven archetypes contains a list of Maven archetypes available with ServiceMix