如何从命令行获取maven-dependency-plugin?

时间:2011-05-22 13:01:42

标签: unix maven-2 command-line dependency-management maven-dependency-plugin

我正在尝试通过SSH在服务器上执行此命令:

mvn tomcat:run-war &

但该插件不在本地仓库中:

[INFO] Scanning for projects...

[INFO]在存储库中搜索前缀为“tomcat”的插件。 [INFO] org.apache.maven.plugins:检查来自中央的更新

所以我试试:

$ mvn dependency:get -DrepoUrl=http://download.java.net/maven/2/ -Dartifact=org.codehaus.mojo:tomcat-maven-plugin

但即使org.apache.maven.plugins:maven-dependency-plugin也不存在。那么,安装maven-dependency-plugin 的最'命令行友好'方式是什么,所以安装tomcat一个?

$ mvn --version
Apache Maven 2.2.1 (rdebian-1)
Java version: 1.6.0_22
Java home: /usr/lib/jvm/java-6-sun-1.6.0.22/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.32-29-server" arch: "amd64" Family: "unix"

1 个答案:

答案 0 :(得分:0)

将jar和pom上传到服务器:

$ scp ~/.m2/repository/org/apache/maven/plugins/maven-dependency-plugin/2.1/maven-dependency-plugin-2.1.jar gkahlout@192.168.344.511:/home/gkahlout
maven-dependency-plugin-2.1.jar
$ scp ~/.m2/repository/org/apache/maven/plugins/maven-dependency-plugin/2.1/maven-dependency-plugin-2.1.pom gkahlout@192.168.344.511:/home/gkahlout

安装:

$ mvn install:install-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-dependency-plugin -Dversion=1.1 -Dfile=maven-dependency-plugin-2.1.jar -Dpackaging=jar

$ mvn dependency:get -DrepoUrl=http://download.java.net/maven/2/ -Dartifact=org.codehaus.mojo:tomcat-maven-plugin:1.1