In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
How to use Maven reference custom jar package way, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can learn, I hope you can gain something.
Maven references custom jar packages Overview
A third-party jar package is used in the project that is not available in the Maven central repository. How can Maven rely on it?
If the introduction is not good, the project will report:
java.lang.ClassNotFoundException exception
Import jar
Create a new lib directory under the src directory of the project, and then drag the jar package into this directory
Introducing dependencies in pom org.bouncycastle bcprov-jdk15on-154 1.0 system ${pom.basedir}/lib/bcprov-jdk15on-154.jar
Version is custom.
groupId is written according to the package hierarchy of jar package species
artifactId The name of the jar package I used directly
Add maven-dependency-plugin org.apache.maven.plugins maven-dependency-plugin 2.10 copy-dependencies compile copy-dependencies ${project.build.directory}/${project.build.finalName}/WEB-INF/lib system
After packaging, in the jar package, go to the/WEB-INF/lib directory, you can see that bcprov-jdk15on-154.jar has been typed.
environment briefing
Apache Maven 3.3.9
Java version: 1.7.0_80
OS name: "mac os x", version: "10.13.3"
Custom jar packages published to your own maven local repository
Using maven to build a project requires introducing custom packages into the project, and introducing the corresponding coordinates in the pom.xml of the project like maven. At this time, we have to upload the packages to the local repository ourselves. Here is how to operate:
① The jar package I want to upload is: ipdatabase-1.0.jar
② Find locally installed maven
Enter cmd into the bin directory at the location of the command line and enter the following command, hit Enter to start execution:
mvn install:install-file -Dfile=C:\Users\zhangsf\Desktop\ipdatabase.jar -DgroupId=zhang.jar -DartifactId=ipdatabase -Dversion=1.0 -Dpackaging=jar
of successes
One thing to note is that you need to place a setting.xml under the user's.m2 directory, otherwise you will package the jar package into the local default repository.
3 References in the project zhang.jar ipdatabase 1.0 Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.