eclipse maven 常见问题解决方案

一、eclipse集成与设置

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

二、创建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/12757433

其他镜像:http://www.cnblogs.com/ae6623/p/4416256.html

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

三、解决maven下载jar包过慢

将镜像配置到阿里云后,是可以提升不少速度,但是还可以利用命令,先将jar包预下载到本地变得更快

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 项目

第3步会下载所需要的jar包,如果显示

则说明成功.

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

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

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

3.试过通过settings.xml 的 repositories 覆盖根级配置 还是不行

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,问题解决

 

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

posted @ 2017-09-25 18:23  Tweet  阅读(282)  评论(0编辑  收藏  举报