2
我是Gradle,nexus和Maven的新手,嘗試使用Gradle'publish'任務將Jenkins的Maven工件發佈到新的nexus存儲庫。詹金斯的工作在發佈時失敗,出現錯誤。我在工作中提供了Nexus的用戶名和密碼。無法使用Gradle將工件發佈到Nexus Maven存儲庫
:common-test:publishMavenJavaPublicationToMavenRepositoryCould not find metadata com.xx.audit:common-test:1.0.3-SNAPSHOT/maven-metadata.xml in remote (https://nexus.xx.com:8443/content/repositories/snapshots) Upload https://nexus.xx.com:8443/content/repositories/snapshots/yy/audit/common-test/1.0.3-SNAPSHOT/common-test-1.0.3-20151102.120123-1.jar Could not transfer artifact com.xx.audit:common-test:jar:1.0.3-20151102.120123-1 from/to remote (https://nexus.xx.com:8443/content/repositories/snapshots): Could not write to resource 'yy/audit/common-test/1.0.3-SNAPSHOT/common-test-1.0.3-20151102.120123-1.jar'
我們是否需要在發佈第一次之前在nexus maven資源庫中創建文件夾結構?並添加maven-metadata.xml?如何生成* .pom.sha,* .pom.md5。 請幫助我。
的build.gradle配置:
apply plugin: "maven-publish" //* New Gradle task to jar source task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' from sourceSets.main.allSource } //* New Gradle task to jar javadoc task javadocJar(type: Jar, dependsOn: javadoc) { classifier = 'javadoc' from javadoc.destinationDir } publishing { publications { mavenJava(MavenPublication) { from components.java artifact sourcesJar { classifier "sources" } } } } publishing { repositories { maven { credentials { username nexusUsername password nexusPassword } if (project.version.endsWith('-SNAPSHOT')) { url nexusSnapshotRepoURL } else { url nexusReleaseRepoURL } } } }
你檢查了你的nexus服務器的文件系統的權限導致'from/to remote(https://nexus.xx.com:8443/content/repositories/snapshots):無法寫入資源'yy/audit/common-test/1.0.3-SNAPSHOT/common-test-1.0.3-20151102.120123-1.jar''這可能是一個指標......除此之外,您並未顯示完整的錯誤輸出。 .. – khmarbaise