Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Idea: how to expose classes, interfaces, annotations in developed plugins

Tags:

I have created a plugin for IntelliJ Idea. In the plugin I have defined an annotation I want to use in my projects, but it doesn't seem to be accessible. How should I specify in the plugin.xml file the packages I want to expose?

like image 572
lowcoupling Avatar asked May 04 '15 08:05

lowcoupling


People also ask

How do I see annotations in IntelliJ?

Enable annotationsRight-click the gutter in the editor or in the Differences Viewer and select Annotate with Git Blame from the context menu. You can assign a custom shortcut to the Annotate command: go to the Keymap page of the IDE settings Ctrl+Alt+S and look for Version Control Systems | Git | Annotate.

What is org Jetbrains annotations NotNull?

The @NotNull annotation is, actually, an explicit contract declaring that: A method should not return null. Variables (fields, local variables, and parameters) cannot hold a null value.

Where are plugins stored in IntelliJ?

If you installed IntelliJ IDEA via the Toolbox App, the plugins directory will be located in the installation directory. To find the installation directory, open the settings of the IDE instance in the Toolbox App, expand Configuration and look for the Install location field.


1 Answers

When you install a plugin, it will be on a certain place - e.g. C:\Users\xxx\.IdeaIC14\config\plugins\...

Now that you know where your jar file is, you can add it as a dependency to your project. If you use Maven, you can add something like this to your pom:

<dependency>
    <groupId>yourplugin</groupId>
    <artifactId>yourplugin</artifactId>
    <version>1</version>
    <systemPath>C:\Users\xxx\.IdeaIC14\config\plugins\yourplugin.jar</systemPath>
    <scope>system</scope>
</dependency>

Or you can install the jar into your local repository and then use it as normal maven dependency.

If not, then add the dependency directly in the project settings as it was any other jar.

plugin.xml has nothing to do with any of this, this is all about jars and classpath. What you could do in your plugin is some user friendly inspections and actions, which would add the dependency for you.

like image 107
Meo Avatar answered Sep 23 '22 13:09

Meo