Git Product home page Git Product logo

Comments (11)

doumuxie avatar doumuxie commented on July 19, 2024 3

如果sol版本编译超过0.7.1,就会出现上述问题,原因是因为 web3j会先从本地 C:\Users<User>.web3j\solc\release.json 获取最新的windows可用url,在 maven web3j 4.9.4 版本中,引入了子依赖 web3j-sokt 0.2.1, 在源代码 https://github.com/web3j/web3j-sokt/blob/release/0.2.1/src/main/kotlin/org/web3j/sokt/VersionResolver.kt 中可用看到 从 https://internal.services.web3labs.com/api/solidity/versions/ 下载了 release.json 文件,但是文件中从 0.7.1 之后windows_url一直为 “”, 所以无法找到合适的编译版本solc。
image

在 web3j-sokt 0.2.2 中 https://github.com/web3j/web3j-sokt/blob/release/0.2.2/src/main/kotlin/org/web3j/sokt/VersionResolver.kt ,release.json 的下载地址变更为 https://raw.githubusercontent.com/web3j/web3j-sokt/master/src/main/resources/releases.json ,截至目前文件内的最新可用版本为 solidity 0.8.13

所以我认为解决方案应该是 maven 排除 web3j-sokt 0.2.1, 引入新的 web3j-sokt 0.2.2.

from web3j-maven-plugin.

N4YC avatar N4YC commented on July 19, 2024 2

You just have to mention in your solidity contract this line pragma solidity >=0.7.0 <0.9.0;.
This issue can be explained by the solidity version choose for your OS. It works fine on Windows for the 0.7.1 of solidity.
You can't use a recent version because of the solc-windows.zip instead of solc-windows.exe which changes the way it works.

from web3j-maven-plugin.

zhang988925 avatar zhang988925 commented on July 19, 2024 2
<plugin>
	<groupId>org.web3j</groupId>
	<artifactId>web3j-maven-plugin</artifactId>
	<version>4.9.4</version>
	<dependencies>
		<dependency>
			<groupId>org.web3j</groupId>
			<artifactId>web3j-sokt</artifactId>
			<version>0.2.2</version>
		</dependency>
	</dependencies>
</plugin>

from web3j-maven-plugin.

xaviarias avatar xaviarias commented on July 19, 2024

Hi, could you give more context?

  • OS: Linux, MacOS, Windows?
  • Plugin version
  • Project POM

Thanks

from web3j-maven-plugin.

imdsc avatar imdsc commented on July 19, 2024

@xaviarias
OS: Windows 10 Home 2004(19041.985)
Plugin version: 4.8.2
maven version:Apache Maven 3.8.1


4.0.0

<groupId>org.imdsc</groupId>
<artifactId>blockchain</artifactId>
<version>1.0-SNAPSHOT</version>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <maven.compiler.source>8</maven.compiler.source>
    <maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>

    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>5.0.0</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-mail</artifactId>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>5.0.0</version>
    </dependency>

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>fastjson</artifactId>
        <version>1.2.68</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter -->
    <dependency>
        <groupId>com.baomidou</groupId>
        <artifactId>mybatis-plus-boot-starter</artifactId>
        <version>3.4.0</version>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.web3j</groupId>
        <artifactId>core</artifactId>
        <version>4.8.4</version>
    </dependency>

    <dependency>
        <groupId>com.squareup.okhttp3</groupId>
        <artifactId>okhttp</artifactId>
        <version>4.9.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.jasypt/jasypt -->
    <dependency>
        <groupId>org.jasypt</groupId>
        <artifactId>jasypt</artifactId>
        <version>1.9.3</version>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.web3j</groupId>
            <artifactId>web3j-maven-plugin</artifactId>
            <version>4.8.2</version>
            <configuration>
                <packageName>org.blockchain.contract</packageName>
                <soliditySourceFiles>
                    <directory>src/main/resources</directory>
                    <includes>
                        <include>**/*.sol</include>
                    </includes>
                </soliditySourceFiles>
            </configuration>
        </plugin>
    </plugins>
</build>

from web3j-maven-plugin.

Fredi100 avatar Fredi100 commented on July 19, 2024

I ran into a simillar problem. Go to C:\Users\<User>\.web3j\solc and check the releases.json file. There should be an entry with the desired solidity version. Check if a valid windows_url is provided. For me it wasn't so the plugin was not able to download the needed version as it does not know from where. You can manually download the desired version and place it alongside the other installed versions in C:\Users\<User>\.web3j\solc

from web3j-maven-plugin.

KamilBemowskiGFT avatar KamilBemowskiGFT commented on July 19, 2024

It doesn't work, I'd like to use version 0.8.4 and I downloaded the version from this link: https://github.com/ethereum/solidity/releases/download/v0.8.4/solc-windows.exe and put that file to the directory C:\Users<User>.web3\solc\0.8.4 but still doesn't work with the same result. Do you have any idea?

from web3j-maven-plugin.

it-honghui avatar it-honghui commented on July 19, 2024

I ran into a simillar problem.After version 0.7.1, windows_url lacks the corresponding mapping, how can I solve it?

from web3j-maven-plugin.

novakorr avatar novakorr commented on July 19, 2024

encountering a similar issue, any update on this?

from web3j-maven-plugin.

bububear avatar bububear commented on July 19, 2024
<plugin>
	<groupId>org.web3j</groupId>
	<artifactId>web3j-maven-plugin</artifactId>
	<version>4.9.4</version>
	<dependencies>
		<dependency>
			<groupId>org.web3j</groupId>
			<artifactId>web3j-sokt</artifactId>
			<version>0.2.2</version>
		</dependency>
	</dependencies>
</plugin>

我配置了 web3j-sokt 0.2.2. 但是不生效。请问有遇到这样的情况吗?

from web3j-maven-plugin.

bububear avatar bububear commented on July 19, 2024
<plugin>
	<groupId>org.web3j</groupId>
	<artifactId>web3j-maven-plugin</artifactId>
	<version>4.9.4</version>
	<dependencies>
		<dependency>
			<groupId>org.web3j</groupId>
			<artifactId>web3j-sokt</artifactId>
			<version>0.2.2</version>
		</dependency>
	</dependencies>
</plugin>

我配置了 web3j-sokt 0.2.2. 但是不生效。请问有遇到这样的情况吗?

已解决;
解决方案供参考:

  1. 下载插件源码,解压缩,导入IDEA ,修改 web3j-sokt 依赖版本。
  2. 执行 mvn clean install

最后刷新依赖项目maven仓库,即可。

from web3j-maven-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.