我有一个像这样的项目结构:
A
src
...
build.gradle
B
src
...
build.gradle
build.gradle
settings.gradle
模块A build.gradle
如下所示:
apply plugin: "java"
dependencies {
compile project(':B')
}
// Maven configurations.
apply plugin: "maven-publish"
task sourceJar(type: Jar) {
from sourceSets.main.allSource
}
artifacts {
archives sourceJar
}
publishing {
repositories {
maven { url "https://..." }
}
publications {
mavenJava(MavenPublication) {
groupId = "..."
artifactId = "..."
version = "..."
from components.java
}
}
}
它编译得很好但是当它被发布时,用户会收到一个错误,即无法解析依赖项default:B:unspecified
。如何告诉Gradle Maven插件将模块B静态编译到正在发布的工件中(而不是将其列为依赖项)?
整个项目有点复杂,我不想复制B源,也不想将模块B作为独立库发布到Maven。