ApacheMaven使用技巧
1. 如何让Maven中maven-antrun-plugin插件走代理下载依赖包
许多大型项目的pom文件中需要使用maven-antrun-plugin插件下载软件包,比如Apache atlas项目,但是虽然在maven的settings.xml中配置了代理,但是对maven-antrun-plugin无效,可以通过在mvn命令中显示的增加代理配置使maven-antrun-plugin走代理。实例如下:
mvn clean -DskipTests -Dhttp.proxyHost=<ip> -Dhttp.proxyPort=<port> -Dhttps.proxyHost=<ip> -Dhttps.proxyPort=<port> package -Pdist,embedded-hbase-solr
EOF

当在大型项目如Apache Atlas中使用maven-antrun-plugin时,即使在settings.xml中配置了代理,该插件可能仍然无法通过代理下载依赖包。解决方法是在执行mvn命令时,显式添加代理参数,例如:`mvn clean -DskipTests -Dhttp.proxyHost=<ip> -Dhttp.proxyPort=<port> -Dhttps.proxyHost=<ip> -Dhttps.proxyPort=<port> package -Pdist,embedded-hbase-solr`。这样可以确保maven-antrun-plugin通过代理正确下载所需资源。

2011

被折叠的 条评论
为什么被折叠?



