我有一个gradle项目,它有jvm(Scala)子项目,我想将所有jars发布到m2存储库。
我像这样应用了maven-publish
...
allprojects {
apply plugin: 'maven-publish'
publishing {
repositories {
// path to somewhere in my repo
maven { url new File(project.rootProject.getProjectDir().absoluteFile.parentFile, ".m2-repo") }
}
}
}
...但是它仅发布根项目。我试过从子项目中运行
publish
;我收到了最新消息,但磁盘上的存储库未添加任何内容。我正在使用4.0.1 GradeWrapper
最佳答案
它必须是;
apply plugin: 'maven-publish'
publishing {
repositories {
// publish to a "local" repo that I can also consume or upload as I wish
maven { url new File(project.rootProject.getProjectDir().absoluteFile.parentFile, ".m2-repo") }
}
// really, really publish things
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
关于gradle - 无法使用Gradle发布子项目,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45152310/