maven用命令怎么更新依赖包

来源:互联网 发布:视频提取软件安卓版 编辑:程序博客网 时间:2024/04/25 17:00
maven
mvn clean install -e -U

-e详细异常,-U强制更新


mvn  archetype:generate   -DgroupId=damocles-autocredit -DartifactId=damocles-autocredit  -DarchetypeArtifactId=maven-archetype-quickstart     -DinteractiveMode=false  -X
 
 
1 下载源代码:mvn dependency:sources -DdownloadSources=true -DdownloadJavadocs=true


1 在线安装eclipse maven插件
  Help  -->  Install New Software,输入http地址http://m2eclipse.sonatype.org/sites/m2e,把选项勾上,然后等待它下载安装,完成之后重启 eclipse 即可
 
2 下载SRPING3.1.4,将其maven工程导入到eclipse中去
 
3 右击某一maven工程,maven-update Dependencies即可下载更新SPRING依赖的第三方jar包
有的时候上面的update不生效,那就用maven命令行吧,如:
D:\workspace\test\trunk\src\test>mvn compile

 

常见问题汇总

1、最近在切换Maven Repository路径时,eclipse中遇到了ArtifactDescriptorException的问题,而且一下就是400多个error。

错误如下:

 View Code

看上去是有什么东西无法下载,但工程各种Clean、重新导入、Update Dependency、package、eclipse:eclipse都无效,切换到老的Repository就没问题。去新的路径下看,对应的jar包也都在,又怀疑pom中有格式错误,各种调整也没有解决。

后来使用mvn命令行进行jar下载,问题得到解决。

2、问题:

eclipse装m2eclipse的时候装完后创建项目的时候报错:

Unable to create project from archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE

解决方法:

  1. Open Window > Preferences
  2. Open Maven > Archetypes
  3. Click 'Add Remote Catalog' and add the following:
    • Catalog File: http://repo1.maven.org/maven2/archetype-catalog.xml
    • Description: maven catalog

 

3、问题: 
eclipse装m2eclipse的时候装完后创建项目的时候报错:

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE from any of the configured repositories.

解决方法:

步骤一: 
从http://maven.oschina.net/content/groups/public/org/apache/maven/archetypes/maven-archetype-quickstart/ 下载最新版maven-archetype-quickstart-1.1.jar

步骤二: 
命令行到下载目录下执行

mvn install:install-file -DgroupId=org.apache.maven.archetypes -DartifactId=maven-archetype-quickstart -Dversion=1.1 -Dpackaging=jar -Dfile=maven-archetype-quickstart-1.1.jar

重新打开发工具创建maven项目


0 0