Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the plug-ins commonly used in maven

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the plug-ins commonly used in maven, which have a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to know about it.

Background

The three plug-ins commonly used by maven have different effects on packaging:

Maven-jar-plugin: handling jar package generation

Spring-boot-maven-plugin:SpringBoot project packaging

Maven-assembly-plugin: customize the packaging structure.

In the actual development process, these three plug-ins may be used together, this article class describes the mixed use of these plug-ins need to pay attention to.

Exclude files when SpringBoot is packaged

When a SpringBoot project is packaged, it usually extracts configuration files and static resource files to the specified directory, and then specifies additional configuration files through-- spring.config.additional-location=file:xxx.

In this way, configuration files and static resource files need to be excluded when SpringBoot is packaged, which can be excluded with the maven-ja-pluginr plug-in:

Org.apache.maven.plugins maven-jar-plugin 3.2.0 * .yml static/** lib/**

Note: if you exclude folders, you need the last two stars.

Spring packages local dependence on jar

If the project needs to rely on a jar package in a local directory and it is not released in the repository, you can add dependencies as follows:

XXXX XXX 1.0.0 system ${project.basedir} / src/main/resources/lib/xxx.jar

It is worth noting that if the project uses the SpringBoot packaging plug-in, the jar of system scope will not be entered into the lib directory by default. You need to add includeSystemScope configuration to add third-party jar packages to lib:

Org.springframework.boot spring-boot-maven-plugin true excludes specified files when compiling

The resources configuration of pom.xml can filter resource files. Common configurations are as follows:

Src/main/resources true static/** * .yml

This method will directly affect the process of processing resource files at compile time, that is, the specified files are not included in the classes directory under the target directory, resulting in a lack of configuration files at local runtime, so this method is not recommended during development.

The principle of copy and paste

Think of a classic saying I saw before:

One of the best lessons I've learned from the Internet is never to copy and paste code that is not written by you. If you have to copy it, type it word for word and force yourself to think about what the code actually means.

In addition to the code that needs to be copied and pasted, it is inevitable to use old documents as templates when writing documents.

In the process of writing word documents, if the content is copied and pasted, my experience is that several checks must be done after completion:

Title: check whether the title and system name in the document are corrected to the content of the target document. Catalog correction: after the document page number changes, the catalog must be regenerated to correspond to it. Revised content proofreading: modified content needs to be proofread at least three times.

Thank you for reading this article carefully. I hope the article "what plug-ins are commonly used in maven" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report