没有主要的清单属性 - IntelliJ [英] No main manifest attribute - IntelliJ
问题描述
我知道有很多帖子,但我似乎无法找到合适的解决方案。所以我有我的3个类,一个带有主,从IntelliJ一切运行正常。但我似乎无法运行我创建的.jar文件。
I know there have been many posts on this but I can't seem to find an appropriate solution. So I have my 3 classes, one with a main and from IntelliJ everything runs fine. But I cannot seem to run the .jar file that I have created.
我还有一个包含以下内容的清单文件:
I also have a manifest file that contains the following:
Manifest-Version: 1.0
Main-Class: beanParser
我通过IntelliJ中的构建选项创建了jar。有什么建议吗?
I created the jar through the build option in IntelliJ. Any suggestions?
谢谢
推荐答案
您是否考虑过以下< a href =https://www.jetbrains.com/idea/help/create-jar-from-modules-dialog.html\"rel =noreferrer>链接?
For Maven have a look at the following clip or this one.
这是我在项目中使用的剪辑:
Here's a snipped I used in my project:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>your.main.Clazz</mainClass>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/lib/
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
这篇关于没有主要的清单属性 - IntelliJ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!