2016-11-16 10 views
1

私はmavenプロジェクトを持っています。アプリケーションにはmainメソッドを持つクラスがあります。私はバッチによって呼び出されるこのアプリケーション用のjarファイルを作成しています。バッチはjarファイルを呼び出し、理論的にはmainメソッドでクラスを探します。アプリケーションにマニフェストファイルがありません。だから私は瓶を動かすために1つ作成する必要があります。既存のMavenプロジェクトにマニフェストファイルを作成する方法

mavenを使用してマニフェストファイルを作成する方法を見つけることができません。 META-INFディレクトリとManifest.mfファイルを手作業で作成して埋め込む必要がありますか、Mavenを使用する自動方法がありますか?

答えて

0

利用のmaven-jarファイル、プラグイン

<plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-jar-plugin</artifactId> 
         <version>2.4</version> 
         <configuration> 
          <archive> 
           <!-- Configures the content of the created manifest --> 
           <manifest> 
            <!-- Adds the classpath to the created manifest --> 
            <addClasspath>true</addClasspath> 
            <!-- Specifies that all dependencies of our application are found --> 
            <!-- Configures the main class of the application --> 
            <mainClass>xxx.zzz.yyy.MainClass</mainClass> 
           </manifest> 
          </archive> 
         </configuration> 

        </plugin> 

このことができます願っています。

関連する問題