2
我試圖在實際使用它們之前從Maven項目下載所有插件依賴項。從Maven項目下載所有插件依賴項
我試着運行:
mvn dependency:resolve-plugins
而這種成功下載它的插件及其依賴的一部分。例如,對於Exec插件我得到:
...
[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
...
但是,當你真正使用的插件,例如:
mvn exec:exec
事實證明它的依賴尚未完全下載。
[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)
...
這是出乎意料的,因爲according to the documentation的excludeTransitive屬性爲默認值(和明確設置它並不能幫助)假。從我所看到的情況來看,它只是從定義的插件中下載一層傳遞依賴關係。
在實際需要它們之前,是否有辦法讓依賴插件下載所有傳遞插件依賴項,而不是隻有第一級插件依賴項?
這似乎做的正是我想要的。謝謝! – Sirs