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.
Open IntelliJ and click Open or Import. If you have previously opened a project you may need to selectfrom the menu.
Navigate to the folder containing the new plugin that you created in the previous step (
my-plugins-directory/title-prefix-plugin) and select the
If you are prompted select that you wish to import the project as a
If you are prompted to select an
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.|
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:
Open the preferences window by selectingfrom the menu.
mavenin the menu and click on the
Tick the boxes for
Automatically download:Sources, Documentation and Annotations.
Click Apply, then click OK.
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 files of interest:
PluginUtils: This class defines helpful methods that are specific to writing your plugin.
TitlePrefixPluginSearchLifeCyclePlugin: This contains the code that implements the functionality of the plugin. In this example there is only a single
TitlePrefixPluginSearchLifeCyclePluginfile included in this folder as we only generated
searchLifeCyclewhen generating the plugin. A file is created here for each interface template that was selected when the plugin was generated from the Maven archetype.
TitlePrefixPluginSearchLifeCyclePluginTest: 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.
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.
README.md: This file includes documentation for the plugin and must be included for every plugin.
The next tutorial covers the implementation of the plugin functionality.