hyperledger-web3j / web3j-solidity-gradle-plugin

Gradle plugin providing tasks to compile Solidity contracts.
Apache License 2.0
21 stars 25 forks source link

Gradle compileSolidity error #36

Closed yanncks closed 3 years ago

yanncks commented 3 years ago

Getting this error:

Some problems were found with the configuration of task ':compileSolidity' (type 'SolidityCompile').

  • Type 'SolidityCompile' field 'pathRemappings' without corresponding getter has been annotated with @Input, @Optional.

The getter and setters in that class are missing the "s".

xaviarias commented 3 years ago

Hi, which code are you compiling? Master branch builds OK.

yanncks commented 3 years ago

Version 4.8.4.

Doesn't this look wrong? https://github.com/web3j/solidity-gradle-plugin/blob/027b081ee2079c5f537d6cb55a8edce2b2748b9e/src/main/groovy/org/web3j/solidity/gradle/plugin/SolidityCompile.groovy#L238

Getter/setter needs to match field name. They're missing the "s".

xaviarias commented 3 years ago

Yes they should be by convention, but is it giving you an error?

yanncks commented 3 years ago

Yes, it gives me the error that I posted above. I think it's not just convention, but gradle looks for getter/setter by name like this.

xaviarias commented 3 years ago

@larpras I just built the project locally on master branch and it works.

Please can you paste your build command and the complete output? Thanks.

yanncks commented 3 years ago

It's just ./gradlew build with pretty much the default starter project. Maybe the only thing I did was upgrade Gradle to 7.0.

Longer form of the error:

Some problems were found with the configuration of task ':compileSolidity' (type 'SolidityCompile').

  • Type 'SolidityCompile' field 'pathRemappings' without corresponding getter has been annotated with @Input, @Optional.

    Reason: Annotations on fields are only used if there's a corresponding getter for the field.

    Possible solutions:

    1. Add a getter for field 'pathRemappings'.
    2. Remove the annotations on 'pathRemappings'.

    Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.

xaviarias commented 3 years ago

Could you try with the project version of Gradle? Is possible that the new one enforces this naming.

eliquinox commented 3 years ago

Same problem as @larpras when trying to build with gradle 7.0. Here is the PR: https://github.com/web3j/solidity-gradle-plugin/pull/37

xaviarias commented 3 years ago

Fixed in release 0.3.2.