Comments (11)
如果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。
在 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.
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.
<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.
Hi, could you give more context?
- OS: Linux, MacOS, Windows?
- Plugin version
- Project POM
Thanks
from web3j-maven-plugin.
@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.
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.
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.
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.
encountering a similar issue, any update on this?
from web3j-maven-plugin.
<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.
<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. 但是不生效。请问有遇到这样的情况吗?
已解决;
解决方案供参考:
- 下载插件源码,解压缩,导入IDEA ,修改 web3j-sokt 依赖版本。
- 执行 mvn clean install
最后刷新依赖项目maven仓库,即可。
from web3j-maven-plugin.
Related Issues (20)
- Problem integrating web3j into maven clean install HOT 1
- Generate meta-data files as well (optional as with bin, abi)
- Why does this plugin keep using solc version 0.4.25?
- Path for ABI & BIN is wrong HOT 1
- Two-dimensional array problem???
- Execution default-cli of goal org.web3j:web3j-maven-plugin:4.10.0:generate-sources failed: ClassLoader.getSystemResource("releases.json") must not be null
- java.net.UnknownHostException: github.com when being offline
- Define solc version
- Error when running "mvn web3j:generate-sources"
- ClassLoader.getSystemResource("releases.json") must not be null HOT 1
- Contract.deploy creates type 0 transactions (not EIP-1559)
- Issues generating proxies from external Truffle proj HOT 1
- Can't generateContractWrappers for solidity 0.8.x due result json change format HOT 6
- Generation of code fails when using solidity 0.8.0 HOT 1
- Build Error HOT 4
- add support through solc 0.8.12
- org.json.simple.JSONArray cannot be cast to java.lang.String HOT 1
- web3j plugin solidity source file compile failed with assign solidity version over 0.7.1 HOT 1
- release web3j-maven-plugin for web3j 5.0.0
- Execution generate-sources-web3j of goal org.web3j:web3j-maven-plugin:4.9.4:generate-sources failed: part 'struct OfferItem' is keyword
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web3j-maven-plugin.