[英]Maven does not generate a MANIFEST file with maven jar plugin
I try to generate a .zip file with maven (mvn package) and want to have a MANIFEST file in the zip too.我尝试使用 maven(mvn 包)生成一个 .zip 文件,并希望在 zip 中也有一个 MANIFEST 文件。 The jar file itself does work.
jar 文件本身确实有效。 I tried to generate a MANIFEST file with maven jar plugin, but it did not work.
我尝试使用 maven jar 插件生成 MANIFEST 文件,但它不起作用。 Do I Have to do something else to get a MANIFEST file, or is it enough to use this plugin?
我是否必须做其他事情才能获得 MANIFEST 文件,或者使用这个插件就足够了? The parent pom (parent of the parent I showed) has maven assembly plugin.
父 pom(我展示的父级的父级)具有 maven 程序集插件。 (I´m completely new to maven)
(我对 Maven 完全陌生)
pom.xml file of the parent pom:父 pom 的 pom.xml 文件:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
</pluginManagement>
</build>
pom.xml file of the module:模块的 pom.xml 文件:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<mainClass>org.jis.Main</mainClass>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
In your case maven must be called like: 在你的情况下,maven必须被称为:
mvn clean package assembly:single
The other way to achive same result is to modify your pom: 获得相同结果的另一种方法是修改你的pom:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
then run: 然后运行:
mvn clean package
ref: https://maven.apache.org/plugins/maven-assembly-plugin/usage.html 参考: https : //maven.apache.org/plugins/maven-assembly-plugin/usage.html
我遇到了同样的问题,我突然无法从 CLI 运行 jar,删除<pluginManagement>
标记为我创建了清单。
我有同样的问题,从 pom 文件中删除标签对我有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.