2017-12-06 18 views
1

私のプロジェクトパッケージは、Springブートfat-jarにパッケージ化されています。MavenでのJARのデプロイをスキップしてアセンブリのみをデプロイする方法

私は2余分なビルドのプラグインを設定した:

  • Launch4j Pluginを使用して、実行可能(それが結果として脂肪jarファイルを取得し、実行可能ファイルにそれを埋め込む)
  • 総会ZIP
  • で生成される実行可能ファイルを生成します

アセンブリを作成し、結果としてzipを自分のMavenリポジトリに配置します。

これは私のbuildセクションです:

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
      <configuration> 
       <executable>true</executable> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>com.akathist.maven.plugins.launch4j</groupId> 
      <artifactId>launch4j-maven-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>l4j-clui</id> 
        <phase>package</phase> 
        <goals> 
         <goal>launch4j</goal> 
        </goals> 
        <configuration> 
         <headerType>console</headerType> 
         <outfile>target/${project.build.finalName}.exe</outfile> 
         <jar>target/${project.build.finalName}.jar</jar> 
         <manifest>launch4j/besser-updater.manifest</manifest> 
         <classPath> 
          <mainClass>org.springframework.boot.loader.JarLauncher</mainClass> 
         </classPath> 
         <jre> 
          <minVersion>1.8.0_131</minVersion> 
          <jdkPreference>preferJre</jdkPreference> 
          <runtimeBits>32/64</runtimeBits> 
         </jre> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <artifactId>maven-assembly-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>assembly</id> 
        <phase>package</phase> 
        <goals> 
         <goal>single</goal> 
        </goals> 
        <configuration> 
         <descriptors> 
          <descriptor>launch4j/assembly.xml</descriptor> 
         </descriptors> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 
私は アーティファクトを無視して、唯一の ジップアセンブリファイルを展開する展開段階を設定するにはどうすればよい

答えて

0

リモートのリポジトリに依存関係をインストールするのを避けるためにアセンブリを使用しているのですか?

あなたは、アセンブリのプラグインについて話している場合は、簡単にあなたがこのような単一のアーティファクトを展開することを避けることができ、それに

https://maven.apache.org/plugins/maven-assembly-plugin/examples/single/including-and-excluding-artifacts.html

をjarファイルを除外することができます。

<build> 
    <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-deploy-plugin</artifactId> 
    <version>2.4</version> 
    <configuration> 
     <skip>true</skip> 
    </configuration> 
    </plugin> 
... 
</build> 

次にあなたが指定することができますデプロイする特定のファイルをdeployプラグインの設定に含めます。

参照:http://prystash.blogspot.ie/2009/06/maven-excluding-module-from-deploy.html

は、私は解決策を見つけた

+0

私はリモートリポジトリに期待している結果に、** zip ** artifactと** jar **しか表示されません。今私は展開を実行すると、それはjarとzipをアップロードします。 –

+0

これはデプロイメント全体をスキップします。デプロイメント全体をスキップしたくないので、クラシファイア** jar **のデプロイのみが必要です。 –

1

...それがお役に立てば幸いです。私はちょうどdefault-deploy実行IDを無視しました。

<build> 
    <plugins> 
     ... 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-deploy-plugin</artifactId> 
      <executions> 
       <!-- disable standard deploy --> 
       <execution> 
        <id>default-deploy</id> 
        <phase>none</phase> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 
関連する問題