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 does maven import jar packages to the local warehouse

2025-01-18 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 import maven jar package to the local warehouse". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to import the jar package to the local warehouse by maven.

Scene

In many cases, the jar package is downloaded remotely through maven, but the download fails or is very slow due to network speed or warehouse address problems. Another situation is that some of the three-party jar packages we use are not available in the central warehouse, such as some open source compiled jar packages.

In scenarios like this, we often have the need to install the jar package obtained by other means to the local maven repository, and then specify it in pom.xml and then use it directly.

Download commonly used jar packages

1. Copy from other projects, the projects we usually write or download others may have some commonly used jar packages, look at these places first.

two。 Some commonly used website downloads, such as:

Http://mvnrepository.com/

Http://search.maven.org/

For example, the first website, find the jar package you want to download, it will also give you a list of groupID,version and other information, easy to configure in pom.xml.

-

View the location of the local warehouse

My maven warehouse location is d:\ mavenfiles\ repo directory. After maven installation, the default warehouse location is under the .m2 directory under the C disk user directory. I changed it to D disk. As for how to modify it, I will not repeat it here. Also pay attention to the configuration of maven in IDE such as Myeclipse.

Install to local warehouse

For example, I saved the downloaded jar package in the local C:\ temp directory, where I opened the command line to install it.

C:\ temp > mvn install:install-file-Dfile=log4j-1.2.16.jar-DgroupId=log4j-DartifactId=log4j-Dversion=1.2.16-Dpackaging=jar [INFO] Scanning for projects... [INFO] [INFO]-[ INFO] Building Maven Stub Project (No POM) 1 [INFO]-[INFO] [INFO]-maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom -[INFO] Installing C:\ temp\ log4j-1.2.16.jar to D:\ mavenfiles\ repo\ log4j\ log4j\ 1.2.16\ log4j-1.2.16.jar [INFO] Installing C:\ Users\ pony\ AppData\ Local\ Temp\ mvninstall4758534529322880483.pom to D:\ mavenfiles\ repo\ log4j\ log4j\ 1.2.16\ log4j-1.2.16.pom [INFO]- -[INFO] BUILD SUCCESS

At this point, I believe you have a deeper understanding of "how to import maven jar package to the local warehouse". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow 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