Adding third-party jars for IntelliJ Plugin development (6)

There is not much content in this section, but I feel more independent, so let's talk about it alone.

What should I do if I need to use third-party libraries such as Gson and OKHttp when developing IntelliJ Plugin?

Before answering this question, let me add what has not been mentioned before.

There are actually two ways to develop plug-ins, the official document: http://www.jetbrains.org/intellij/sdk/docs/tutorials/build_system.html

1、Using Gradle

2、Using DevKit

This series of articles talks about the DevKit way of plug-in development.

So, if you are using Gradle, you can use maven dependency to associate third-party libraries.

If you use the DevKit method, you can directly download the .jar file of the third-party library and add it to the project.

The specific steps are very simple, the same as the Android development process.

Create the lib directory in the project root directory (it should be fine to create the libs directory, but I haven't tried it yet), and copy the .jar file of the third-party library to this directory:

Then, right-click on the jar and select the Add as Library option to add it to the project build environment:

OK, over. You can use these jar libraries freely.

In addition, if you import a third-party jar library, there are differences in the deployment and packaging of the plug-in project:

If the plug-in project does not reference any third-party jar library, execute the menu bar Build --> Prepare Plugin Module "XXX" For Development, the plug-in package generated in the project root directory is a package ending in .jar;

If the plug-in project introduces a third-party .jar library, the plug-in package generated by programming is a package ending in .zip.

As shown in the figure:

 

But don't worry, there is no difference between the two in terms of installation and use.

 

 

 

Guess you like

Origin blog.csdn.net/fesdgasdgasdg/article/details/86030251