Closed dfsantamaria closed 3 years ago
From console, it works. But it doesn't work from maven. The pom I'm using is available here
I have the same issue with the gradle plugin... It seems the gradle plugin uses web3j version 4.5.11 and I can't seem to override.
For Maven you should be able to override the web3 version by adding a dependency block to the plugin block.
Nope. I've tried to ovverride the dependency with no success.
This should work
<plugin>
<groupId>org.web3j</groupId>
<artifactId>web3j-maven-plugin</artifactId>
<version>${web3j-maven-plugin.version}</version>
<configuration>
<soliditySourceFiles>
<directory>src/main/solidity</directory>
<includes>
<include>*.sol</include>
</includes>
</soliditySourceFiles>
</configuration>
<dependencies>
<dependency>
<groupId>org.web3j</groupId>
<artifactId>core</artifactId>
<version>4.5.16</version>
</dependency>
<dependency>
<groupId>org.web3j</groupId>
<artifactId>codegen</artifactId>
<version>4.5.16</version>
</dependency>
</dependencies>
</plugin>
This is also an issue with web3j 4.6.3, web3j-gradle-plugin 4.5.11 and solc 0.7.1. There was a workaround posted in this issue. Adding this to the buildscript of the build.gradle fixes it:
classpath ("org.web3j:codegen:4.6.3") {
force = true
}
This is no longer relevant. After testing the contract with the latest web3j version the hello function returns a string.
I'm using Web3j 4.5.16, Solc 0.6.4, and web3j-maven-plugin 4.5.11 on a netbeans project. Consider the example below:
pragma solidity ^0.6.4; contract test { string private amsg; constructor(string memory message) public { amsg=message; } function hello() public view returns(string memory _m) { return amsg; } }
In java wrapper class "hello" returns a TransactionReceipt object, and this happens with any view function, even if, from https://github.com/web3j/web3j/issues/1161 the issue seems solved.The second point is: why binary data in field Binary is different from the one generated by solc.?