maven Nexus的一些注意事项

来源:互联网 发布:sqlserver 维护计划 编辑:程序博客网 时间:2024/06/16 16:29

一、发现配置后,下载构件抛异常。

0-10-3 下午05时09分43秒: Build error for /com.newyulong.iptv.domain.entity/pom.xml; org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.1 or one of its dependencies could not be resolved: Missing:
----------
1) org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.4.1

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-resources-plugin -Dversion=2.4.1 -Dpackaging=maven-plugin -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-resources-plugin -Dversion=2.4.1 -Dpackaging=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

----------
1 required artifact is missing.

for artifact: 
  org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.4.1

from the specified remote repositories:
  Nexus (http://localhost:8181/nexus/content/groups/public , releases=true, snapshots=false)

 

二、主要原因是配置nexus里面的 Public Repositories 顺序和条件出错,导致不能下载构件。

 

这个是正确的配置顺序,左边的是正在使用的定义好的仓库组,一边是可选的。下载构件的顺序是先在本地releases找有没有,再snapshots,再3rd party,最后是本地机子都没有构件就到远程(外网)提供的网站下载构件。

 

 

好多公司处于安全考虑,用代理上网,而nexus 经常需要往maven repository中心下载东西,所以需要给nexus设置代理。 开始没找到地方,后来发现可以从nexus后台管理器界面上直接设置,地方很隐蔽: 

登陆后进入管理页面,从左边菜单栏选择Server 打开右边tab页,发现还是找不到,别着急,仔细找会发现有行: default http proxy settings   前面有个checkbox 未勾选, 速度勾选之,马上出现了您熟悉的  proxy host,proxy port , username , passowrd.  okay 代理设置完成,现在nexus能通过互联网从maven repository中心下载东西了

0 0
原创粉丝点击