Pregunta

I have 2 separate maven projects.

The first builds a lot of artifacts, and packages them up into an EAR. This is the standard product.

The second project is bespoke for a customer, and builds some additional JAR files. I need a mechanism to insert these 2 JAR files into the lib directory of the EAR built by the first project.

Is there a nice simple way of doing this, whereby I list the artifact of the first project in the second, so that it does not need to know how it was put together, it simply inserts the additional JARS.

¿Fue útil?

Solución

You can include the contents of another ear file in your second ear file by specifying the first ear file als dependency, but using <type>pom</type> instead of ear:

if you specify an ear dependency, transitive dependencies are not resolved (ear is defined as a container type). If you use pom instead, all dependencies of your first ear are (transitive) dependencies to the second ear, and thus included.

Otros consejos

You need to add those supplemental jar files as dependencies to your project pom and furthermore you need to add them to your maven-ear-plugin configuration:

<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.9</version>
        <configuration>
           [...]
           <modules>
             <jarModule>
               <groupId>artifactGroupId</groupId>
               <artifactId>artifactId</artifactId>
               <bundleDir>lib</bundleDir>
             </jarModule>
          </modules>
        </configuration>
      </plugin>
    </plugins>
  </build>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top