1
Maven依賴項插件有一個get
目標,允許您檢查依賴於回購的依賴項。這可能非常有用。從遠程存儲庫獲取/檢查依賴項
With a repoUrl
argument。
由於下面的代碼顯示該參數被插件忽略。它只會嘗試從我的設置文件中獲取從回購的依賴關係。
有沒有辦法檢查遠程存儲庫中的依賴關係?
[email protected]:~$ mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \
> -DrepoUrl=http://repository.springsource.com/maven/bundles/external/ \
> -Dartifact=javax.servlet:javax.servlet:2.4.0
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:get (default-cli) @ standalone-pom ---
Downloading: https://devops.ok:8443/nexus/content/groups/public/javax/servlet/javax.servlet/2.4.0/javax.servlet-2.4.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.221 s
[INFO] Finished at: 2015-12-02T16:33:50+00:00
[INFO] Final Memory: 11M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:get (default-cli) on project standalone-pom: Couldn't download artifact: Failure to find javax.servlet:javax.servlet:jar:2.4.0 in https://devops.ok:8443/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=javax.servlet -DartifactId=javax.servlet -Dversion=2.4.0 -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=javax.servlet -DartifactId=javax.servlet -Dversion=2.4.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR]
[ERROR] javax.servlet:javax.servlet:jar:2.4.0
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] nexus (https://devops.ok:8443/nexus/content/groups/public/, releases=true, snapshots=true),
[ERROR] nexus (https://devops.ok:8443/nexus/content/groups/public/, releases=true, snapshots=true)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[email protected]:~$ mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get -DrepoUrl=http://repository.springsource.com/maven/bundles/external/ -Dartifact=javax.servlet:javax.servlet:2.4.0
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:get (default-cli) @ standalone-pom ---
Downloading: https://devops.ok:8443/nexus/content/groups/public/javax/servlet/javax.servlet/2.4.0/javax.servlet-2.4.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.245 s
[INFO] Finished at: 2015-12-02T16:38:33+00:00
[INFO] Final Memory: 11M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:get (default-cli) on project standalone-pom: Couldn't download artifact: Failure to find javax.servlet:javax.servlet:jar:2.4.0 in https://devops.ok:8443/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=javax.servlet -DartifactId=javax.servlet -Dversion=2.4.0 -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=javax.servlet -DartifactId=javax.servlet -Dversion=2.4.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR]
[ERROR] javax.servlet:javax.servlet:jar:2.4.0
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] nexus (https://devops.ok:8443/nexus/content/groups/public/, releases=true, snapshots=true),
[ERROR] nexus (https://devops.ok:8443/nexus/content/groups/public/, releases=true, snapshots=true)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[email protected]:~$
更新
remoteRepositories
不起作用。 remoteRepositories
與repoUrl
組合嘗試做多,但
[email protected]:~$ mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get -DremoteRepositories=http://repository.springsource.com/maven/bundles/external -Dartifact=javax.servlet:javax.servlet:2.4.0 -DrepoUrl=http://repository.springsource.com/maven/bundles/external/
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:get (default-cli) @ standalone-pom ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.811 s
[INFO] Finished at: 2015-12-02T16:51:10+00:00
[INFO] Final Memory: 7M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:get (default-cli) on project standalone-pom: A type incompatibility occured while executing org.apache.maven.plugins:maven-dependency-plugin:2.1:get: java.lang.String cannot be cast to org.apache.maven.artifact.repository.ArtifactRepository
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-dependency-plugin:2.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/var/lib/jenkins/.m2/repository/org/apache/maven/plugins/maven-dependency-plugin/2.1/maven-dependency-plugin-2.1.jar
[email protected]:~$ mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get -DremoteRepositories=http://repository.springsource.com/maven/bundles/external -Dartifact=javax.servlet:javax.servlet:2.4.0
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:get (default-cli) @ standalone-pom ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.860 s
[INFO] Finished at: 2015-12-02T16:55:50+00:00
[INFO] Final Memory: 7M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:get (default-cli) on project standalone-pom: The parameters 'repositoryUrl' for goal org.apache.maven.plugins:maven-dependency-plugin:2.1:get are missing or invalid -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException
[email protected]:~$