4

I use the web3j maven plugin to auto generate the Smart Contract Java Proxies.

But I have the problem, that the solidity compiler version couldn't be found.

[INFO]
[INFO] --- web3j-maven-plugin:4.8.2:generate-sources (default) @ web3j-client-lib ---
[INFO] Solidity: adding to process 'DZPayments.sol'
[INFO] Solidity: adding to process 'Migrations.sol'
[INFO] Solidity: adding to process 'Proxy.sol'
[INFO] Solidity: adding to process 'Storage.sol'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  26.928 s
[INFO] Finished at: 2021-06-18T10:50:37+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to get solidity version from server

Has anyone an idea?

I'm using only default config and have copied the SOL Files to src/main/resources

This is my plugin config (easiest possible!):

    <plugin>
        <groupId>org.web3j</groupId>
        <artifactId>web3j-maven-plugin</artifactId>
        <version>4.8.2</version>
        <configuration>
            <soliditySourceFiles/>
        </configuration>
    </plugin>

I used the following two dependencies with version 4.8.4 but I tested it with 5.0.0 too with the same result:

<dependency>
    <groupId>org.web3j</groupId>
    <artifactId>abi</artifactId>
    <version>4.8.4</version>
</dependency>
<dependency>
    <groupId>org.web3j</groupId>
    <artifactId>core</artifactId>
    <version>4.8.4</version>
</dependency>
  • btw do you know if its possible for the web3j-maven-plugin plugin to simply reference abi files (that were already generated by a separate truffle project) and simply create the Java proxies from those ? or do I have to tell webj3 to compile everything all over again ? – 1977 Oct 12 '21 at 14:10

1 Answers1

2

We had the same problem. We solved it by manually performing some steps of the maven plugin:

  1. Go to the solidity versions list posted here: https://internal.services.web3labs.com/api/solidity/versions/.
  2. Save the displayed json as releases.json in ~/.web3j/solc/.
  3. Manually search the list of binaries download the one you need (i.e. win/linux/mac).
  4. Save the selected binary in a subfolder using the version as its name. For example, if you need version 0.4.25 create a corresponding folder (~/.web3j/solc/0.4.25/) and put the binaries there.
  5. Rerun your maven build.

Somehow, the problem is that the maven plugin is not able to download the corresponding files. After doing that manually, the plugin finds the binaries and skips downloading them.

Lukas
  • 158
  • 1
  • 10