0

I am building a sar archive filetype. I am using using jboss-packaging-maven-plugin from org.codehaus.mojo. However, I'll be happy to use the regular maven-ear-plugin if it can do what I need.

The sar file I'm building is a bit strange. The libraries are kept in the root directory (no problem with that), but there are a few dozen additional properties files and xml files that are also packed into this sar.

I am looking at the documentation of both jboss-packaging-maven-plugin and maven-ear-plugin, but don't see a way to specify additional files in the <configuration> section (such as a <fileSet> parameter). I could switch to an assembly and build the sar that way, but it doesn't look like assemblies do sar formats (at least by default).

So, how do I add these additional property files into a sar either through the maven-ear-plugin or the jboss-packaging-maven-plugin?

Is it possible in an assembly to specify a different format other than the standard formats? If so, how do I go about that?

Here's my pom.xml.

<project>
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.vegicorp</groupId>
    <artifactId>parent</artifactId>
    <version>1.0.0</version>
  </parent>
  <artifactId>child-sar</artifactId>
  <packaging>jboss-sar</packaging>
  <version>1.0.0</version>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jboss-packaging-maven-plugin</artifactId>
        <version>2.2</version>
        <extensions>true</extensions>
        <configuration>
          <!-- Here be dragons -->
          <deploymentDescriptorFile>${project.parent.basedir}/config/jboss/jboss-service.xml</deploymentDescriptorFile>
          <libDirectory>${project.build.directory}/${project.build.finalName}</libDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>com.vegicorp</groupId>
      <artifactId>child-jar</artifactId>
      <version>1.0.0</version>
    </dependency>
    <dependency>
      <groupId>com.vegicorp</groupId>
      <artifactId>child-jar</artifactId>
      <classifier>mdb</classifier>
      <version>1.0.0</version>
    </dependency>
  </dependencies>
</project>

And, I'd like to avoid the maven-antrun-plugin if possible.

David W.
  • 105,218
  • 39
  • 216
  • 337
  • 1
    Maybe you would be better off using the `maven-assembly-plugin` with a `sar` packaging? – Tunaki Nov 17 '16 at 16:57
  • The official Maven documentation on the `maven-assembly-plugin` doesn't mention that one of the options is `sar` which is why I didn't use it. Turns out that `sar` is a valid package. I'll do that. – David W. Nov 18 '16 at 15:50

1 Answers1

1

The Maven Assembly Plugin does build sar artifacts even though it doesn't mention this in the documentation. I just switched to using assemblies and that works.

David W.
  • 105,218
  • 39
  • 216
  • 337
  • I have found [this page](https://awakepower.wordpress.com/2015/10/27/how-to-create-sar-service-archive-file-for-jboss-with-maven/) that explains how to package a sar with the net.sf.maven-sar:maven-sar plugin. I have tried it with a very simple sar and everything sems to be ok. – SJuan76 Jul 29 '20 at 09:50
  • How did you do that with assembly plugin ? – lubrum Apr 04 '22 at 17:20