リモートリポジトリからローカルリポジトリへのインストール

$ mvn dependency:get -Dartifact=GroupId:ArtifactId:Version
  • -DartifactId ダウンロードするパッケージを指定する。
    • 構成 groupId:artifactId:version

例: junit 4.13 のインストール

$ mvn dependency:get -Dartifact=junit:junit:4.13-beta-1

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:get (default-cli) @ standalone-pom ---
[INFO] Resolving junit:junit:jar:4.13-beta-1 with transitive dependencies
Downloading from central: https://repo.maven.apache.org/maven2/junit/junit/4.13-beta-1/junit-4.13-beta-1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/junit/junit/4.13-beta-1/junit-4.13-beta-1.pom (25 kB at 22 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.pom (820 B at 2.6 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar
Downloading from central: https://repo.maven.apache.org/maven2/junit/junit/4.13-beta-1/junit-4.13-beta-1.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar (53 kB at 69 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/junit/junit/4.13-beta-1/junit-4.13-beta-1.jar (380 kB at 264 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11.067 s
[INFO] Finished at: 2019-05-05T18:14:19+09:00
[INFO] ------------------------------------------------------------------------

f:id:yossan2:20190505182029p:plain
ローカルリポジトリへのインストール

MEMO:

  • 依存関係にあるパッケージもインストールしてくれているようだ

参考

Apache Maven Dependency Plugin – dependency:get