Hello!
Let me introduce my problem:
I have a simple mix
project. I mean I have the project with the next structure:
root
|
\ A (spring-based with java)
\ B (It takes A)
\ C (It takes B)
...
So, each build.gradle looks like:
A module:
plugins {
id 'java-library'
id 'org.springframework.boot' version '3.4.4'
id 'io.spring.dependency-management' version '1.1.7'
}
group = 'org.example'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
}
B module:
plugins {
id 'java'
id 'pmd'
}
pmd {
consoleOutput = true
toolVersion = "7.12.0"
}
group = 'org.example'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
implementation project(':A')
}
C module:
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.4'
id 'io.spring.dependency-management' version '1.1.7'
}
group = 'org.example'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation project(':B')
}
tasks.named('test') {
useJUnitPlatform()
}
When I run gradle build
or gradle pmdMain
I got an issue:
Execution failed for task ':B:pmdMain'.
> Could not resolve all files for configuration ':B:mainPmdAuxClasspath'.
> Could not find org.springframework.boot:spring-boot-starter-web:.
Required by:
project :B > project :A
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Let me highlight there is no any code used from module A in module B. Module B
just takes A
with implementation project(':A')
and nothing more: threre is no any import, or class, just declaration in build.gradle
Why does it work so?
PMD checks only transitive dependencies. I mean if there is some usage of class TestController
with @RestController
spring annotation from module A in module B then it’s okay, it’s needed. But here where only implementation 'org.springframework.boot:spring-boot-starter-web'
is used…
Could you please help me in that question?