I am getting no main manifest attribute
while running the jar create by Intellij. I extracted the jar and observed that there was another manifest
In IntelliJ Idea 2020
Follow the instructions in this video.
When you get to the Artifact creation point (Ctrl + Shift + Alt + S) change the location of the manifest as shown here. (\src\main\resources)
In my case I had some dependencies added in my jar, which itself generated a Manifest. I didn't get it to work straight out of Intellij. However, what you can do is open the jar file with a zip program and add the Main class yourself and then copy it back into the jar:
I spent a few days to resolve it. My solution: I loaded a project that present in this answer. Then I compared and corrected settings of the loaded project and my own project. I compared/corrected:
In the end, I placed META-INF in resources directory.
Maybe i did excess actions, but it worked for me :)
P.S. also need to choose "Inherit project compile output path" in Progect Structure settings -> Modules -> Path
If using Maven, Ensure your pom.xml has the main class referenced and fully qualified, similar to:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<mainClass>org.mypkg.MyMainClass</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
(... of course the version number of the plugin may be different).
The main class being not fully qualified, is what leads people to suggest moving the manifest to another location (in order to satisfy the reference locally).