maven 问题汇总

尽量用高版本maven 3以上的版本

1、maven环境变量相关

maven环境变量配置依赖于JAVA_HOME配置

maven环境变量配置为M2_HOME

maven配置完环境变量需要重启操作系统

2、运行Maven是报错:No goals have been specified for this build问题下边连接解决

http://blog.csdn.net/yiluoak_47/article/details/16940303

-Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable and mvn script match.问题下边连接解决

设置 maven Runner

-Dmaven.multiModuleProjectDirectory=$M2_HOME

http://fxb4632242.iteye.com/blog/2193945

3、用Intellij Idea (version: 12U)导入maven project后,发现external libraries里没有那些jar包,一个一个的加不是要加死啊。。。google了一下,才知道Intellij里有个叫"maven projects"的tab window, 点其工具栏上的“Reimport all Maven Projects"按钮就可以导入其中的dependencies了

问题处理

http://blog.csdn.net/skyhsu/article/details/8534320

4、idea maven依赖包导入

 Maven projects need to be imported: Import Changes Enable Auto-Import

5、maven使用进入项目路径下可以命令行执行maven命令,前提按上边1配置好环境变量

6、maven 上传新的jar包到自有仓库后,其他项目引用取新的版本时可以删除配置maven路径下的jar包从新

    导入

7、maven jar包上传到仓库注意调整pom.xml格式,为仓库要求格式

8、idea项目使用maven避免在项目根节点引用模块jar包会导致循环依赖

Scanning for projects... [ERROR] The projects in the reactor contain a cyclic reference: Edge between 'Ve rtex{label='org.kuuyee.sample:module-C:1.0-SNAPSHOT'}' and 'Vertex{label='org.ku uyee.sample:module-B:1.0-SNAPSHOT'}' introduces to cycle in the graph org.kuuyee .sample:module-B:1.0-SNAPSHOT --> org.kuuyee.sample:module-A:1.0-SNAPSHOT --> or g.kuuyee.sample:module-C:1.0-SNAPSHOT --> org.kuuyee.sample:module-B:1.0-SNAPSHO T -> [Help 1][ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit ch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR] [ERROR] For more information about the errors and possible solutions, please rea d the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectCycleEx ception 

    详见:

     http://hck.iteye.com/blog/1728329

9、idea maven项目修改比如从<version>1.0-SNAPSHOT</version>到<version>1.0.0-SNAPSHOT</version>

同时要将iml中1.0修改为1.0.0

原文地址:https://www.cnblogs.com/freedommovie/p/5624867.html