I have a Eclipse Java project and wanted to specify the main class in the Manifest file. I added the jar and asembly Maven plugins to POM.xml After I run Maven clean package, it produces two jar files, one with dependencies and the other not. The one without dependencies have the correct manifest file but the one with dependencies does not - and I wanted this jar file has the entries that I specified in the jar plugin.
What did I miss?
Thanks
Expected Manifest file:
Manifest-Version: 1.0
Created-By: Maven JAR Plugin 3.3.0
Build-Jdk-Spec: 18
#jar with dependencies did not have the following entries:
Main-Class: com.main.App
Multi-Release: true
POM.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
<mainClass>
com.main.App
</mainClass>
</manifest>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Oops, I have to add the main class configuration into the assembly plugin too.
<archive>
<manifest>
<addClasspath>false</addClasspath>
<mainClass>com.hybrid.main.App</mainClass>
</manifest>
</archive>