2013-10-16 1 views
0

우리 pom.xml은 3 개의 개별 jar 파일을 작성하기 위해 maven-jar-plugin 내에 여러 번 실행됩니다. mvn을 호출하고 세 개의 항아리를 만드는 방법은 무엇입니까? 여러 jar 파일을 빌드하기 위해 maven-jar-plugin의 jar : jar goal을 사용하는 방법

는 현재

mvn compile jar:jar 

는 여전히 하나의 항아리를 작성합니다.

<artifactId>maven-jar-plugin</artifactId> 
     <version>2.3.2</version> 
    <executions> 
     <execution> 
      <id>UDFCommon</id> 
      <goals><goal>jar</goal></goals> 
      <phase>package</phase> 
      <configuration> 
       <forceCreation>true</forceCreation> 
       <classifier>UDFCommon</classifier> 
       <includes> 
        <include>**/pafcommon/*</include> 
       </includes> 
      </configuration> 
     </execution> 
     <execution> 
      <id>UDFOne</id> 
      <goals><goal>jar</goal></goals> 
      <phase>package</phase> 
      <configuration> 
       <classifier>UDFOne</classifier> 
       <includes> 
        <include>**/dqm/*</include> 
       </includes> 
      </configuration> 
     </execution> 
     <execution> 
      <id>UDFTwo</id> 
      <goals><goal>jar</goal></goals> 
      <phase>package</phase> 
      <configuration> 
       <classifier>UDFTwo</classifier> 
       <includes> 
        <include>**/ciview/*</include> 
       </includes> 
      </configuration> 
     </execution> 
    </executions> 
    </plugin> 

답변

1

jar : jar는 여러 개의 jar 파일을 처리하지 않는 것으로 보입니다. 하지만 달리기

mvn compile package 

트릭을 수행합니다.

-rw-r--r-- 1 steve staff 2629074 Oct 16 15:24 UDFPafDqm.jar 
-rw-r--r-- 1 steve staff 13286 Oct 16 15:24 UDFPafDqm-UDFTwo.jar 
-rw-r--r-- 1 steve staff 40315 Oct 16 15:24 UDFPafDqm-UDFOne.jar 
-rw-r--r-- 1 steve staff  6942 Oct 16 15:24 UDFPafDqm-UDFCommon.jar 

이 경우 assembly.xml이 필요합니다. 베어 본 하나가 아래에 나와 있습니다.

<assembly> 
    <id>job</id> 
    <formats> 
     <format>jar</format> 
    </formats> 
    <includeBaseDirectory>false</includeBaseDirectory> 
    <fileSets> 
     <fileSet> 
      <directory>${project.build.outputDirectory}</directory> 
      <outputDirectory>/</outputDirectory> 
     </fileSet> 
    </fileSets> 


    <dependencySets> 
     <dependencySet> 
      <scope>runtime</scope> 
      <outputDirectory>lib</outputDirectory> 
     </dependencySet> 
    </dependencySets> 
</assembly>