Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Downloading all plugin dependencies from a maven project

I'm trying to download all plugin dependencies from a maven project before actually using them.

I've tried running:

mvn dependency:resolve-plugins

And this successfully downloads it's plugins and part of their dependencies. For example, for the exec plugin I get:

... 
[INFO] Plugin Resolved: exec-maven-plugin-1.6.0.jar
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1.jar (37 KB at 437.4 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact-manager/2.2.1/maven-artifact-manager-2.2.1.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact-manager/2.2.1/maven-artifact-manager-2.2.1.jar (66 KB at 709.6 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar (238 KB at 1785.2 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/commons/commons-exec/1.3/commons-exec-1.3.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/commons/commons-exec/1.3/commons-exec-1.3.jar (54 KB at 610.9 KB/sec)
[INFO]     Plugin Dependency Resolved: maven-toolchain-2.2.1.jar
[INFO]     Plugin Dependency Resolved: maven-project-2.2.1.jar
[INFO]     Plugin Dependency Resolved: maven-model-2.2.1.jar
[INFO]     Plugin Dependency Resolved: maven-artifact-2.2.1.jar
[INFO]     Plugin Dependency Resolved: maven-artifact-manager-2.2.1.jar
[INFO]     Plugin Dependency Resolved: maven-core-2.2.1.jar
[INFO]     Plugin Dependency Resolved: maven-plugin-api-2.2.1.jar
[INFO]     Plugin Dependency Resolved: plexus-utils-3.0.20.jar
[INFO]     Plugin Dependency Resolved: commons-exec-1.3.jar
...

However, when you actually use the plugins, for example:

mvn exec:exec

It turns out it's dependencies haven't been fully downloaded.

    [INFO] --- exec-maven-plugin:1.6.0:exec (default-cli) @ ARandomProject ---
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1.pom (4 KB at 6.9 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven/2.2.1/maven-2.2.1.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/maven/2.2.1/maven-2.2.1.pom (22 KB at 179.4 KB/sec)
...
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.jar (10 KB at 21.8 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-descriptor/2.2.1/maven-plugin-descriptor-2.2.1.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.jar (12 KB at 23.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-monitor/2.2.1/maven-monitor-2.2.1.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.jar (13 KB at 25.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
Downloaded: https://repo.maven.apache.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.jar (41 KB at 79.2 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-descriptor/2.2.1/maven-plugin-descriptor-2.2.1.jar (39 KB at 73.4 KB/sec)
...

Which is unexpected, since according to the documentation the excludeTransitive property is false by default (and explicitly setting it doesn't help). From what I see, it's only downloading one level of transitive dependencies from the defined plugins.

Is there a way to get the dependency plugin to download all the transitive plugin dependencies, instead of only the first-level ones, before actually needing them?

like image 642
Sirs Avatar asked Aug 25 '17 07:08

Sirs


1 Answers

you should execute mvn dependency:go-offline if you really need everything get ready. check this out :

dependency:go-offline

Apache Maven Dependency Plugin

like image 102
linc01n Avatar answered Sep 18 '22 23:09

linc01n