简体   繁体   English

如何在 Maven pom.xml 中提供 Nexus 路径

[英]How to provide Nexus path in Maven pom.xml

I am using maven for my project and need to provide a Nexus path after providing GroupId, ArtifactId and Version.我正在为我的项目使用 maven,并且需要在提供 GroupId、ArtifactId 和 Version 之后提供 Nexus 路径。

<dependency>
    <groupId>com.org.abc</groupId>
    <artifactId>myartifactid</artifactId>
    <version>myversion</version>
</dependency>
<dependency>
    <groupId>com.org.def</groupId>
    <artifactId>myartifactid</artifactId>
    <version>myversion</version>
</dependency>
<dependency>
    <groupId>com.org.ghi</groupId>
    <artifactId>myartifactid</artifactId>
    <version>myversion</version>
</dependency>

My Nexus path - https://nexus/content/repositories/我的 Nexus 路径 - https://nexus/content/repositories/

Artifact present in path - https:/mynexusdomain/nexus/content/repositories/snapshots/ com/org/abc/myartifactid/MySnapshotVersion/plugins/MyRequiredJars路径中存在工件 - https:/mynexusdomain/nexus/content/repositories/snapshots/ com/org/abc/myartifactid/MySnapshotVersion/plugins/MyRequiredJars

Settings.xml:设置.xml:

<?xml version="1.0" encoding="utf-8"?>
<settings xmlns="http://maven.apache.org/settings/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 <localRepository>D:/Maven_repo</localRepository>
  <mirrors>
    <mirror>
      <id>nexus</id>          
      <name>Nexus</name>
<url>http://NexusDomain/nexus/content/repositories/myrepo/myrepo1/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>

Here, as per the pom file, I can mention the groupid (com.org.abc), artifactid (myartifactid).在这里,根据 pom 文件,我可以提及 groupid (com.org.abc)、artifactid (myartifactid)。 Is there any possible ways to mention the path after artifactid in nexus url ie., to take artifact inside that particular folder ?是否有任何可能的方法可以在 nexus url 中提及 artifactid 之后的路径,即在该特定文件夹中获取 artifact ?

Any inputs would be really appreciated.任何输入将不胜感激。 Thank you !谢谢 !

No, you don't use folders inside Nexus.不,您不使用 Nexus 中的文件夹。 Only groupId, artifactId, version.只有 groupId、artifactId、version。 If you need to load other JARs, load them with their own respective groupId, artifactId, version.如果您需要加载其他 JAR,请使用各自的 groupId、artifactId、version 加载它们。

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

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