Problem with BOM in Gradle 5->6 switch

Hello,
I’ve try to switch one of my project to Gradle 6 and I encoutered problems with BOM and dependencies

I’ve declared the following in my build.gradle.kts (obviously it’s an excerp)

object Versions {
const val wildfly = “16.0.0.Final”
}

object Libs {
const val wildfly = “org.wildfly.bom:wildfly-javaee8:${Versions.wildfly}”
}

val wildfly by configurations.creating

dependencies {
wildfly(platform(“${Libs.wildfly}”))
wildfly(“org.jboss.spec:jboss-javaee-8.0”)
wildfly(“org.jboss.resteasy:resteasy-jaxrs”)
wildfly(“org.jboss.resteasy:resteasy-jackson2-provider”)
wildfly(“org.jboss.resteasy:resteasy-multipart-provider”)

configurations.providedCompile.get().extendsFrom(wildfly)

}

When I launch gradle to build a war in 5.6.3 all is fine
When I change to 6.0.1 I’ve the following error:

Execution failed for task ‘:myproj:compileJava’.

Could not resolve all files for configuration ‘:myproj:compileClasspath’.
Could not find org.jboss.spec:jboss-javaee-8.0:.
Required by:
project :myproj

I try to replace my configuration by direct reference (instead of wildfly(…) I put providedCompile(…)
with the same error. I also replace Libs.wildfly by the fully qualified name and it still fail with the same error.

What did i do wrong and how can I correct it ?

Hi @f-renout,

Your build script looks fine in general. I tried your sample and for me it also fails with 5.6.3.

The problem is that org.jboss.spec:jboss-javaee-8.0 is itself a BOM. And it is defined with import scope in the wildfly-javaee8 BOM. In this case, Gradle interprets the import by “flattening” the BOMs during parsing. So you will automatically get all entries of imported BOMs. I think you should be fine by just removing wildfly(“org.jboss.spec:jboss-javaee-8.0”) from the build script.

Thank for your help, all is ok now.
I still didn’t understand how I could build without fail with previous gradle version but my problem is solved

1 Like