Search code examples
javamavenjarmaven-pluginmanifest.mf

Access MANIFEST.MF files of project dependencies using maven


I have a maven project with several dependencies that are developed internally by my team. I need some information contained on the MANIFEST.mf files of those dependencies at build time of my current project.

Just to be clear. I don't want to get information from my own MANIFEST.mf file (the one from the project I am building). I want to access information contained inside the MANIFEST.mf files of the dependencies of my project at build time.

I built a maven plugin where I can check the dependency tree and retrieve some basic information about the dependencies, however I haven't found a straight forward way of getting to the MANIFEST.mf files.

Do you have any clues on how I can access them (programatically)?

Thanks!


Solution

  • Use the file of the artifact to create a https://docs.oracle.com/javase/8/docs/api/java/util/jar/JarFile.html , which gives you access to the Manifest