2016-08-25 6 views
2

maven-assembly-pluginを使用して、アプリケーションのjarファイルに外部依存関係をパックしたいと考えています。私がmvnのインストールを呼び出すと、2つのjarファイルが作成されます.1つはjwファイル、もう1つは依存ファイルがありません。 (appname-version.jarとappname-version-jar-with-dependencies.jar)Mavenアセンブリプラグインは、2つの予期しないjarを作成します

なぜ私は2つのjarファイルを作成するのですか?ここで

はプラグインです:(イムは、現時点では、他のプラグインを使用していない)

<plugin> 
     <artifactId>maven-assembly-plugin</artifactId> 
     <configuration> 
      <archive> 
       <manifest> 
        <mainClass>com.coolapp.mainClass</mainClass> 
       </manifest> 
      </archive> 
      <descriptorRefs> 
       <descriptorRef>jar-with-dependencies</descriptorRef> 
      </descriptorRefs> 
     </configuration> 
     <executions> 
      <execution> 
       <id>make-assembly</id> <!-- this is used for inheritance merges --> 
       <phase>package</phase> <!-- bind to the packaging phase --> 
       <goals> 
        <goal>single</goal> 
       </goals> 
      </execution> 
     </executions> 
    </plugin> 

ありがとうございます!

+0

私の答えを – alexbt

答えて

2

デフォルトのjarを作成しないようにするには、maven-jar-pluginを定義する必要があります。これは、その実行の詳細に<phase>none</phase>を追加することによって行われる。

<plugin> 
    <artifactId>maven-jar-plugin</artifactId> 
    <version>3.0.2</version> 
    <executions> 
     <execution> 
     <id>default-jar</id> 
     <phase>none</phase> 
     </execution> 
    </executions> 
</plugin> 

すべてのリソース/クラスはまだ先のフォルダに移動さ​​れ、これのmaven-アセンブリが正しく自分自身を構築することができます。

+0

更新しました。それは魅力的です。ありがとうございました! – Nandor

関連する問題