Comments (9)
In fact it seems to have code to generate the ABI element, but I am not able to see any abi.json files generated in my target folder.
any idea?
from web3j-maven-plugin.
I have added in my configuration the abi parameter, but no file has been generated...
does i miss something
<groupId>org.web3j</groupId>
<artifactId>web3j-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate-sources</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<packageName>com.cea.digitalworld.dwsmartcontracts</packageName>
<sourceDestination>${project.basedir}/target/main/java</sourceDestination>
<soliditySourceFiles>
<directory>${project.basedir}/src/main/resources/solidity/</directory>
<includes>
<include>**/*.sol</include>
</includes>
</soliditySourceFiles>
<abi>true</abi>
</configuration>
</execution>
</executions>
</plugin>
from web3j-maven-plugin.
I have got the code, and replace abi default value to true, it does not generate the abi coresponding json files.
Any idea?
from web3j-maven-plugin.
Ok, I have found at least one problem in the code.
in
Files.write(Paths.get(sourceDestination, packageName, contractName + ".json"), abiJson.getBytes());
will result in error due to the fact that the packageName directory has not been previously created.
ERROR] Could not build abi file for contract 'BCThing'
java.nio.file.NoSuchFileException: /volatile/home/fl218080/gits/fildariane/digitalworld/dwethereum/dwsmartcontracts/target/main/java/com.cea.digitalworld.dwsmartcontracts/BCThing.json
at sun.nio.fs.UnixException.translateToIOException (UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel (UnixFileSystemProvider.java:214)
at java.nio.file.spi.FileSystemProvider.newOutputStream (FileSystemProvider.java:434)
at java.nio.file.Files.newOutputStream (Files.java:216)
at java.nio.file.Files.write (Files.java:3292)
at org.web3j.mavenplugin.JavaClassGeneratorMojo.generatedAbi (JavaClassGeneratorMojo.java:169)
at org.web3j.mavenplugin.JavaClassGeneratorMojo.processResult (JavaClassGeneratorMojo.java:211)
at org.web3j.mavenplugin.JavaClassGeneratorMojo.processContractFile (JavaClassGeneratorMojo.java:159)
at org.web3j.mavenplugin.JavaClassGeneratorMojo.execute (JavaClassGeneratorMojo.java:76)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[INFO] Built Class for contract 'BCThing'
so we can update the code with
Files.write(Paths.get(sourceDestination, packageName.replace(".", "/"), contractName + ".json"), abiJson.getBytes());
so the json abi files will be located at the same place as the java source files
But I am not sure it is the right place. Because if we follow this pattern for the "binary" option generation, the solidity binaries will be located at the same place as the java source files.
moreover I think it is pertinent also to add the ABI generated files directly in the maven jar provided.
so i would like to propose to create a abi resource folder to put them
from web3j-maven-plugin.
Apologizes for my absence. Holiday, "Money"work, I will check the issue and PullRequest tomorrow. But thank you already for your work!
from web3j-maven-plugin.
from web3j-maven-plugin.
With the newest version (0.3.5) it should be possible to generate abi or bin files. see the readme file
<outputFormat>java,bin</outputFormat>
from web3j-maven-plugin.
from web3j-maven-plugin.
I close since the new version is able to generate the ABI files. An upgrade could be possible to put it a separate configurable folder.
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
- Please add a configuration option for SolidityFunctionWrapperGenerator :: .B, --generateBoth generate both call and send functions.
- 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.