Maven manually adds the JAR package to the local repository

Maven is indeed a good thing, and it is very convenient to manage projects, but if I use Maven to download JAR packages remotely, the bandwidth of my dormitory is 4 megabytes,
shared by 4 people, and sometimes I use Maven to remotely download JAR packages It will appear very slow. Generally, when I find that the download speed is not obvious, I will Ctrl + C to terminate its download.
Then use manual download instead, because it will be much faster to download with tools like Thunder. I manually download many JAR packages from Maven's local repository on my machine.
Manual download will bring a problem, that is, how to manually add the downloaded JAR package to Maven's local repository. There is a lot of information on the Internet about this.
I will tell you what I do.
First,
recommend several good Maven common repository URLs:
http://mvnrepository.com/
http://search.maven.org/
http://repository.sonatype.org/content/groups/public/
http:// people.apache.org/repo/m2-snapshot-repository/
http://people.apache.org/repo/m2-incubating-repository/

The first is my most used, then the second, then the first Three, the last two are Apache's private repositories. I haven't used them yet, but I think they should be okay...
Next, it's still a consistent style, using screenshots to explain in an easy-to-understand way:

if you've seen me 's previous post:Html of Spring Mail Service: Maven + Spring SMTP Mail With Html  article, which needs to use a
JAR package of spring-context-support-3.1.0.RELEASE.jar, I took a screenshot when I installed it in the local warehouse Come down, by the way, I wrote this article
for the reference of netizens in need.
First, go to  http://mvnrepository.com/  , enter the keyword of the JAR package you want to search in the search bar to search, and paste the map directly below:

@ 1picture


@ 2picture


@ 3picture


with spring-context-support -3.1.0.RELEASE.jar as an example, the groupId, artifactId, version information of the jar package has been given in the @3 figure.
Do not change these information during manual installation, otherwise, if the Maven project is migrated, the jar package will be downloaded. fail. By the way, this information is posted below for easy comparison:

< dependency >
    
< groupId > org.springframework </ groupId >
    
< artifactId > spring-context-support </ artifactId >
    
< version > 3.1.0.RELEASE </ version >
</ dependency >


Maven 安装 JAR 包的命令是:

mvn install:install-file -Dfile=jar包的位置 -DgroupId=上面的groupId -DartifactId=上面的artifactId -Dversion=上面的version -Dpackaging=jar


例如:
我下载的这个 jar 包是放到了 D:\mvn 目录下(D:\mvn\spring-context-support-3.1.0.RELEASE.jar)
那么我在 cmd 中敲入的命令就应该是:

mvn install:install-file -Dfile=D:\mvn\spring-context-support-3.1.0.RELEASE.jar -DgroupId=org.springframework -DartifactId=spring-context-support -Dversion=3.1.0.RELEASE -Dpackaging=jar

回车,显示安装成功:

 

 

mvn install:install-file -Dfile=ojdbc6.jar -DgroupId=com.oracle -DartifactId=oracle -Dversion=11.2.0.1.0 -Dpackaging=jar -DgeneratePom=true
mvn install:install-file -Dfile=orai18n.jar -DgroupId=com.oracle -DartifactId=orai18n -Dversion=11.2.0.1.0 -Dpackaging=jar -DgeneratePom=true

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326567932&siteId=291194637