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

How to add a jar package from a non-maven library to spring boot

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "how to add jar packages in non-maven library" in spring boot. Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "how to add jar packages in non-maven libraries in spring boot"!

Daily development uses oracle jar package, but not in maven central library; manual package introduction is required, but this does not take advantage of future development management of the project;

One way to do this is to package jar locally with the maven install command.

mvn install:install-file -DgroupId=com.zaxxer -DartifactId=HikariCP -Dversion=2.4.7 -Dpackaging=jar -Dfile=C:/Users/yangqc/Downloads/HikariCP-2.4.7.jar

Another way is to configure the maven packaging mechanism, introducing maven into the jar in the project, and introducing packaging resources when packaging; this is a complete solution to the problem;

project directory

The directory is src/main/lib, which can be adjusted according to personal habits

introducing dependency

com.oracle ojdbc7 12.1.0.2 system ${basedir}/src/main/lib/ojdbc7-12.1.0.2.jar

The scope and systemPath here cannot be less.

pom rewriting

org.apache.maven.plugins ---3.1 maven-compiler-plugin org.springframework.boot ----maven compiler for spring boot spring-boot-maven-plugin src/main/webapp src/main/resources src/main/java **/*.xml ----3.2 Add jar package directory and packaging target directory to resource src/main/lib BOOT-INF/lib/ **/*.jar

3.1 Add maven's default compiler to the compiler;

3.2 Add the jar package directory and package target directory to the resource; include resources elsewhere as well, as this is an override of the default resource attribute

At this point, I believe that everyone has a deeper understanding of "how to add jar packages in non-maven libraries" to spring boot, so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue 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

Internet Technology

Wechat

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

12
Report