SAR is an acronym for "Service ARchive". SAR files are plain old Java JAR files that contain a JBoss service definition file (
META-INF/jboss-service.xml) and (optionally) other resources needed by the service. By convention SAR files are named with a '
Out of the box, Maven 2.x (at least as of version 2.0.7) does not include support creating SAR files, but there are a number of readily available plugins that provide this capability. Those that I am aware of include:
- maven-sar-plugin Note that despite the name, as of 2007-08-31, this plugin is not a core maven plugin
- jboss-sar-maven-plugin As I understand it, this was the earlier work that lead to the above '
jboss-packaging-maven-plugin', and has since been superseded by it.
This section details how to create a SAR artifact using the '
jboss-packaging-maven-plugin'. There are two examples: the first example shows the case of creating a SAR in a simple (non-multi-project) maven-2.x project. The second example shows how to create a SAR artifact in a subproject of a larger multi-project, and then include the SAR in an EAR file created in a different subproject.
Stand-alone SAR Project
FIXME: document simple case
SAR in a Multi-project Build, Included in an EAR
The steps below below pertain only to use of the '
jboss-packaging-maven-plugin' plugin, currently available in the codehaus.org snapshots repository:
To configure use of the plugin, I added the following snippets to my top-level '
In the '
pom.xml' of the subproject that produces the SAR file, I declared the packaging type as '
Note that the '
dependencyManagement' entry for the SAR subproject in the top-level '
pom.xml' file indicates type '
sar', but the packaging type declared by the SAR subproject itself is '
jboss-sar'. During the 'install' build phase, the SAR subproject will install the artifact with a '
.sar' extension in the local maven repository.
In the '
pom.xml' file of the subproject that produces the EAR file, I have the following relevant snippets:
The things to note about this snippet are that the dependency type of the SAR module is '
sar' (not '
jboss-sar'), and the '
<SarModule>' element of the '
maven-ear-plugin' configuration does not include a classifier.
- This wiki page was motivated by this discussion on the maven-users mailing list
- The JBossService page on the JBoss wiki.