Skip to content

Integrate avm archetype with Intellij IDEA to generate Avm project

Satya edited this page May 11, 2019 · 10 revisions

Instead of manually creating new maven based Avm project through "mvn archetype:generate .." command, you can configure the archtype in the Intellij. By doing so, you can generate same maven base Avm project using IDEA's New -> Project option.

1. Configure avm-archetype in Intellij (Only need during first project creation)

  • Select File -> New -> Project
  • Select "Maven" in the left panel
  • Select "Create from archetype" and click "Add Archetype.." button
  • Enter the following information in the input box
Group Id: org.aion4j
Artifact Id: avm-archetype
Version: 0.6

Note: For latest version of avm archetype, please refer to Avm Archetype project.

  • Now you should see avm-archetype in the list of available archetype. You can have multiple versions of same archetype.

2. Create new Avm Project

  • Select File -> New -> Project
  • Select "Maven" in the left panel
  • Select "Create from archetype"
  • Select "org.aion4j:avm-archetype" and expand it
  • Select the archetype version, click "Next"
  • In next screen, enter Group Id, Artifact Id and Version for your project

Example:

Group Id: org.test
Artifact Id: MyFirstContract
Version: 1.0-SNAPSHOT
  • Click "Next" to generate the project
  • Verify the information, then click Next and then "Finish" to generate the project.

Voilà, your maven Avm smart contract project is created.

Note: If you see a prompt to "Maven Project needs to be imported" at the right bottom side of the editor, choose "Enable Auto-Import"

3. Open an existing maven based Avm project

  • To open an existing Avm project, select File -> Open and choose project folder
  • Intellij has in-built support for maven. So it automatically detects any maven based project

4. Opening Avm project using Intellij command launcher

  • You can also install Intellij's command line launcher to open the project in Intellij from command line
  • To install intellij's command line launcher from IDE, select "Tools -> Create Command-line Launcher ..."
  • Then you can run the following command inside any project folder to open the project in the editor
$> idea .

5. Run maven command inside Intellij IDE

  • You can select "Terminal" tab in the bottom panel. It shows the command prompt. You can execute any maven command from the terminal window inside the IDE
  • Alternatively, you can explore the "Maven" tab at the right side panel of the IDE.