Standard way - using maven-jar-plugin
- generates manifest file only during package phase and directly into jar file.
What I need is to generate manifest during compile phase and to be available in <target>/classes/META-INF
.
My goal is to be able to read this manifest file in project running in debug mode in IntelliJ Idea. (Idea resolves in-project jar dependencies from <target>/classes
instead of from <target>/*.jar
- for hot-swap purpose).
The only solution I know of so far is to actually create my own MANIFEST.MF in src/main/java/resources/META-INF
and let it be filtered+copied during resources phase. But I want to avoid this solution, I want the manifest to be generated standard way using <archive>
configuration in pom file.
You can do this with maven-bundle-plugin.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<index>true</index>
<manifest>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Implementation-URL>${project.url}</Implementation-URL>
<Java-Version>${java.version}</Java-Version>
<Java-Vendor>${java.vendor}</Java-Vendor>
<Os-Name>${os.name}</Os-Name>
<Os-Arch>${os.arch}</Os-Arch>
<Os-Version>${os.version}</Os-Version>
<Scm-Url>${project.scm.url}</Scm-Url>
<Scm-Connection>${project.scm.connection}</Scm-Connection>
</manifestEntries>
</archive>
</configuration>
</plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With