Eclipse新建maven project报错
在搭建multi-module project,如下,快速新建一个maven project时:

完整地码进artifactId and groupId,点击finish时,报如下错误:(第一次搭建时,会看到进度条eclipse有去下载maven-archetype.jar。
对于没有联网不能下载的,可以配置镜像,在私服nexus上下载(这个需要知道镜像url配置到conf/setting.xml文件中),
或者在maven官网(http://maven.apache.org/archetype/maven-archetype-plugin/specification/archetype-catalog.html)上下载到本地仓库中,
或者在install窗口让eclipse给你重新下载(http://repo.maven.apache.org/maven2/archetype-catalog.xml)不过这种方法,我总是报no software set in the site.没有成功。)
说回到重点,我的问题不是依赖Jar找不到,而是在我的workspace目录下存在pom.xml,而且该pom.xml中的package定义的不是pom,eclipse会误认为我所要建的项目是要包含在这个pom.xml中,所以导致错误“unable to add module to the current project as it is not of packaging type ‘pom’.”.

删掉该pom.xml或重新定义该pom.xml中的package成pom,问题就可以解决了。
本文解决在Eclipse中创建Maven项目时遇到的“无法将模块添加到当前项目,因为其打包类型不是‘pom’”的问题。通过删除工作空间中的冲突pom.xml或修改其package属性为pom,即可避免此错误。

被折叠的 条评论
为什么被折叠?



