我正在嘗試使用 Ant 上傳到 maven (nexus) repo,但是我遇到了錯誤。請查看我的 build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:resolver="antlib:org.apache.maven.resolver.ant">
<path id="maven-ant-tasks.classpath" path="path/to/lib/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" />
<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
<fileset dir="path/to/lib/" includes="maven-resolver-ant-tasks-1.4.0-uber.jar"/>
</classpath>
</taskdef>
<property name="nexus_web" value="https://nexus.location.com/repository/location/item" />
<resolver:authentication username="login-username" password="PASSWORD" id="auth"/>
<resolver:remoterepo id="server" url="${nexus_web}">
<resolver:releases enabled="true" checksums="warn"/>
<resolver:authentication refid="auth"/>
</resolver:remoterepo>
<resolver:remoterepos id="all">
<resolver:remoterepo refid="server"/>
</resolver:remoterepos>
<resolver:artifacts id="producedArtifacts">
<resolver:artifact file="path/to/item/build/item/build/item-21-08-8.tar"/>
</resolver:artifacts>
<resolver:pom file="nexus-upload-pom.xml" id="pom"/>
<target name="deploy">
<resolver:deploy artifactsref="producedArtifacts">
<resolver:remoterepo refid="server"/>
</resolver:deploy>
</target>
</project>
和我的 nexus-upload-pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>testing</groupId>
<artifactId>item</artifactId>
<version>21-08-2</version>
<name>item-name</name>
</project>
當我通過“ant deploy”運行它時
我收到以下錯誤:
deploy:
[resolver:deploy] Using default POM (testing:item:21-08-2)
[resolver:deploy] Uploading https://nexus.location.com/repository/testing-maven/item/testing/item/21-08-2/item-21-08-2.pom
[resolver:deploy] Uploaded https://nexus.location.com/repository/testing-maven/item/testing/item/21-08-2/item-21-08-2.pom (189 B at 0.7 KB/sec)
[resolver:deploy] Uploading https://nexus.location.com/repository/testing-maven/item/testing/item/21-08-2/item-21-08-2.tar
[resolver:deploy] Uploaded https://nexus.location.com/repository/testing-maven/item/testing/item/21-08-2/item-21-08-2.tar (347500 KB at 23231.7 KB/sec)
[resolver:deploy] Downloading https://nexus.location.com/repository/testing-maven/item/testing/item/maven-metadata.xml
[resolver:deploy] Uploading https://nexus.location.com/repository/testing-maven/item/testing/item/maven-metadata.xml
BUILD FAILED
path/to/item/build/nexus-upload.xml:34: Could not deploy artifacts: Failed to deploy metadata: Could not transfer metadata testing:item/maven-metadata.xml from/to dug (https://nexus.location.com/repository/testing-maven/item): status code: 400, reason phrase: Invalid maven-metadata.xml GAV testing, item, null does not match request path item/testing/item/maven-metadata.xml (400)
Total time: 16 seconds
作為一個踢球者:該位置的服務器上沒有 maven-metadata.xml。我正在嘗試找出上傳的那部分有什么問題,這是我在我的任何一個組態檔中得到的問題(null 有點贈品)還是我完全錯過了一些東西?
uj5u.com熱心網友回復:
內部網路上的一些閱讀使我找到了這條線索:
https://issues.sonatype.org/browse/NEXUS-19943 https://issues.sonatype.org/browse/NEXUS-26419
解決方法是:
nexus.maven.metadata.validation.enabled=false
將此屬性添加到 data-dir/etc/nexus.properties 中,然后重置 nexus。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/504822.html
上一篇:Jetty11.0.11-404在\src\main\webapp\static中的html檔案上-maven嵌入式fatjar
