简体   繁体   English

META-INF中的Maven pom.xml与Maven存储库中的pom.xml

[英]Maven pom.xml in META-INF vs pom.xml in Maven repository

I'm trying to produce a Maven-compatible artefact using bazel . 我正在尝试使用bazel生成与Maven兼容的人工制品。 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 ) 我注意到mvn将一些文件放在JAR存档中的META-INF目录中( file.jar/META-INF/maven/groupId/artifactId/pom.xmlfile.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. 我知道你可以通过pom.xml ref中的配置选项禁用它们,这让我相信你没有。
  2. Are they used by mvn in any case whatsoever? 在任何情况下, mvn都使用它们吗?
  3. Can I use pom.xml inside on the JAR instead of pom.xml near my artifact in Maven repo? 我可以用pom.xml在瓶子 ,而不是 pom.xml靠近我在Maven的回购神器?

We have several jars in your Maven repository that do not contain a pom.xml. 我们在Maven存储库中有几个不包含pom.xml的jar。 For maven, the revelant pom.xml is the one that is outside your artifact. 对于maven,重要的pom.xml是你工件之外的那个。 In Nexus, you deploy a jar always along with a pom.xml and that is the one that counts. 在Nexus中,您总是将一个jar与pom.xml一起部署,这就是重要的一个。

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. 因此,如果要从Maven中使用它,则需要与jar一起发布pom.xml,但不需要将其放入其中。 AFAIK you cannot change this behaviour. AFAIK你无法改变这种行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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