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