Maven项⽬错误解决⼩结
Maven项⽬错误解决⼩结
注:整理错误,不喜欢为了⼀个⼩问题,占篇幅,所以请Ctrl+F⾃⼰查看,定位问题,愿为解决.
注:⽹络上的错误解决经验,只是作者在特定的条件下发⽣,或者适合你不适合你,请勿责怪,若⽆解决答案,请你请教他⼈或耐⼼解决,可以记录之后分享,我们爱分享,⼀起开始吧!
问题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->Installed JREs->Edit
在Default VM arguments中设置
-Dmaven.multiModuleProjectDirectory=$M2_HOME
问题2:
java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener /org.t.ContextLoaderListener 解决2:
选中项⽬->右键Properties->选择Deployment Assemby->选择Add->选中Java Build Path Entries->Next->选择Maven Dependencies->Finish->Apply->OK
问题3:
The import l.ValidateCodeImg cannot be resolved
解决3:
Eclipse -> Project ->
Ok.
问题4:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'shiroDBRealm' is defined
解决4:
1 <property name="realm"ref="shiroDBRealm" />
2 <bean id="shiroDbRealm"class="com.tsxs.security.ShiroDbRealmUser">
3 </bean>
4配置id和ref的⼤⼩写不⼀致(ctrl+f搜索不区分⼤⼩写⼀致).字母B/b.
问题5:
java project 转换exchange maven project:
[ERROR] Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failure to find
org.apache.maven.plugins:maven-jar-plugin:jar:2.4 in localhost:8081/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] /confluence/display/MAVEN/PluginResolutionException
解决5:
在Convert to Maven Project的时候修改l下:<version>0.0.1-SNAPSHOT</version>到<version>0.0.1</version>后maven clean install.
问题6:
九⽉ 13, 2015 1:20:48 上午 org.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.t.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from file
[D:\developer\softwares\servers\apache-tomcat-8.0.24\webapps\weloveshare\WEB-INF\l];
nested exception is s.internal.impl.io.MalformedByteSequenceException: 3 字节的 UTF-8 序列的字节 3 ⽆效。
Caused by: s.internal.impl.io.MalformedByteSequenceException: 3 字节的 UTF-8 序列的字节 3 ⽆效。
error⽂件
解决6:
最终解决:
1使⽤软件"010 Editor是⼀个全新的⼗六进位⽂件编辑器"查看⽂件头有乱码,删除保存就ok了.
2由于,我,重新整理的分区(双系统),⽆奈下,我重新搭建了⼀个项⽬,复制代码过去就ok了.
问题7:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4或Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin: 2.4..
解决7:
解决:重启⼀下console-nexus.bat就好了,或删除本地maven仓库对应的包(涉及到的根包⼀起删)
问题8:
[ERROR] [Help 1] /confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] /confluence/display/MAVEN/ModelParseException
解决8:
dependency没有在dependencies⾥⾯
问题9:
maven中加⼊新的:dependency在install的时候,报错nexus没有相应的jar包
解决9:
主要删除本地maven的repositories下的相应位置jar的路径,重新install就ok.
如何配置maven环境变量或者重启nexus或没有启动nexus。
问题10:
Java Project转maven project因为出错没有Maven Dependencies路径
解决10:
⼯程右键:Maven->Disable Maven Nature
然后,再次重新转maven:
Configure->Convert to Maven Project. ok!
注:⼀般不⽤重启nexus服务器,除⾮由于进程端⼝占⽤或者服务停⽌,或者服务器关机或者死机,删除本地相对应的路径⽂件,clean install 则解决!
问题11:
设置l后,clean install编译不报错,就是不能加载Maven Dependencies和下载jar包
解决11:
因为<dependency>在<dependencies>中,但<dependencies>⼜在<dependencyManagement>中,删除最外层的<dependencyManagement>后,clean install 则解决!区别解释,备注附件! 
问题12:
如果l中<dependency>标签报错画红线并报红叉,错误:Missing artifact mycoding.kaka:kaka:jar:0.0.1
在Markers中报错:
Description Resource Path Location Type
Missing artifact mycoding.kaka:kaka:jar:0.0.l /zJavaDemo line 20 Maven Dependency Problem
此问题解决,也适合第三⽅⽆依赖jar和本地扩展类加⼊maven统⼀管理
解决12:
1:如果为其他技术⽀持⽹站提供的的正确的依赖<dependency>,则删除本地maven的repositories下的相应位置jar的路径和所有⽂件,再clean install 则解决!
2:
问题13:
Description Resource Path Location Type
Project configuration is not up-to-date l. Run Maven->Update Project or use Quick Fix. we
bproject line 1 Maven Configuration Problem
解决13:
项⽬上右键 ——> Maven ——> Update Project ……,打开⼀个(Update Maven Dependencies)的对话框,然后勾选住出错的项⽬,点击Ok
问题14:
Description Resource Path Location Type
Java compiler level does not match the version of the installed Java project facet. webproject Unknown Faceted Project Problem (Java Version Mismatch)解决14:
workspace下本项⽬的.setting下prefs⽂件(修改和jdk⼀致版本):
eclipse.preferences.version=1
问题15:
[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] 错误: 不到符号
解决15:
项⽬右键 --> properties --> Java Build Path的libraries保证只有:JRE System Library[jdk1.8.0.66]和 Ma
ven Dependencies
注:如果还有Apache Tomcat v8.0[Apache Tomcat v8.0]则,Remove删除它,在l中添加以下依赖让maven统⼀管理!
注:版本看⾃⼰jdk和tomcat版本
<!-- servlet/jsp -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
</dependency>
 需要注意的配置:
问题15扩展:页⾯⽆controller处理跳转也需要15解决!
<!-- 容器默认的DefaultServletHandler处理所有静态内容与⽆RequestMapping处理的URL -->
<mvc:default-servlet-handler />
<!-- 定义⽆需Controller的url<->view直接映射 -->
<mvc:view-controller path="/" view-name="redirect:/index.html" />
问题16:Description Resource Path Location Type
One or more constraints have not been satisfied. webproject line 1 Maven Java EE Configuration Prob
lem 提⽰16:查看项⽬的jdk和compiler和eclipse⼯作空间workspace下项⽬下的个各个⽂件中版本号

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。