我有一个多模块项目。有2个模块: -服务器模块 -域模块
在我放入的域模块的build.gradle中:
group = 'com.xxx.yyyy.zzz'
version = '1.0.0-SNAPSHOT'
和服务器模块按如下所示导入域模块:
dependencies {
compile group: 'com.xxx.yyyy.zzz', name: 'domain', version: '1.0.0-SNAPSHOT'
...
}
但是,他无法检测到它!
该罐子已发布到Maven M2存储库中,我能够看到它。我正在使用mavenLocal从m2获取依赖项
repositories {
mavenLocal()
mavenCentral()
}
我删除了gradle缓存,成功停止了gradle守护进程!
有什么想法吗?
服务器模块的build.gradle:
group = 'com.xxx.yyy.zzz'
version = '1.0.0-SNAPSHOT'
repositories {
mavenLocal()
mavenCentral()
}
apply plugin: "org.springframework.boot"
apply plugin: "net.ltgt.apt"
apply plugin: "maven"
apply plugin: 'base'
apply plugin: 'maven-publish'
dependencies {
compile group: 'com.xxx.yyy.zzz', name: 'domaine', version: '1.0.0-SNAPSHOT'
// other dependecies ......
}
域模块的build.gradle:
group = 'com.desjardins.experiencecredit.gestiondemandes'
version = '1.0.0-SNAPSHOT'
repositories {
mavenLocal()
mavenCentral()
}
apply plugin: "maven"
apply plugin: 'base'
apply plugin: 'maven-publish'
uploadArchives {
repositories {
mavenDeployer {
repository(url: mavenrepo)
}
}
}
jar.finalizedBy uploadArchives
主项目的settings.gradle:
pluginManagement {
repositories {
gradlePluginPortal()
}
}
rootProject.name = 'XXX'
include 'server'
include 'domaine'
答案 0 :(得分:0)
如果同一项目中有多个模块,则应改用project
对象声明依赖项:
settings.gradle在根项目级别
rootProject.name = 'my-application'
include 'server'
include 'domain'
然后定义构建文件-根项目build.gradle,服务器模块build.gradle和域模块build.gradle。
在服务器模块的build.gradle中,声明依赖关系,如下所示:
dependencies {
compile project(':domain')
...
}