With the tutorial-first-su ready, we are now ready to use a Maven archetype to create a service assembly
Creating the service assembly (SA)
Just as we started our service unit with a Maven archetype, we are also going to use a Maven archetype (servicemix-service-assembly) to create the SA project. Run this command from the directory that holds your parent pom.xml:
A new service assembly project is generated in the tutorial-sa directory.
Editing pom.xml
Changing the project name
Again, to clean up the build output, we change the project's name
<?xml version="1.0" encoding="UTF-8"?>
<project>
...
<name>Tutorial :: SA</name>
...
</project>
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:
<project>
...
<dependencies>
<dependency>
<groupId>org.apache.servicemix.tutorial</groupId>
<artifactId>tutorial-file-su</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
...
</project>
Running Maven to build everything
Now, run mvn install from the parent directory to get this output:
Now, we are ready to deploy our service assembly. If you have followed the previous tutorial, you already know how to do this using the hot-deploy directory. In our next step, we are going to use the Maven tooling for deployment.
Further reading
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