No main manifest attribute - IntelliJ
Solution 1
Have you considered the following link?
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>
Solution 2
MANIFEST.MF should be in:
src/main/resources/META_INF/
NOT in:
src/main/java/META_INF/
Related videos on Youtube
joey7492
Standard developer trying to make my way in the world, one bumbling step at a time. Pretty hot on: Java, Groovy, football stats from 2004 Not so hot on: C, HTML, open water swimming
Updated on September 19, 2022Comments
-
joey7492 over 1 year
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
I created the jar through the build option in IntelliJ. Any suggestions?
Thanks
-
joey7492 over 9 yearsSorry, I am using Maven as the build-tool. I am using IntelliJ version 13.1.4.
-
joey7492 over 9 yearsThis still didn't work I am still getting the same error
-
Ronald Duck over 9 yearsPlease edit your question and post a brief structure of your maven project structure. Additionally please post all parent maven projects' and the target maven project's pom.xml. I think it would also be helpful, if you show us the actual "java -jar /......" output/error message.
-
joey7492 over 9 yearsThanks for your help, after going through the POM with a fine tooth comb I tweaked some paths and it works.
-
Awesome over 6 yearsIt seems someone has really worked very hard to not make it work. It is such a shame it never works. I have tried at least 50 different answers and none of it worked. And its the same story every single time. Now I reserve a week to just output it as a jar as everyone in our company thinks its a genuine effort that needs to be go in producing an output jar.