Maven使用备忘

2017-08-07  本文已影响0人  天边010

常见问题

问题1:如果遇到缺失maven包的情况,大概是因为依赖包没有下全,例如下面的错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (make-assembly) on project zheng-upms-rpc-service: Execution make-assembly of goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single failed: Plugin org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven.shared:maven-common-artifact-filters:jar:1.1, org.codehaus.plexus:plexus-interpolation:jar:1.7, org.apache.maven:maven-artifact-manager:jar:2.0.2, org.apache.maven:maven-plugin-api:jar:2.0.4, org.apache.maven:maven-project:jar:2.0.4, org.apache.maven:maven-profile:jar:2.0.4, org.apache.maven:maven-archiver:jar:2.4, org.codehaus.plexus:plexus-utils:jar:2.0.1, org.apache.maven:maven-artifact:jar:2.0.4, org.apache.maven:maven-model:jar:2.0.4, org.apache.maven.shared:maven-repository-builder:jar:1.0-alpha-2: Failure to find org.apache.maven.shared:maven-common-artifact-filters:jar:1.1 in http://123.56.81.22:8081/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 -> [Help 1]

修改的方法也很简单粗暴:
打开.../conf/settings.xml文件,找到<mirrors>标签,添加阿里的仓库

<mirror>  
      <id>alimaven</id>  
      <name>aliyun maven</name>  
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
      <mirrorOf>central</mirrorOf>          
    </mirror>  

保存,重新编译maven项目即可;

上一篇下一篇

猜你喜欢

热点阅读