...
ServiceMix provides Maven archetype to help you create your service assembly.(SA)
From SMX_HOME/bin directory, we run this command to create a service unit project named :
in MS Windows:
No Format |
---|
smx-arch sa
|
in GNU\Linux:
Run this command from the directory that holds your parent pom.xml:
No Format |
---|
c:\home\Diplomka\_mySA\tutorial-wsdl-cxf-service>mvn archetype:create -Darchetyp
eGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-service-
assembly -DgroupId=org.apache.servicemix.examples -DartifactId=my-cxf- |
No Format |
./smx-arch sa
|
Maven executes the archetype and reports BUILD SUCCESSFUL when it's done. (For more information run smx-arch help)
No Format |
---|
c:\java\apache-servicemix-3.2.1\bin>smx-arch sa [INFO] Scanning for projects... ... [INFO] OldArchetype created in dir: c:\java\apache-servicemix-3.2.1\bin\my-home\Diplomka\_mySA\tutorial-wsdl-cxf-ser vice\my-cxf-sa [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 843 seconds [INFO] Finished at: WedTue JulAug 3005 1109:0829:0611 CEST 2008 [INFO] Final Memory: 8M10M/14M18M [INFO] ------------------------------------------------------------------------ |
A new service assembly project is generated in the my-sa directory.
Add this SA to directory of our project
...
- |
...
No Format |
---|
<modules>
<module>my-sa</module>
</modules>
|
Finally, parent's pom.xml looks like this:
No Format |
---|
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.servicemix.tutorial</groupId> <artifactId>parent</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <name>ServiceMix :: CXF WSDL Tutorial</name> <url>http://servicemix.org</url> <modules> <module>my-cxf-se-su</module> <module>my-cxf-bc-su</module> <module>my-sa</module> </modules> </project> |
Configuring pom.xml
Changing the project name
...
No Format |
---|
<project> ... <name>CXF WSDL Tutorial :: CXF SA</name> ... </project> |
Adding
...
We must specify parent of this project. So, we add this to generated pom.xml.
No Format |
---|
<parent>
<artifactId>parent</artifactId>
<groupId>org.apache.servicemix.tutorial</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
|
Adding the SU to the SA
We want to add the service unit we created before to the service assembly. The Maven tooling will do this automatically if we add the correct dependency to our SA's pom.xml. We just use the groupId, artifactId and version we find in our service unit's pom.xml here:
No Format |
---|
<project> ... <dependencies> <dependency> <groupId>com.mycompany<<groupId>org.apache.servicemix.examples</groupId> <artifactId>my-cxf-se-su</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>com.mycompany<<groupId>org.apache.servicemix.examples</groupId> <artifactId>my-cxf-bc-su</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> ... </project> |
...
Now, run mvn install from the parent directory to get this output:
No Format |
---|
Now, we are ready to deploy our service assembly.
...