Today encountered a Mavan warehouse does not have a jar package, it can only add local jar package, spent a lot of time to find information, finally OK. So this record.
1. For the first time, see on the internet that can be solved with <systemPath>, as follows:
<Dependencies> <Dependency> <groupId>Xxx</groupId> <Artifactid>Xxx</Artifactid> <version>Xxx</version> <Scope>System</Scope> <Systempath>${basedir}/xx.jar</Systempath> </Dependency></Dependencies>
However, when running jetty and packaging, you will not find the referenced package, pass away directly. All kinds of egg ache, is the MAVEN is not ripe to provoke the curse. The deceased MAVEN official website looked at the document, has made the good few moments, finally found a solution:
2. Create a local warehouse and install it as a plugin:
(1) Create a local repository:
<repositories> <Repository> <ID>Local-repo</ID> <URL>File://${basedir}/repo</URL> </Repository></repositories>
(2) Install the local library to Maven:
mvn install:install-file-dfile=< > -dgroupid=< Span style= "color: #800000;" >group > -dartifactid= < artifactid > -dversion= < version > -dpackaging=< packaging > -dlocalrepositorypath= path >
(Note: Parameter description: Jar-path is the path of your jar, Group,artifactid, version This does not say, packaging is a jar or war, Dlocalrepositorypath is the path of the local repository you created earlier).
(3) Install as plug-in form:
<plugin> <groupId>Org.apache.maven.plugins</groupId> <Artifactid>Maven-install-plugin</Artifactid> <version>2.4</version> <executions> <Execution> <Phase>Initialize</Phase> <Goals> <goal>Install-file</goal> </Goals> <Configuration> <groupId>Xxx</groupId> <Artifactid>Xxx</Artifactid> <version>Xxx</version> <Packaging>Jar</Packaging> <file>${basedir}/xxx.jar</file> </Configuration> </Execution> </executions></plugin>
(4) Add dependency:
<Dependency> <Artifactid>Xxx</Artifactid> <groupId>Xxx</groupId> <version>Xxx</version></Dependency>
OK, this is OK. It did take a lot of time to read the information because it wasn't too familiar to Maven. In this record, one can leave a note, and hope to help people who meet the same problem.
Maven Add local jar Package