Maven manually add local jar packages to the local repository

Source: Internet
Author: User

Today to create a new MAVEN project, just wrote a dependency after the Pom file error,

-Missing Artifact javax:javaee-api:jar:7.0
-Missing Artifact junit:junit:jar:3.8.1

Maven comes with the ability to automatically download some of the usual jar packages from the central repository to the local repository, but often the network does not force or otherwise cause MAVEN to fail to connect to the central warehouse,

You can download the jar locally and then manually install the jar to the local repository by using CMD to enter the following command


Example: Installing the Javaee-api-7.0.jar in the Jar folder of the local C drive into this warehouse

MVN Install:install-file-dfile=c:\jar\javaee-api-7.0.jar-dgroupid=javax-dartifactid=javaee-api-dversio N=7.0-dpackaging=jar


Note:-dfile = "Input here is the local path of your jar package"


[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:\jar\javaee-api-7.0.jar to C:\Users\zhanghai123\.m2\reposit
Ry\javax\javaee-api\7.0\javaee-api-7.0.jar
[INFO] Installing c:\users\zhangh~1\appdata\local\temp\mvninstall57834341258817
8637.pom to C:\Users\zhanghai123\.m2\repository\javax\javaee-api\7.0\javaee-api
7.0.pom
[INFO]------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]------------------------------------------------------------------------
[INFO] Total time:0.631 S
[INFO] Finished at:2015-11-15t13:14:54+08:00
[INFO] Final memory:7m/109m
[INFO]------------------------------------------------------------------------



Open the local repository after successful installation find the folder where the jar package can see maven generated a maven file, this time indicates that the jar installed successfully


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.