Sun の binary license
Maven でビルド時に、Sun 関連アーティファクトについて、以下のようなエラーが出ることがあります。
[INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Missing: ---------- 1) javax.sql:jdbc-stdext:jar:2.0 Try downloading the file manually from: http://java.sun.com/products/jdbc/download.html Then, install it using the command: mvn install:install-file -DgroupId=javax.sql -DartifactId=jdbc-stdext \ -Dversion=2.0 -Dpackaging=jar -Dfile=/path/to/file Path to dependency: 1) org.klab:dogado-common:jar:1.0-SNAPSHOT 2) mysql:mysql-connector-java:jar:3.0.10 3) javax.sql:jdbc-stdext:jar:2.0 ---------- 1 required artifact is missing.
おとなの都合
これは、Sunのバイナリライセンスの都合で、対象のアーティファクトが central で配布できないためです。以下の URL に、対応手順が説明されています。
Coping with Sun JARs
また、以下にて、サードパーティーの jar のインストールの仕方が書かれています。
Guide to installing 3rd party JARs
以下はコマンド部分の抜粋
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \ -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
自分用リポジトリの作成
また、以下のようにチェックサムやpom.xmlを作成し、pom.xml に必要な依存関係を記述し、
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \ -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=jar \ -DcreateChecksum=true -DgeneratePom=true
以下のようにソースを jar にアーカイブして、共有ファイルサーバとかに置き、リポジトリとして参照すると便利です。
<artifact-id>-<version>-sources.jar