eclipse maven 常见问题解决方案

1、eclipse集成与设置

传送门:http://www.cnblogs.com/tweet/p/7602044.htmlhtml

2、建立maven webapp工程,报错

报错信息:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 from any of the configured repositories.

解决方法,更换阿里云maven镜像,传送门:http://blog.csdn.net/afgasdg/article/details/12757433web

其余镜像:http://www.cnblogs.com/ae6623/p/4416256.htmlapache

<!-- 配置阿里云Maven镜像 -->  
    <mirrors>  
        <mirror>  
          <id>aliyun</id>  
          <name>aliyun</name>  
          <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
          <mirrorOf>central</mirrorOf>  
        </mirror>  
    </mirrors>  

3、解决maven下载jar包过慢

将镜像配置到阿里云后,是能够提高很多速度,可是还能够利用命令,先将jar包预下载到本地变得更快app

1.打开cmd ,  echo %MAVEN_HOME%;
2.mvn help:system;
3.mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false?

第2步其实使用mvn 命令构建一个项目,命令行下 下载jar包要快些会下载一堆东西,若是失败多刷几下,保证下完,命令行构建成功后 能够发现该目录 C:\Users\Administrator\{project-name}  是一个web 项目eclipse

第3步会下载所须要的jar包,若是显示webapp

则说明成功.maven

4、maven -> add dependency 出错  Artiface Id cannot be empty

1.试过 Window -> Preferences -> maven -> [select] Download reponsitory index update on startup -> Apply  不能解决. 方案:ui

2.试过 window -> show view -> other -> maven -> maven repositories -> global repositories -> rebuild index 同样不能解决.方案:查看这里阿里云

3.试过经过settings.xml 的 repositories 覆盖根级配置 仍是不行url

4.试过更新pom.xml文件 添加apache commons-lang3依赖 仍是不行,方案:查看这里

4.还有的说缺乏STS(Spring Tool Suite) 或者 删除 settings.xml 从新建立,没试过,方案 查看这里

最后经过 help -> eclipse marketplace -> installed -> m2e -> Update 最新,退出重进 便可重建索引 

pom.xml 报错 web.xml is missing and <failOnMissingWebXml> is set to true

因为缺乏web.xml致使的,解决方法,添加Web模块.

右键项目->Java EE Tools->Generate Deployment Descriptor Stub

这样就在src\main\webapp下面生成了WEB-INF文件夹和web.xml,问题解决

 

5、maven 其余错误, 查看 http://www.cnblogs.com/Rambo635755402/p/5549356.html