| ------ |
| Guide to installing 3rd party JARs |
| ------ |
| Jason van Zyl |
| Robert Scholte |
| ------ |
| 2013-07-13 |
| ------ |
| |
| ~~ Licensed to the Apache Software Foundation (ASF) under one |
| ~~ or more contributor license agreements. See the NOTICE file |
| ~~ distributed with this work for additional information |
| ~~ regarding copyright ownership. The ASF licenses this file |
| ~~ to you under the Apache License, Version 2.0 (the |
| ~~ "License"); you may not use this file except in compliance |
| ~~ with the License. You may obtain a copy of the License at |
| ~~ |
| ~~ http://www.apache.org/licenses/LICENSE-2.0 |
| ~~ |
| ~~ Unless required by applicable law or agreed to in writing, |
| ~~ software distributed under the License is distributed on an |
| ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| ~~ KIND, either express or implied. See the License for the |
| ~~ specific language governing permissions and limitations |
| ~~ under the License. |
| |
| ~~ NOTE: For help with the syntax of this file, see: |
| ~~ http://maven.apache.org/doxia/references/apt-format.html |
| |
| Guide to installing 3rd party JARs |
| |
| Although rarely, but sometimes, you will have 3rd party JARs that you need to put in your local repository for use in your |
| builds, since they don't exist in any public repository like {{{https://search.maven.org}Maven Central}}. |
| The JARs must be placed in the local repository in the correct place in order for it to be correctly |
| picked up by Apache Maven. |
| |
| To make this easier, and less error prone, we have provided an <<<install-file>>> goal in the |
| {{{/plugins/maven-install-plugin/}maven-install-plugin}} which should make this relatively painless. |
| |
| To install a JAR in the local repository use the following command: |
| |
| ---- |
| mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging> |
| ---- |
| |
| If there's a pom-file as well, you can install it with the following command: |
| |
| ---- |
| mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile> |
| ---- |
| |
| With version 2.5 of the maven-install-plugin, it can get even simpler: if the JAR was built by Apache Maven, it'll contain a |
| pom.xml in a subfolder of the META-INF/ directory, which will be read by default. In that case, all you need to do is: |
| |
| ---- |
| mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=<path-to-file> |
| ---- |
| |
| |