Part 2.2: Importing your plugin into IntelliJ

This guide shows how to import a new plugin that was created using a Maven archetype into IntelliJ.


Before using this guide ensure that you have installed Java, Apache Maven and IntelliJ on your computer as outlined in part 1: setting you your development environment, and have generated a new plugin using a Maven archetype.

Import a new plugin into IntelliJ

  1. Open IntelliJ and click the Open button. If you have previously opened a project you may need to select File  Open…​ from the menu.

  2. Navigate to the folder containing the new plugin that you created in the previous step (my-plugins-directory/title-prefix).

  3. If you are prompted select that you wish to import the project as a maven project.

  4. If you are prompted to select an SDK choose JDK 11. This is the Java version installed in a previous step.

The same process can be used to import an existing plugin project into IntelliJ.

Importing documentation from Maven

The Funnelback interfaces that you will be developing against include documentation. A key advantage of using an IDE such as IntelliJ is that this documentation is available from within the IDE.

Some additional configuration steps are required in order for the documentation to be available from within IntelliJ:

  1. Open the preferences window by selecting File  Settings/Preferences from the menu.

  2. Search for maven in the menu and click on the Importing item.

  3. Tick the boxes for Automatically download: Sources, Documentation and Annotations.

  4. Click Apply, then click OK.

Exploring the imported project

The imported project is now ready to use. Expand the project structure by clicking on the Project tab then expanding out the project tree.

There are five main items of interest:

  1. PluginUtils: This class defines a set of properties required for the plugin and the plugin documentation. This is also where you define things like metadata fields that the plugin generates. The definitions in here are also used when generating the documentation.

  2. Other files inside the src/main/java/<package name> folder: The other files in this folder contain the code that implements the functionality of the plugin. In this example there is only a single TitlePrefixSearchLifeCyclePlugin file included in this folder as we only chose to implement the searchLifeCycle interface when generating the plugin. A file is created here for each interface template that was selected when the plugin was generated from the Maven archetype.

  3. Files inside the src/main/resources/ascii.sections folder: This is where you write the free-form parts of the documentation for your plugin. Each file within this folder corresponds to one of the sections within the generated documentation. The documentation must be written in asciidoc format.

  4. Files inside the test/java/<package name> folder: This contains code that implements unit tests to make sure the plugin is working correctly. A test file will be generated for each interface that was selected when generating the plugin in the same way as for the main plugin code above. Unit testing of plugins are covered in more detail in the testing section of the tutorial. In this example we only see a single file TitlePrefixSearchLifeCyclePluginTest, which is where you will write tests for your plugin.

  5. pom.xml: This file defines a number of parameters that maven uses to package the project. Other libraries required by the plugin will automatically be added to this by IntelliJ.

Next steps

The next tutorial covers the implementation of the plugin functionality.