2
votes

I am pretty new to maven.

Is there any plugin or packaging type suitable for building application client jar file ?

I want to add the application-client.xml file to the META-INF folder inside the jar.

The normal jar packaging doesn't include the file.

2

2 Answers

1
votes

You should only need to define the project with jar packaging (and as it is the default you don't need to declare it). If you define the application-client.xml in the src/main/resources/META-INF folder it will be included in the META-INF folder of the final jar.


To define additional information you need to configure the jar plugin as below.

<project>
...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.2</version>
        <configuration>
          <archive>
            <manifest>
              <mainClass>com.mycompany.app.App</mainClass>
              <addClasspath>true</addClasspath>
            </manifest>
            <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...
</project>

Check out the guide to working with manifests for full details

0
votes

I'm not very familiar with the JavaEE support in Maven, but it looks like the ejb plugin can generate a client jar as well if configured properly. Check this page out:

Maven EJB Plugin - Generating an EJB client