Skip to content
Aion4j Maven Plugin for AVM based smart contract on Aion
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.mvn/wrapper maven wrapper Dec 14, 2018
src Avoid running specific commands multiple times in multi module projec… May 13, 2019
.gitignore maven wrapper Dec 14, 2018
LICENSE Create LICENSE Dec 20, 2018
README.md Update README.md May 15, 2019
mvnw mvnw added Dec 14, 2018
mvnw.cmd mvnw added Dec 14, 2018
pom.xml [maven-release-plugin] prepare for next development iteration May 21, 2019
release_ver Update release_ver Apr 5, 2019

README.md

Current release version: 0.6.4

Aion4j maven plugin provides build and deployment support for AVM based smart contracts.

Following maven goals has been implemented in this plugin :

  1. aion4j:clean - Default phase for this goal is "clean". To clean storage folder in case of embedded AVM deployment.
  2. aion4j:deploy - Deploy the contract / dapp jar to an embedded AVM. This goal needs to invoked explicitely from the command line.
  3. aion4j:call - Call contract method
  4. aion4j:contract-txn
  5. aion4j:init - Default phase for this goal is "initialize". It initializes the project with required AVM dependencies. Currently it copies all required avm jars to a lib folder under project's folder. You can also manually create this lib folder or point to an existing avm lib folder through the plugin's configuration parameter.
  6. aion4j:prepack - Default phase "prepare-package". Copy org-aion-avm-userlib.jar's classes to target folder for packaging with dapp's jar.
  7. aion4j:class-verifier - To verify JCL whiltelist classes in the contract
  8. aion4j:deploy - Extend the deploy goal for remote deployment.
  9. aion4j:postpack - Post process the jar after build. Example: Abi Compile to process @Callable annotation. Default phase "package"

For all the supported goals, check this page.

Quick Start Guide

User Guide

Requirement

Java 10

Build

$> git clone https://github.com/bloxbean/aion4j-maven-plugin.git
  1. Install avm.jar to local .m2 repo for compilation
$> ./mvnw initialize
  1. Compile the plugin
$> ./mvnw clean install
  1. Run integration tests
$>  ./mvnw integration-test -DskipITs=false

How to configure this plugin in a dapp maven project

  1. Define avm lib directory property in "<properties>" section of pom.xml
  <properties>
       ...
       <aion4j.plugin.version>x.x.x</aion4j.plugin.version>
       <avm.lib.dir>${project.basedir}/lib</avm.lib.dir>
  </properties>
  1. Add aion4j plugin to "<plugins>" section of pom.xml
<plugin>
      <groupId>org.aion4j</groupId>
      <artifactId>aion4j-maven-plugin</artifactId>
      <version>${aion4j.plugin.version}</version>
      <configuration>
         <mode>local</mode>
         <avmLibDir>${avm.lib.dir}</avmLibDir>
         <localDefaultAddress>0xa092de3423a1e77f4c5f8500564e3601759143b7c0e652a7012d35eb67b283ca</localDefaultAddress>  
      </configuration>
      <executions>
          <execution>
           <goals>
             <goal>clean</goal>
             <goal>init</goal>
             <goal>class-verifier</goal>
             <goal>prepack</goal>
             <goal>postpack</goal>
           </goals>
          </execution>
      </executions>
 </plugin>

"mode" can be local or remote.

  1. Add avm compile time dependencies to "<dependencies>" section.
<dependency>
      <groupId>org.aion</groupId>
      <artifactId>avm-api</artifactId>
      <version>0.0.0</version>
      <scope>system</scope>
      <systemPath>${avm.lib.dir}/org-aion-avm-api.jar</systemPath>
    </dependency>
    <dependency>
      <groupId>org.aion</groupId>
      <artifactId>avm-userlib</artifactId>
      <version>0.0.0</version>
      <scope>system</scope>
      <systemPath>${avm.lib.dir}/org-aion-avm-userlib.jar</systemPath>
</dependency>

Note: The above jars will be copies to "avm.lib.dir" using maven initialize (or through aion4j:init goal) if not there.

How to use in a dapp maven project

  1. Copy required avm dependencies.
$>mvn initialize
  1. Build the project
$>mvn clean package
  1. To deploy to an embedded AVM
$>mvn aion4j:deploy
You can’t perform that action at this time.