我已经配置了一个简单的Maven自由式项目。我能够成功构建项目,但无法部署到Nexus。我收到此错误:
[错误]无法在项目eqs_utility上执行目标org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy(默认部署):无法部署工件:找不到工件com.companyName .eqs:eqs_utility:jar:1.0.1-20190529.191240-1 in nexus(https://nexus.companyRepo.com/repository/maven-snapshot/)-> [Help 1]
我试图更改配置以简化项目,但仍然没有任何效果。 Setting.xml发生更改。
已编辑 我将以下内容添加到我的POM.xml
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>nexus</id>
<name>Company Nexus Repository</name>
<url>https://nexus.mycompany.com/repository/maven-release/</url>
</repository>
<snapshotRepository>
<uniqueVersion>true</uniqueVersion>
<id>nexus</id>
<name>Company Nexus Snapshots</name>
<url>https://nexus.companyName.com/repository/maven-snapshot/</url>
</snapshotRepository>
</distributionManagement>
然后,用此更新我的settings.xml
<server>
<id>nexus</id>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
</server>
<!-- Another sample, using keys to authenticate. -->
<server>
<id>nexus</id>
<username>NexusUser</username>
<password>MyLongTokenValueHere</password>
</server>
答案 0 :(得分:1)
根据Apache Maven Deploy Plugin setup
您需要一个部分:
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>MyCo Internal Repository</name>
<url>Host to Company Repository</url>
</repository>
</distributionManagement>
在使用Nexus时,您可能需要在pom中的一个部分与您的nexus存储库对齐(一个用于快照,一个用于发布工件,因为您不能将它们合并在nexus中):
<distributionManagement>
<repository>
<id>mavenrepository</id>
<url>http://mavenrepository.companyName.com/nexus/content/repositories/m3</url>
</repository>
<snapshotRepository>
<id>tmavenrepository</id>
<url>http://mavenrepository.companyName.com/nexus/content/repositories/m3-snapshots</url>
</snapshotRepository>
</distributionManagement>
当然,还有您的本地设置或其他私人位置
<server>
<id>mavenrepository</id>
<username>maven</username>
<password>foobar</password>
</server>