Reputation: 1019
For years we have been building our JEE app with wildfly and gradle, and maintaining all the versions for compileOnly dependencies provided by Wildfly by hand, a typical example from a build.gradle
with our "typical dependencies" might be i.e.
dependencies {
compileOnly( // provided by server
// JEE specification
'javax.annotation:javax.annotation-api:1.3',
'javax.ejb:javax.ejb-api:3.2',
'javax.enterprise:cdi-api:2.0',
'javax.enterprise.concurrent:javax.enterprise.concurrent-api:1.0',
'javax.inject:javax.inject:1',
'javax.interceptor:javax.interceptor-api:1.2',
'javax.persistence:javax.persistence-api:2.2',
'javax.servlet:javax.servlet-api:3.1.0',
'javax.transaction:javax.transaction-api:1.3',
'javax.ws.rs:javax.ws.rs-api:2.1',
'javax.xml:jaxrpc-api:1.1',
'javax.xml.bind:jaxb-api:2.3.1',
'javax.xml.soap:javax.xml.soap-api:1.3.8',
'javax.xml.ws:jaxws-api:2.3.0',
'commons-io:commons-io:2.15.1',
'org.apache.commons:commons-lang3:3.12.0',
'com.fasterxml.jackson.core:jackson-annotations:2.12.7',
'com.fasterxml.jackson.core:jackson-core:2.12.7',
'com.fasterxml.jackson.core:jackson-databind:2.12.7',
'com.google.code.gson:gson:2.11.0',
)
This works more or less fine, but obviously tedious to maintain when we update the app server version and/or gets forgotten (mostly not critical as long as APIs don't change of course, since Wildfly provides the dependencies in the "right version" at runtime).
Having recently worked with Spring and their BOM in gradle, I was impressed how easy setting up my dependencies were in comparision:
implementation platform("org.springframework.ai:spring-ai-bom:1.0.0-SNAPSHOT")
implementation 'org.springframework.ai:spring-ai-vertex-ai-gemini'
implementation 'org.springframework.ai:spring-ai-vertex-ai-embedding-spring-boot-starter'
implementation 'org.springframework.ai:spring-ai-chroma-store'
So I was inspired to move our gradle to use the Widlfly BOM in a similar fashion. I created a simple gradle quickstart project and tried adding the BOM to the project (using javax
since stuck with it and Wildfly 26 until we complete the JakarteEE migration in our code Real Soon Now) like this:
dependencies {
// tried with implementation vs api
// also tried with different BOM I found at the GitHub page
api platform('org.wildfly.bom:wildfly:26.1.2.Final')
implementation 'javax.annotation:javax.annotation-api'
}
Without adding any code or including reference to the dependencies, gradle immediately complains:
wfly-bom $ gradle assemble
> Task :lib:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':lib:compileJava'.
> Could not resolve all files for configuration ':lib:compileClasspath'.
> Could not find javax.annotation:javax.annotation-api:.
Required by:
project :lib
Should using the BOM in gradle work like this or similarly? I have seen that there are many different Wildfly BOMs in this project which is archived (?) with no reference to the successor (another question that perhaps a Widlfly expert can clarify: is the BOM project dead? Or why is it archived? I found these BOM in mvnrepository, but all starting with Wildfly 27).
I am stumped, can someone provide a working example or point me to a project in Github or similar that is successfully using a wildfly BOM in gradle to manage versions of the provided dependencies?
(yes, I know I still need to export the modules I need in my jboss-deployment-structure.xml
but this part is already version agnostic).
Upvotes: 0
Views: 70