0

This question is a follow up of this and this question. I've placed the META-INF/MANIFEST.MF file as suggested to /src/main/resources and exported the project using the following MANIFEST.MF file:

Manifest-Version: 1.0
Main-Class: org.fiware.kiara.generator.kiaragen

there is a new line after the Main-Class entry before the end of the file. The artifact configuration is bellow:

kiaragen_manifest_2

The MANIFEST.MF file in the .jar file is different from the one specified in the resources directory:

$ cat META-INF/MANIFEST.MF 
Manifest-Version: 1.0
Created-By: 1.5.0_13 (Apple Inc.)

Why is the Main-Class entry removed?

Community
  • 1
  • 1
Sebi
  • 4,262
  • 13
  • 60
  • 116

1 Answers1

1

Simple - it is done due to the build cycle.

First your sorces gets compiled along with your manifest from the resources, second maven writes new manifest, and it gets simply overriden. If you want to pust some custom stuff into your manifest, and you use Maven, you should rather modify your POM file to create proper manifest insteed of putting one in the resources.

Check following https://maven.apache.org/shared/maven-archiver/examples/manifestFile.html for custom manifest includement.

Antoniossss
  • 31,590
  • 6
  • 57
  • 99
  • 1
    You have to check the gradle documentation about creating/modifying java JAR manifest. All in all it will always be some sort of configuration in gradle build script, just like in maven`s POM – Antoniossss Aug 17 '15 at 11:15