У меня многопроектная сборка со следующей структурой:
Root project 'just-another-root-project'
+--- Project ':producer'
\--- Project ':consumer'
Корневой файл settings.gradle
:
rootProject.name = 'just-another-root-project'
include 'consumer', 'producer'
... соединяет созданные модули.
Файл producer.gradle
:
plugins {
id 'java-library'
}
group 'com.github.yarbshk.jarp'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven {
url 'http://maven.nuiton.org/release/'
}
}
dependencies {
implementation 'com.sun:tools:1.7.0.13'
}
... имеет внешнюю зависимость (com.sun.tools
), которая не публикуется в Maven Central, поэтому я добавил ссылкув репозиторий Nuiton.
Файл consumer.gradle
:
plugins {
id 'java'
}
group 'com.github.yarbshk.jarp'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
annotationProcessor project(':producer')
}
Сборка, описанная выше, не работает!Для этого я был вынужден дублировать все репозитории с producer.gradle
на consumer.gradle
. Итак, вопрос в том, как построить корневой проект без чрезмерного дублирования зависимостей? Как это сделать правильно?Спасибо за любой ответ или подсказку:)
ОБНОВЛЕНИЕ 1 :
При попытке создать проект с файлами, показанными выше, я получаю следующую ошибку:
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':consumer:compile'.
> Could not find com.sun:tools:1.7.0.13.
Searched in the following locations:
https://repo.maven.apache.org/maven2/com/sun/tools/1.7.0.13/tools-1.7.0.13.pom
https://repo.maven.apache.org/maven2/com/sun/tools/1.7.0.13/tools-1.7.0.13.jar
Required by:
project :consumer > project :producer