IDEA packages part of the class files into jars to use small notes

IDEA packages part of the class files into jars to use small notes


Dingdu! Here is the compilation of Xiao Ah Woo's study course materials. A good memory is not as good as a bad pen. Today is also a day to make progress. Let's advance together!
Insert picture description here

I. Introduction

 有时候有太多模块堆放一块比较混乱,
 将某个功能所需要的模块打包成jar使用起来会方便点。

2. IDEA packages some class files into jars

The steps are as follows:

File-> Project Structure

Insert picture description here

Artifacts-> + ->  JAR  ->  Empty

Insert picture description here

关于Name,根据自己情况自行设定。

Choose Empty, and then name the jar you typed

Insert picture description here

Then IS10-4right-click on it to create a directory as shown in the figure.

Insert picture description here

Then create a module on the com module

Insert picture description here

Then create...The
final structure diagram is as follows: 【Created according to your actual situation, here is only for demonstration.

Insert picture description here

The next step is to add the main, ui, and util packages 添加对应的class文件.

Insert picture description here

Click the + sign to select file, and select the class file in the corresponding module after your project is compiled, usually out模块below.

Insert picture description here

After adding the corresponding class file, click apply, ok. Perform the last step to package the jar.

Insert picture description here

Choose to recompile the module you just created, and the last generated jar is in the one you selected when you created the jar output directory地址.

Insert picture description here
The previous output address:

Insert picture description here

Finally, directly use the generated jar as a third-party jar into the project.

Insert picture description here

Ending!
More course knowledge learning records will come later!

就酱,嘎啦!

Insert picture description here

Note:
Life is diligent, nothing is gained.

Guess you like

Origin blog.csdn.net/qq_43543789/article/details/109144206