我的项目中有一个git子模块(我无法控制),其中包含名为publish.gradle
的文件。该文件的内容是:
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
version = System.getenv()['VERSION'] ?: version
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
artifactory {
contextUrl = repoBaseUrl
publish {
String publishRepoKey = version.endsWith('SNAPSHOT') ? repoKeySnapshot : repoKeyRelease
repository {
repoKey = publishRepoKey // The Artifactory repository key to publish to
username = System.getenv()['ARTIFACTORY_USERNAME'] ?: artifactoryUser // The publisher user name
password = System.getenv()['ARTIFACTORY_PASSWORD'] ?: artifactoryPassword // The publisher password
}
defaults {
publications('mavenJava')
publishArtifacts = true
publishPom = true
}
}
resolve {
repoKey = repoKey
}
}
在我的build.gradle
文件中,我有以下一行:
apply from: "${rootDir}/submodule/gradle/publish.gradle"
当我尝试在此行之后添加以下行时:
task sourceJar(type: Jar) {
from sourceSets.main.allJava
}
publishing.publications.mavenJava.artifact sourceJar {
classifier 'sources'
}
然后发布正确的内容,除了存储库中的pom
文件只包含<dependencyManagement/>
部分并且缺少所有依赖项。当我从build.gradle
移除上述行时,pom
是正确的。
答案 0 :(得分:0)
尝试使用:
覆盖所有-Djdk.attach.allowAttachSelf=true
块
publishing