Maven项目错误解决小结

问题1:

-Dmaven.multiModuleProjectDirectory system propery is not set.Check $M2_HOME environment variable and mvn script match.

解决1:

可以设一个windows os's环境变量M2_HOME指向你的maven安装目录

M2_HOME=D:\Apps\apache-maven-3.3.1

然后在Window->Preference->Java->InstalledJREs->Edit

在Default VM arguments中设置

-Dmaven.multiModuleProjectDirectory=$M2_HOME


问题2:

java.lang.ClassNotFoundException:org.springframework.web.util.IntrospectorCleanupListener/org.springframework.web.context.ContextLoaderListener

解决2:

选中项目->右键Properties->选择DeploymentAssemby->选择Add->选中Java Build PathEntries->Next->选择MavenDependencies->Finish->Apply->OK。


问题3:

The import com.tsxs.common.tool.ValidateCodeImg cannot beresolved

解决3:

Eclipse -> Project -> Clean

Ok.

问题4:

Caused by:org.springframework.beans.factory.NoSuchBeanDefinitionException: Nobean named 'shiroDBRealm' is defined

解决4:

配置id和ref的大小写不一致(ctrl+f搜索不区分大小写一致),字母B/b。


问题5:

java project 转换exchange maven project:

[ERROR] Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 orone of its dependencies could not be resolved: Failure to findorg.apache.maven.plugins:maven-jar-plugin:jar:2.4 in//localhost:8081/nexus/content/groups/public was cached in thelocal repository, resolution will not be reattempted until theupdate interval of nexus has elapsed or updates are forced ->[Help 1]

[ERROR] 

[ERROR] To see the full stack trace of the errors, re-run Mavenwith the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debuglogging.

[ERROR] 

[ERROR] For more information about the errors and possiblesolutions, please read the following articles:

[ERROR] [Help 1]//cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

解决5:

在Convert to MavenProject的时候修改pom.xml下:0.0.1-SNAPSHOT到0.0.1后maven cleaninstall。


问题6:

[ERROR] Failed to execute goalorg.apache.maven.plugins:maven-surefire-plugin:2.12.4或Failed toexecute goal org.apache.maven.plugins:maven-compiler-plugin:2.4..

解决6:

解决:重启一下console-nexus.bat就好了,或删除本地maven仓库对应的包(涉及到的根包一起删)。


问题7:

[ERROR] [Help 1]//cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

[ERROR] [Help 2]//cwiki.apache.org/confluence/display/MAVEN/ModelParseException

解决7:

dependency没有在dependencies里面。


问题8:

maven中加入新的:dependency在install的时候,报错nexus没有相应的jar包。

解决8:

主要删除本地maven的repositories下的相应位置jar的路径,重新install就ok.

或者重启nexus或没有启动nexus。


问题9:

Java Project转maven project因为出错没有Maven Dependencies路径。

解决9

工程右键:Maven->Disable Maven Nature

然后,再次重新转maven:

Configure->Convert to Maven Project. ok!

注:一般不用重启nexus服务器,除非由于进程端口占用或者服务停止,或者服务器关机或者死机,删除本地相对应的路径文件,cleaninstall 则解决!


问题10:

设置pom.xml后,clean install编译不报错,就是不能加载MavenDependencies和下载jar包。

解决10:

​因为在中,但又在中,删除最外层的后,clean install 则解决!区别解释,备注附件!


问题11:

Description Resource Path Location Type

One or more constraints have not been satisfied. webproject line1 Maven Java EE Configuration Problem

提示11:查看项目的jdk和compiler和eclipse工作空间workspace下项目下的个各个文件中版本号。


问题12:

only whitespace content allowed before starttag and not \u0 (position: START_DOCUMENT se……

解决1:删除本地库中所有文件,重新clean install。


问题13:

[ERROR]D:\DeveloperX\Code\Java\src\main\java\com\tsxs\module\utils\NetworkUtil.java:[3,25]错误: 程序包javax.servlet.http不存在

[ERROR]D:\DeveloperX\Code\Java\src\main\java\com\tsxs\module\utils\NetworkUtil.java:[14,41]错误: 找不到符号

解决13:

​项目右键 --> properties --> Java Build Path的libraries保证只有:JRESystem Library[jdk1.8.0.66]和 MavenDependencies 

注:如果还有Apache Tomcat v8.0[Apache Tomcatv8.0]则,Remove删除它,在pom.xml中添加以下依赖让maven统一管理!

注:版本看自己jdk和tomcat版本

javax.servlet

javax.servlet-api

3.1.0

javax.servlet.jsp

jsp-api

2.2


问题14:

Description Resource Path Location Type

Java compiler level does not match the version of the installedJava project facet. webproject Unknown Faceted Project Problem(Java Version Mismatch)

解决14:

workspace下本项目的.setting下org.eclipse.jdt.core.prefs文件(修改和jdk一致版本):

eclipse.preferences.version=1

org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled

org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8

org.eclipse.jdt.core.compiler.compliance=1.8

org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

org.eclipse.jdt.core.compiler.problem.enumIdentifier=error

org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning

org.eclipse.jdt.core.compiler.source=1.8


问题15:

Description Resource Path Location Type

Project configuration is not up-to-date with pom.xml. RunMaven->Update Project or use Quick Fix. webproject line 1 MavenConfiguration Problem

解决15:

项目上右键 ——> Maven ——> Update Project ……,打开一个(UpdateMaven Dependencies)的对话框,然后勾选住出错的项目,点击Ok。


问题16:

如果pom.xml中标签报错画红线并报红叉,错误:Missing artifactmycoding.kaka:kaka:jar:0.0.1

在Markers中报错:

Description Resource Path Location Type

Missing artifact mycoding.kaka:kaka:jar:0.0.1 pom.xml /zJavaDemoline 20 Maven Dependency Problem

此问题解决,也适合第三方无依赖jar和本地扩展类加入maven统一管理。

解决16:

1:如果为其他技术支持网站提供的的正确的依赖,则删除本地maven的repositories下的相应位置jar的路径和所有文件,再cleaninstall 则解决!

2:Maven自定义上传第三方包到3rd party(第三方无依赖jar和本地扩展类加入maven统一管理)。

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值