Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ERROR] Failed to get solidity version from server #2062

Open
creazyCode opened this issue Jun 8, 2024 · 3 comments
Open

[ERROR] Failed to get solidity version from server #2062

creazyCode opened this issue Jun 8, 2024 · 3 comments
Labels
needs-review issue/PR needs review from maintainer

Comments

@creazyCode
Copy link

creazyCode commented Jun 8, 2024

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

web3j

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>
@creazyCode creazyCode added the needs-review issue/PR needs review from maintainer label Jun 8, 2024
@creazyCode creazyCode closed this as not planned Won't fix, can't repro, duplicate, stale Jun 8, 2024
@creazyCode creazyCode reopened this Jun 8, 2024
@Julius278
Copy link
Contributor

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

@Julius278
Copy link
Contributor

@creazyCode
additionally you could enhance your pom by generating the Java wrapper on every mvn build like @fcorneli did it here:
hyperledger-web3j/web3j-maven-plugin#14 (comment)

afterwards you can adjust your solidity contracts as you wish and build your application without regenerating the wrapper classes alone

@alok2424
Copy link

@creazyCode Try this: Reduce the solidity version from 0.8.20 to 0.8.16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-review issue/PR needs review from maintainer
Projects
None yet
Development

No branches or pull requests

3 participants