Cascading: Java tutorial for building Impatient, Part1: Gradle not working

When creating part 1 of the CentOS 6.5 tutorial, java version "1.7.0_51" I get a Gradle error:

You cannot change the configuration of 'providedCompile' because it has already been resolved!

[localhost part1] $ Gradle net jar

FAILURE: build failed with exception.

  • Where: Create the file '/home/test/wks/Cascading/Java/Impatient/part1/build.gradle': 43

  • What went wrong: There was a problem evaluating the project ': part1'.

    You cannot change the configuration of 'providedCompile' because it is already allowed!

  • Try: Run with the --stacktrace option to get a stack trace. Run with the -info or --debug option to get more log output.

STRICTLY MALFUNCTIONAL

What could be wrong? Thanks!

+6
source share
2 answers

This is a shot in the dark, but I had the same problem (another project), and the search is how I landed here on SO. In my case, the error was caused by '+ =' in my script, which added one element to the collection. Another answer to the OP question from another forum is to just use Gradle 1.12.

NTN.

This answer has a broader scope than the textbook assembly, and also applies to those who land here looking for a solution to the actual error reported by the assembly.

From Gradle Community Forums :

Gradle 2 has been updated to Groovy 2.3, which no longer supports the use of + = to add a single item to a collection. Therefore, instead of scopes.PROVIDED.plus + = configurations.provided, now now scopes.PROVIDED.plus + = [configurations.provided]. (Other uses of "+ =" are fine.)

+5
source

AS JavaBrewer suggested that if you compile this with gradle version greater than 2.0, you need to modify 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] } } 

Please note that starting from version 2.0, in order to add an item to the collection using the + = operator, you need to add another collection. you achieve this by adding []

+3
source

Source: https://habr.com/ru/post/971650/


All Articles