문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top