图片上传有点问题,请参考附件
一、Maven错误的解决方案
问题:Could not transfer artifact org.codehaus.plexus:plexus-archiver:jar:1.2 from/to central
(http://repo.maven.apache.org/maven2): connection timed
out to http://211.136.8.21/files/41970000008EDF53/repo1.maven.org/
maven2/org/codehaus/plexus/plexus-archiver/1.2/plexus-archiver-1.2.jar
详细解决方案请访问:
http://www.bubuko.com/infodetail-914917.html
解决方法:
1)plexus-archiver-1.2.jar下载放在本地maven仓库中,下载地址为:http://www.java2s.com/Code/Jar/p/Downloadplexusarchiver12jar.htm
仓库位置如下:
2)alt+F5刷新项目,问题就消失了
二、Maven工程中The parent project must have a packaging type of POM
解决方法:修改父项目的packaging类型为POM
2、我在Eclipse中新建Static web project 后,发觉没有source folder文件夹,于是想自己手工添加一个src的source folder文件夹,结果出现:Project is not a Java project的错误
解决方法:更改工程的Project Facets,详细做法如下图所示:
点击Apply
三、在Maven工程中引用第三方类库的函数或注解时,没有导包提示,如图3-1所示:
图 3-1 错误图
错误原因:Maven工程没有成功“Maven install”
解决方法:右击工程“Run As/Maven install”,如图3-2所示
图 3-2 解决方法图
四、Maven工程中出现以下错误:“artifactId is missing @line 3,@column100”,访问https://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException可知可能的原因如下:
1. A POM can't be parsed because its XML is not well-formed or contains invalid elements, see also ModelParseException.
2. A parent POM can't be resolved, e.g. because the POM is neither present locally at the path denoted by <relativePath> nor available in any of the <repositories> declared in the POM or the settings.xml, see also UnresolvableModelException.
3. The contents of a POM is incomplete or otherwise semantically invalid.
4. A child module of an aggregator project could not be found at the specified location.
经过检查后,我发现我的项目pom.xml中出现拼写错误,错误展示如下:
图 4-1 错误显示
properties用于定义属性,不能把modelVersion等包起来,正确的做法如下:
图 4-2 解决方法