When building part1 of the tutorial on CentOS 6.5,java version "1.7.0_51" I get Gradle error:
You can't change configuration 'providedCompile' because it is already resolved!
[localhost part1]$ gradle clean jar
FAILURE: Build failed with an exception.
Where: Build file '/home/test/wks/Cascading/Java/Impatient/part1/build.gradle' line: 43
What went wrong: A problem occurred evaluating project ':part1'.
You can't change configuration 'providedCompile' because it is already resolved!
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
What may be wrong? Thanks!
This is a shot in the dark but I had the same issue (different project) and searching is how I landed here on SO. In my case the error was caused by a '+=' in my script that was adding a single element to a collection. The other response to the OP's issue from another forum is simply to use Gradle 1.12.
HTH.
This answer has a wider scope than the "tutorial" build, and also applicable to those who land here while searching for a solution to the actual error reported by the build.
From Gradle Community Forums:
Gradle 2 updated to Groovy 2.3, which no longer supports the use of += for adding a single element to a collection. So instead of scopes.PROVIDED.plus += configurations.provided it's now scopes.PROVIDED.plus += [configurations.provided]. (The other uses of '+=' are OK.)
AS JavaBrewer proposed, if you compile this against a version of gradle bigger than 2.0 you need to change the file: common/providedCompile.gradle
apply plugin: 'maven'
configurations {
providedCompile
}
sourceSets {
main.compileClasspath += [configurations.providedCompile]
}
task mappings {
conf2ScopeMappings.addMapping( 0, configurations.providedCompile, Conf2ScopeMappingContainer.PROVIDED )
}
idea {
module {
scopes.PROVIDED.plus += [configurations.providedCompile]
}
}
javadoc {
classpath += configurations.providedCompile
}
eclipse {
classpath{
plusConfigurations += [configurations.providedCompile]
}
}
Pay attention that since version 2.0 in order to add an element to a collection with the operator +=, you have to append another collection. you achieve this by adding []
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With