I am migrating my gradle project from jdk 11 to jdk 17.
I changed the jdk version in project, gradle jvm and changed version of gradle to 7.4 from 6.6.
I also changed the org.gradle.jvmargs in gradle.properties file from this -Xmx4g -XX:+UseConcMarkSweepGC -Dfile.encoding=UTF-8
to now this org.gradle.jvmargs=-Xmx4g -XX:+UseZGC -Dfile.encoding=UTF-8
But when i refresh dependencies I am getting error –
A problem occurred evaluating root project .
> Failed to apply plugin 'org.gradle.java'.
> Cannot have two attributes with the same name but different types. This container already has an attribute named 'org.gradle.jvm.environment' of type 'java.lang.String' and you are trying to store another one of type 'org.gradle.api.attributes.java.TargetJvmEnvironment'
Below is the part of code in build.gradle file where I am getting this error –
subprojects {
apply plugin: 'jacoco'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'java'
project.allprojects {subproject ->
subproject.configurations.all{
try {
attributes {
attribute(Attribute.of('org.gradle.jvm.environment', String), 'standard-jvm')
}
}
catch(Exception e){}
}
}
I tried investigating but could not find solution
Arjun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.