Hi there. I’m trying to make a composite build work, but I’m getting errors regarding JVM version requirements.
The composite build is putting together 4 projects. Each of them works as expected independently. All work together when driven with a shell script and with modified gradle dependencies so they use each others’ products. I am only trying the composite build route to ease the dependency changes in each project during development. But apparently the composite build is creating some additional JVM versioning requirements.
The error I’m getting says that one of the substituted dependencies fails because the required JVM version doesn’t match:
Could not determine the dependencies of task ‘:sidechains-web3j-gradle-plugin:compileTestJava’.
Could not resolve all task dependencies for configuration ‘:sidechains-web3j-gradle-plugin:testCompileClasspath’.
Could not resolve org.web3j:core:4.6.0-SNAPSHOT.
Unable to find a matching variant of project :sidechains-web3j:core:
- Variant ‘apiElements’ capability org.web3j:core:4.6.0-SNAPSHOT:
- Incompatible attribute:
- Required org.gradle.jvm.version ‘8’ and found incompatible value ‘11’.
- Other attributes:
- Found org.gradle.category ‘library’ but wasn’t required.
- Required org.gradle.dependency.bundling ‘external’ and found compatible value ‘external’.
- Required org.gradle.libraryelements ‘classes’ and found compatible value ‘jar’.
- Required org.gradle.usage ‘java-api’ and found compatible value ‘java-api’.
The version 8 requirement seems to come from sidechains-web3j-gradle-plugin, which does
sourceCompatibility = 1.8.
My questions are:
- Both mentioned projects in that error message do use sourceCompatibility=targetCompatibility=1.8. This must be the source of the required v8. Where did the incompatible 11 come from? Is it because the composite build is being run on a v11 JVM?
- If so, is there anything I can do to fix this, given that other included builds do need a v11 JVM?
- Is it correct that sourceCompatibility translates into a JVM requirement?
- More generally: are composite builds supposed to work even if each project uses different Gradle and JVM versions? Project sidechains-web3j-gradle-plugin uses Gradle 5.6.3. Project sidechains-web3j uses Gradle 4.10.2. As said, both use sourceCompatibility=targetCompatibility=1.8. Other included builds use different Gradle and JVM versions, going up to v11. The composite build uses Gradle 6.0.1 and just defines the included builds and calls a task in each included build. Does this all even matter?
The repositories are all open source, so if helpful I can share more of them.