Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing dependencies for Spring Boot project #33

Open
bryandatanerds opened this issue Jan 28, 2021 · 2 comments
Open

Missing dependencies for Spring Boot project #33

bryandatanerds opened this issue Jan 28, 2021 · 2 comments

Comments

@bryandatanerds
Copy link

bryandatanerds commented Jan 28, 2021

If I create a Gradle Java project using https://start.spring.io with recent Gradle (6.7.1) and Spring (2.4.1), gradle2nix seems to miss POM-only *-bom and *-parent dependencies in the gradle-env.json it produces. It's a bit slow to go through and add them one by one, so I haven't got a complete list yet, but here are the missing deps so far:

spring-boot-dependencies-2.4.1.pom
java-driver-bom-4.9.0.pom
metrics-bom-4.1.16.pom
metrics-parent-4.1.16.pom
groovy-bom-2.5.14.pom
infinispan-bom-11.0.8.Final.pom
infinispan-build-configuration-parent-11.0.8.Final.pom
jboss-parent-36.pom
jackson-bom-2.11.3.pom
oss-parent-38.pom
jackson-parent-2.11.pom
jersey-bom-2.32.pom
jetty-bom-9.4.35.v20201120.pom
junit-bom-5.7.0.pom
kotlin-bom-1.4.21.pom
kotlinx-coroutines-bom-1.4.2.pom
log4j-bom-2.13.3.pom
logging-parent-1.pom
apache-18.pom
micrometer-bom-1.6.2.pom
netty-bom-4.1.55.Final.pom
ojdbc-bom-19.8.0.0.pom
r2dbc-bom-Arabba-SR8.pom

Edit: For what it's worth, this worked mostly fine with e0ebece, Gradle 5.4.1, and Gradle plugins org.springframework.boot:2.2.0.RELEASE and io.spring.dependency-management:1.0.10.RELEASE, and I only had to add in a few missed deps, not this many. Updating to Gradle 6.7 and Spring Boot 2.3.4 seems to have caused the problem to grow in a way that updating gradle2nix didn't fix.

@tadfisher
Copy link
Owner

tadfisher commented Feb 3, 2021

Maven BOM artifacts are currently supported via the built-in Gradle platform() and enforcedPlatform() APIs. Projects generated using that tool do not use Gradle's BOM support; instead they apply the Spring Dependency Management plugin, which performs its own dependency resolution and maintains a separate ConfigurationContainer to do so.

I could add support for this if the plugin is popular enough. In the meantime, I suggest that you remove that plugin and import the BOM directly:

repositories {
    mavenCentral()
}

dependencies {
    implementation(enforcedPlatform("org.springframework.boot:spring-boot-dependencies:2.4.2"))
    implementation("org.springframework.boot:spring-boot-starter")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
}

@lorenzleutgeb
Copy link

lorenzleutgeb commented Apr 6, 2021

For posterity, I ran into a similar issue. Was getting

Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.junit:junit-bom:5.7.1.
Required by:
    project : > org.junit.jupiter:junit-jupiter-params:5.7.1 > org.junit.jupiter:junit-jupiter-api:5.7.1 > org.junit.platform:junit-platform-commons:1.7.1
Cause 1: org.gradle.internal.resolve.ModuleVersionResolveException: No cached version of org.junit:junit-bom:5.7.1 available for offline mode.

and worked around by adding

dependencies {
    implementation(enforcedPlatform("org.junit:junit-bom:5.7.1"))
}

Thanks for the hint 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants