Manually add dependent jar files to Maven Repository

Source: Internet
Author: User

When writing a Maven project program, sometimes the program depends on a class library JAR file. However, the maven remote Repository

This file is not included, so you cannot use the maven plug-in to automatically download it from its remote repository. We need to manually add it

To the local repository to compile the project dependent on this class library.

Bytes -------------------------------------------------------------------------------------

Is a self-compiled JAR file, each time you add a single jar to the maven local repository, the operation is as follows:

# Create a new folder and store the JAR file in it.

Note: It is best to store only this file in the folder.

# Create a pom. xml file under the folder and define its Maven coordinates in the POM file.

# Run the following command in the CMD window:

MVN install: Install-file-dfile = -Dgroupid = -Dartifactid =-dversion = -Dpackaging =

For example:

MVN install: Install-file-dfile =/home/hjq/SMS. jar-dgroupid = ufmobile-dartifactid = SMS-dversion = 3.0-dpackaging = jar

In this way, the jar is successfully installed.

Note: To run this command, you must install a non-Eclipse plug-in Maven.

Bytes ---------------------------------------------------------------------------------------

# If the jar class library is used as the dependency in other projects, add the corresponding dependency code to the Pom. xml file.

The statement is as follows:

Ufmobile

SMS

3.0

Note: Many people have posted online to discuss this issue.

Some make this simple problem very complicated.

Some people think that the above cmd command does not work, probably because the POM file is not added.

========================================================== ========================================================== ==================

Other tips:

# If you can download the JAR file and Its pom file online,

The following steps are more convenient:

Import jar and POM to eclipse as a new project. Run the install command to run the project.

The advantage is that the dependencies of the jar files to be installed are automatically installed according to the Pom. Instead of manually installing the dependencies of the JAR file.

Reprinted please indicate the source of my search space

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.