maven遇到的一些问题

(1)在加载的时候pom.xml文件是和src同级的,当在pom.xml导入jar包时一定要先把jar包所在的项目mvn install否则会报找不到的错误

(2)怎么找到maven原有的仓库?

找到你安装的maven的目录。conf下面有一个setting.xml文件,里面有一个

${user.home}是哪里呢?

就是这里

(3)如果已经install并且import的并没有错误,依然报错:找不到符号,很有可能是pom.xml中不该配置《scope》但是却配置了

)

(4)在使用骨架创建项目时候出现的问题

Unable to add module to the current

上网搜资料发现一个帖子,问题解决:

原文如下:

一开始以为是IDE出错了,很是着急,后来回想出错之前的操作。就在这之前,我备份了一个pom文件,然后直接移到了workspace的根目录下,心想是不是这个问题呢?带着疑问,我把这个pom.xml删掉了,然后再创建maven工程,果然不出所料,不再报错了。

为了确保是这个原因,后来google了一下,在国外一个论坛中碰到类似的问题,有个网友的回答摘抄如下:

Are you running the command from a directory that has an existing pom.xml file in it? I think that may be confusing Maven, as it thinks you're trying to add your new project as a sub-module of the project in the working directory.

原来是因为我在Workspace下放了个POM文件,造成了M2eclipse插件的误解,删掉就OK了。

原文地址:https://www.cnblogs.com/wth21-1314/p/7041011.html