[ERROR] Failed to get solidity version from server
An error occurred when generating the solidity corresponding java wrapper class through web3j-maven-plugin: [ERROR] Failed to get solidity version from server
running cmd : mvn web3j:generate-sources
Contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract MyContract {
uint256 public value;
function setValue(uint256 newValue) public {
value = newValue;
}
function getValue() public view returns (uint256) {
return value;
}
}
Pom.xml
<plugin>
<groupId>org.web3j</groupId>
<artifactId>web3j-maven-plugin</artifactId>
<version>4.8.7</version>
<configuration>
<packageName>org.example.com</packageName>
<sourceDestination>src/main/java/generated</sourceDestination>
<nativeJavaType>true</nativeJavaType>
<outputFormat>java,bin</outputFormat>
<soliditySourceFiles>
<directory>src/main/resources</directory>
<includes>
<include>**/*.sol</include>
</includes>
</soliditySourceFiles>
<outputDirectory>
<java>src/java/generated</java>
<bin>src/bin/generated</bin>
<abi>src/abi/generated</abi>
</outputDirectory>
</configuration>
</plugin>
could you provide your whole pom? Maybe you're missing something
Also, yould you try to use a newer version of web3j core? I just tried 4.10.3 and it worked fine
Besides that I would adjust the java output directory to match a valid package, at least add in the "main" /src/main/java/generated
@creazyCode additionally you could enhance your pom by generating the Java wrapper on every mvn build like @fcorneli did it here: https://github.com/hyperledger/web3j-maven-plugin/issues/14#issuecomment-368566575
afterwards you can adjust your solidity contracts as you wish and build your application without regenerating the wrapper classes alone
@creazyCode Try this: Reduce the solidity version from 0.8.20 to 0.8.16