Git Product home page Git Product logo

Comments (9)

flefevre avatar flefevre commented on July 19, 2024

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.

flefevre avatar flefevre commented on July 19, 2024

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.

flefevre avatar flefevre commented on July 19, 2024

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.

flefevre avatar flefevre commented on July 19, 2024

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.

h2mch avatar h2mch commented on July 19, 2024

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.

flefevre avatar flefevre commented on July 19, 2024

from web3j-maven-plugin.

h2mch avatar h2mch commented on July 19, 2024

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.

flefevre avatar flefevre commented on July 19, 2024

from web3j-maven-plugin.

flefevre avatar flefevre commented on July 19, 2024

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)

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.