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 introduce third-party sdk jar package into SpringBoot project

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

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to introduce third-party sdk jar packages into SpringBoot projects". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Scene

Docking with third-party interfaces, they have their own encapsulated SDK jar packages, but there is no unified maven repository. Our own project needs to integrate this offline jar package?

Solution

1. Jar is uploaded to the local maven repository, and then a third-party jar package is introduced through pom dependency. Personally, I think this is an ideal solution.

2. The second scheme is to put the third-party sdk jar package into the project. We are micro-service applications into the jar package, there are similar can be used as a reference.

Specific practices:

2.1 referencing the local jar package, mine is to put the jar package under / resources/lib/, and then configure systemPath in the pom dependency, and the scope is configured as system

Com.byai open-sdk-java system 1.1.12 ${project.basedir} / src/main/resources/lib/open-sdk-java-1.1.12.jar

2.2 build includeSystemScope plug-in

Org.springframework.boot spring-boot-maven-plugin true summary

The default value for scope in maven is compile

Classification of scope

Compile defaults to compile. Compile said that the dependent project needs to participate in the compilation of the current project, including subsequent tests, and the run cycle is also involved, which is a strong dependency. It usually needs to be included when packing.

Test indicates that dependent projects are only involved in testing-related work, including the compilation and execution of test code, typically such as junit.

Runtime says that the dependent project does not need to be involved in the compilation of the project, but it is required for later testing and run cycles. The oracle jdbc driver jar package is a good example, and the general scope is runtime. In addition, the dependency of runtime is usually used with optional, and optional is true, which can be implemented in either An or B.

Procided means that you don't have to pack it when you pack it, and other facilities (web container) will provide it. In fact, the dependency can theoretically participate in compilation, testing, running, and so on. It is equivalent to compile, but the packaging phase does the action of exclude.

System is the same as provide, but the dependent items will not be grabbed from the maven repository, but from the local system files. Be sure to cooperate.

SystemPath uses when maven relies on local jar packages instead of jar packages in repository, sytemPath indicates the path of local jar packages

Java SDK

SDK is an acronym for Software Development Kit, translated as a software development kit. This is a very broad term, so to speak: a collection of documents, examples, and tools that assist in the development of a certain type of software can be called SDK.

In fact, in the direction of standardization, providing SDK is a better solution to reduce the cost of docking. It is also a standardized process. In common interface specifications, you can consider connecting through the standard SDK way. For example, Aliyun and Wechat provide many standard SDK interfaces.

This is the end of the introduction of "how to introduce a third-party sdk jar package to the SpringBoot project". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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