rom*_*rav 3 jar manifest.mf maven
我有一个 Maven 项目。该应用程序有一个带有 main 方法的类。我正在为此应用程序创建一个 jar 文件,它将被批处理调用。批处理将调用 jar 文件,理论上它将使用 main 方法查找类。但是应用程序缺少清单文件。所以我需要创建一个来让 jar 运行。
我无法找到如何使用 maven 创建清单文件。我是否需要手动创建 META-INF 目录和 Manifest.mf 文件并填写它,或者是否有任何使用 Maven 的自动方法?
使用 maven-jar-plugin:
<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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5541 次 |
| 最近记录: |