I have a multi project setup where I build multiple jar and I need to copy them to a folter inside an ear file.
configuration {
jar
}
dependencies {
jar project(path: ":project1", configuration: 'default')
jar project(path: ":project2", configuration: 'default')
jar project(path: ":project3", configuration: 'default')
}
tasks.register('zipwildfly', Zip) {
...
from(configurations.jar) {
into '/lib'
}
...
}
The projects has load of dependencies and end up needing quava.
And I get this output
Execution failed for task ':edelivery-broker-ear:zipwildfly'.
> Could not resolve all files for configuration ':edelivery-broker-ear:nisse'.
> Could not resolve com.google.guava:guava.
Required by:
project :edelivery-broker-ear > project :edelivery-cxf
> Unable to find a matching variant of com.google.guava:guava:33.5.0-jre:
- Variant 'androidApiElements'
- Variant 'androidRuntimeElements'
- Variant 'jreApiElements'
- Variant 'jreRuntimeElements'
> Could not find org.apache.httpcomponents:httpclient:.
Required by:
project :edelivery-broker-ear > project :edelivery-cxf
> Could not find commons-collections:commons-collections:.
Required by:
project :edelivery-broker-ear > project :edelivery-cxf
> Could not resolve com.google.guava:guava:33.5.0-jre.
Required by:
project :edelivery-broker-ear > project :edelivery-cxf > org.apache.cxf:cxf-rt-ws-security:4.1.4 > org.apache.wss4j:wss4j-ws-security-common:4.0.1
> Unable to find a matching variant of com.google.guava:guava:33.5.0-jre:
- Variant 'androidApiElements'
- Variant 'androidRuntimeElements'
- Variant 'jreApiElements'
- Variant 'jreRuntimeElements'
> Could not resolve com.google.guava:guava:33.0.0-jre.
Required by:
project :edelivery-broker-ear > project :edelivery-cxf > org.apache.cxf:cxf-rt-ws-security:4.1.4 > org.apache.wss4j:wss4j-ws-security-common:4.0.1 > org.opensaml:opensaml-saml-impl:5.1.6
project :edelivery-broker-ear > project :edelivery-cxf > org.apache.cxf:cxf-rt-ws-security:4.1.4 > org.apache.wss4j:wss4j-ws-security-common:4.0.1 > org.opensaml:opensaml-xacml-impl:5.1.6
project :edelivery-broker-ear > project :edelivery-cxf > org.apache.cxf:cxf-rt-ws-security:4.1.4 > org.apache.wss4j:wss4j-ws-security-common:4.0.1 > org.opensaml:opensaml-xacml-impl:5.1.6 > org.opensaml:opensaml-core-api:5.1.6
project :edelivery-broker-ear > project :edelivery-cxf > org.apache.cxf:cxf-rt-ws-security:4.1.4 > org.apache.wss4j:wss4j-ws-security-common:4.0.1 > org.opensaml:opensaml-saml-impl:5.1.6 > org.opensaml:opensaml-profile-api:5.1.6
project :edelivery-broker-ear > project :edelivery-cxf > org.apache.cxf:cxf-rt-ws-security:4.1.4 > org.apache.wss4j:wss4j-ws-security-common:4.0.1 > org.opensaml:opensaml-xacml-saml-impl:5.1.6 > org.opensaml:opensaml-saml-api:5.1.6
project :edelivery-broker-ear > project :edelivery-cxf > org.apache.cxf:cxf-rt-ws-security:4.1.4 > org.apache.wss4j:wss4j-ws-security-common:4.0.1 > org.opensaml:opensaml-saml-impl:5.1.6 > org.opensaml:opensaml-security-api:5.1.6
project :edelivery-broker-ear > project :edelivery-cxf > org.apache.cxf:cxf-rt-ws-security:4.1.4 > org.apache.wss4j:wss4j-ws-security-common:4.0.1 > org.opensaml:opensaml-saml-impl:5.1.6 > org.opensaml:opensaml-xmlsec-api:5.1.6
project :edelivery-broker-ear > project :edelivery-cxf > org.apache.cxf:cxf-rt-ws-security:4.1.4 > org.apache.wss4j:wss4j-ws-security-common:4.0.1 > org.opensaml:opensaml-saml-impl:5.1.6 > net.shibboleth:shib-security:9.1.6
project :edelivery-broker-ear > project :edelivery-cxf > org.apache.cxf:cxf-rt-ws-security:4.1.4 > org.apache.wss4j:wss4j-ws-security-common:4.0.1 > org.opensaml:opensaml-saml-impl:5.1.6 > net.shibboleth:shib-networking:9.1.6
project :edelivery-broker-ear > project :edelivery-cxf > org.apache.cxf:cxf-rt-ws-security:4.1.4 > org.apache.wss4j:wss4j-ws-security-common:4.0.1 > org.opensaml:opensaml-xacml-impl:5.1.6 > net.shibboleth:shib-support:9.1.6
project :edelivery-broker-ear > project :edelivery-cxf > org.apache.cxf:cxf-rt-ws-security:4.1.4 > org.apache.wss4j:wss4j-ws-security-common:4.0.1 > org.opensaml:opensaml-saml-impl:5.1.6 > org.opensaml:opensaml-soap-impl:5.1.6
> Unable to find a matching variant of com.google.guava:guava:33.5.0-jre:
- Variant 'androidApiElements'
- Variant 'androidRuntimeElements'
- Variant 'jreApiElements'
- Variant 'jreRuntimeElements'
But when I add the java plugin this problem goes away.
. It was an idea that popped up because java dependencies I believe sets som attributes so that variants can be resolved. My initial attempt was to extend implementation. That does not seem to have any bearing on the issue. The java plugin solves the issue. And as you see I changed configurations jar to nisse and it behaves exactly the same.
What does the java plugin provide that solves the issue? I really want to understand more.
I think am on gradle 8.11.1 using java 21. I am in the middle of migrating from java 11 to 21 and to ee10.