简体   繁体   中英

Maven pom.xml in META-INF vs pom.xml in Maven repository

I'm trying to produce a Maven-compatible artefact using bazel . I noticed that mvn puts some files inside META-INF directory in JAR archive ( file.jar/META-INF/maven/groupId/artifactId/pom.xml and file.jar/META-INF/maven/groupId/artifactId/pom.properties )

Questions:

  1. Are they needed to be able to successfully depend on my artifact from another project? I know you can disable them via a config option in pom.xml ref , which leads me to believe that you don't.
  2. Are they used by mvn in any case whatsoever?
  3. Can I use pom.xml inside on the JAR instead of pom.xml near my artifact in Maven repo?

We have several jars in your Maven repository that do not contain a pom.xml. For maven, the revelant pom.xml is the one that is outside your artifact. In Nexus, you deploy a jar always along with a pom.xml and that is the one that counts.

So you need to publish a pom.xml along with your jar if you want to use it from Maven, but you do not need to put it inside. AFAIK you cannot change this behaviour.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM