I\'m trying to package a project using OptaPlanner 6.0.1 libraries into a .jar through IntelliJ IDEA\'s jar artifact but instead of my manifest.mf containing the standard
If you want to specify Main Class, you have to add this plugin to pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<mainClass>Form</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
I had the same problem.
Make sure your MANIFEST.MF is in:
src/main/resources/META_INF/
NOT
src/main/java/META_INF/
To fix:
I had a similar problem.
The problem was in file pom.xml.
<archive>
<manifestEntries>
<Dependencies>one.jar,
two.rar,
other.jar
</Dependencies>
</manifestEntries>
</archive>
I do not know for what reason this code works in eclipse, but not in IntelliJ
This it correct.
<archive>
<manifestEntries>
<Dependencies>one.jar, two.rar, other.jar</Dependencies>
</manifestEntries>
</archive>
Manifest.mf worked!!!
I hope this helps.
To have no problem like Manifest, you should have a directory named "META-INF" in "src" directory. So, create it and put a file named "MANIFEST.MF" in it with the following contents:
Manifest-Version: 1.0
Main-Class: <packageName>.Main
Not to forgot to replace the package's name containing Main class above!
There are several ways to generate executable jars. Using IntelliJ's GUI feature is one good way. Another way is to use Maven (or similarly in gradle, buildr, etc) which is build-server friendly:
It's more or less copy pasteable from the optaplanner examples maven build: