java - 在多项目结构中使用 gradle 将一个模块包含到另一个模块中
问题描述
我正在尝试构建一个example-project
包含common
使用 Gradle 的类的 jar。当我构建根项目时,我得到了两个 jar,但 jar fromexample-project
不包含来自common
.
这是我settings.gradle
的build.gradle
根项目。
rootProject.name = 'ExampleProject'
include 'common'
include 'example-project'
include 'example-api'
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'com.github.johnrengelman.shadow' version '5.2.0' apply false
}
allprojects {
apply plugin: 'java'
group 'me.example'
version '1.0.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
subprojects {
apply plugin: 'com.github.johnrengelman.shadow'
repositories {
mavenCentral()
maven {url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'}
maven {url = 'https://oss.sonatype.org/content/groups/public/'}
maven {url = 'https://repo.codemc.org/repository/maven-public/'}
maven {url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'}
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT'
compileOnly 'me.clip:placeholderapi:2.10.6'
implementation 'org.bstats:bstats-bukkit:1.7'
testImplementation group: 'junit', name: 'junit', version: '4.12'
}
}
project(':example-project') {
dependencies {
implementation project(':common')
}
}