...
Creating the service assembly (SA)
...
On this page, we are going to excerptINLINE
create a service assembly
...
Using a Maven archetype to create the service assembly
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 folder that contains your root pom.xml:
...
Maven executes the archetype and reports BUILD SUCCESSFUL when it's done. (For more information run smx-arch help)
...
...
A new service assembly project is generated in the my-sa directory.
Add this SA to directory of our project
We copy directory my-sa to directory of our project.(where is parent's pom.xml)
Then we add this to parent's pom.xml to element 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 the pom.xml
Changing the project name
In order to make the build output a little bit more comprehensible , we first change the project name in the generated pom.xml file.
...
Adding parent's element to generated pom.xml
...
No Format |
---|
<parent>
<artifactId>parent</artifactId>
<groupId>org.apache.servicemix.tutorial</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
|
...
Adding the all service units to the assembly
We want to add the service unit units 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:
...
Running Maven to build everything
Now , run mvn install from the parent directory to get this output:
...
project's root folder to build all service units and to create
the service assembly:
...
Now, we are ready to deploy our service assembly. For doing this we just copy the created service assembly zip file (my-cxf-sa/target/my-cxf-sa-1.0-SNAPSHOT.zip) into the hotdeploy folder of your ServiceMix installation. Watch the servicemix console window for success (or maybe errors).
Things to remember
- You can use the servicemix-service-assembly archetype to quickly create a Maven SA project.
- Add SU to your SA by adding dependencies to your pom.xml
...
Proceed to the next step
...