Guide to deploy 3rd party JARs
登録する方法
Maven Central Repositoryに登録されていないJar File(3rd party JARs)をLocal Repository(~/m2/Repository)に登録する方法は、Guide to installing 3rd party JARsに書いてあります。
そして、同様に、自分用のRemote Repositoryに登録するには、以下のようにします。
mvn deploy:deploy-file \
-Dfile=<path-to-file> \
-DgroupId=<group-id> \
-DartifactId=<artifact-id> \
-Dversion=<version> \
-Dpackaging=<packaging> \
-DrepositoryId=<reposirtory-id> \
-Durl=<url>
Ex: -DrepositoryId=localhost
-Durl=file:///usr/local/apache2/htdocs/maven2
また、sshやftpでアクセスする方法は、http://maven.apache.org/guides/にあります。
利用する方法
Projectから、自分用のRemote Repositoryにアクセスするためには、pom.xmlに
<project>
...
<repositories>
...
<repository>
<id>localhost</id>
<url>file:///usr/local/apache2/htdocs/maven2</url>
</repository>
...
</repositories>
...
</project>
と登録します。
このように設定すると、Maven2は、まず、自分用のRemote Repositoryにアクセスしてから、Maven Central Repositoryにアクセスするようになります。
Tips
Maven Central Repositoryにあり、よく利用するJar Fileは、自分用のRemote RepositoryにMirroringしておくと、少し、幸せになるかもしれません。