Maven项目错误解决小结
2017-11-29 11:49
357 查看
问题1:
-Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable and mvn script match.
解决1:
问题2:
java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener /org.springframework.web.context.ContextLoaderListener
解决2:
问题3:
The import com.tsxs.common.tool.ValidateCodeImg cannot be resolved
解决3:
问题4:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'shiroDBRealm' is defined
解决4:
问题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: F
4000
ailure to find org.apache.maven.plugins:maven-jar-plugin:jar:2.4 in http://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] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException 解决5:
问题6:
九月 13, 2015 1:20:48 上午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.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\classes\applicationContext-mybatis.xml];
nested exception is com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 3 字节的 UTF-8 序列的字节 3 无效。
Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 3 字节的 UTF-8 序列的字节 3 无效。
error文件
解决6:
问题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:
问题8:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException 解决8:
问题9:
maven中加入新的:dependency在install的时候,报错nexus没有相应的jar包
解决9:
问题10:
Java Project转maven project因为出错没有Maven Dependencies路径
解决10:
注:一般不用重启nexus服务器,除非由于进程端口占用或者服务停止,或者服务器关机或者死机,删除本地相对应的路径文件,clean install 则解决!
问题11:
设置pom.xml后,clean install编译不报错,就是不能加载Maven Dependencies和下载jar包
解决11:
问题12:
如果pom.xml中<dependency>标签报错画红线并报红叉,错误:Missing artifact mycoding.kaka:kaka:jar:0.0.1
在Markers中报错:
Description Resource Path Location Type
Missing artifact mycoding.kaka:kaka:jar:0.0.1 pom.xml /zJavaDemo line 20 Maven Dependency Problem
此问题解决,也适合第三方无依赖jar和本地扩展类加入maven统一管理
解决12:
1:如果为其他技术支持网站提供的的正确的依赖<dependency>,则删除本地maven的repositories下的相应位置jar的路径和所有文件,再clean install 则解决!
2:Maven自定义上传第三方包到3rd party(第三方无依赖jar和本地扩展类加入maven统一管理)
问题13:
Description Resource Path Location Type
Project configuration is not up-to-date with pom.xml. Run Maven->Update Project or use Quick Fix. webproject line 1 Maven Configuration Problem
[b]解决13:[/b]
问题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:
问题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:
需要注意的配置:
问题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 Problem
提示16:查看项目的jdk和compiler和eclipse工作空间workspace下项目下的个各个文件中版本号
提示17:有时候从网上导入别人的maven项目后,无法添加Maven Dependencies到Libraries下,其实只需要在.classpath文件中加入如下代码就好了.
[html]
view plain
copy
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
然后重新配置下项目,就好了。
问题18:only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT se……
解决18:删除本地库中所有文件,重新clean install.
备注附件(解释学习自网络资料,非常感谢作者):
[plain]
view plain
copy
dependencyManagement:
Maven 使用dependencyManagement 元素来提供了一种管理依赖版本号的方式。通常会在一个组织或者项目的最顶层的父POM 中看到dependencyManagement 元素。使用pom.xml 中的dependencyManagement 元素能让所有在子项目中引用一个依赖而不用显式的列出版本号。Maven 会沿着父子层次向上走,直到找到一个拥有dependencyManagement 元素的项目,然后它就会使用在这个dependencyManagement 元素中指定的版本号。
如果有多个子项目都引用同一样依赖,则可以避免在每个使用的子项目里都声明一个版本号,这样当想升级或切换到另一个版本时,只需要在顶层父容器里更新,而不需要一个一个子项目的修改 ;另外如果某个子项目需要另外的一个版本,只需要声明version就可。
dependencyManagement里只是声明依赖,并不实现引入,因此子项目需要显式的声明需要用的依赖。
dependencies:
相对于dependencyManagement,所有声明在dependencies里的依赖都会自动引入,并默认被所有的子项目继承。如果你要发布同样的代码,但是由于技术原因需要生成两个单独的构件,你就要使用一个分类器(classifier)。
classifier:
如果你要发布同样的代码,但是由于技术原因需要生成两个单独的构件,你就要使用一个分类器(classifier)。
例如,如果你想要构建两个单独的构件成JAR,一个使用Java 1.4 编译器,另一个使用Java 6 编译器,你就可以使用分类器来生成两个单独的JAR构件,它们有同样的groupId:artifactId:version组合。
如果你的项目使用本地扩展类库,你可以使用分类器为每一个目标平台生成一个构件。分类器常用于打包构件的源码,JavaDoc 或者二进制集合。
-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.springframework.web.context.ContextLoaderListener
解决2:
问题3:
The import com.tsxs.common.tool.ValidateCodeImg cannot be resolved
解决3:
问题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: F
4000
ailure to find org.apache.maven.plugins:maven-jar-plugin:jar:2.4 in http://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] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException 解决5:
在Convert to Maven Project的时候修改pom.xml下:<version>0.0.1-SNAPSHOT</version>到<version>0.0.1</version>后maven clean install.
问题6:
九月 13, 2015 1:20:48 上午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.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\classes\applicationContext-mybatis.xml];
nested exception is com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 3 字节的 UTF-8 序列的字节 3 无效。
Caused by: com.sun.org.apache.xerces.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] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException 解决8:
dependency没有在dependencies里面
问题9:
maven中加入新的:dependency在install的时候,报错nexus没有相应的jar包
解决9:
主要删除本地maven的repositories下的相应位置jar的路径,重新install就ok. 或者重启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:
设置pom.xml后,clean install编译不报错,就是不能加载Maven Dependencies和下载jar包
解决11:
问题12:
如果pom.xml中<dependency>标签报错画红线并报红叉,错误:Missing artifact mycoding.kaka:kaka:jar:0.0.1
在Markers中报错:
Description Resource Path Location Type
Missing artifact mycoding.kaka:kaka:jar:0.0.1 pom.xml /zJavaDemo line 20 Maven Dependency Problem
此问题解决,也适合第三方无依赖jar和本地扩展类加入maven统一管理
解决12:
1:如果为其他技术支持网站提供的的正确的依赖<dependency>,则删除本地maven的repositories下的相应位置jar的路径和所有文件,再clean install 则解决!
2:Maven自定义上传第三方包到3rd party(第三方无依赖jar和本地扩展类加入maven统一管理)
问题13:
Description Resource Path Location Type
Project configuration is not up-to-date with pom.xml. Run Maven->Update Project or use Quick Fix. webproject line 1 Maven Configuration Problem
[b]解决13:[/b]
项目上右键 ——> 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下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:
[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:
问题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 Problem
提示16:查看项目的jdk和compiler和eclipse工作空间workspace下项目下的个各个文件中版本号
提示17:有时候从网上导入别人的maven项目后,无法添加Maven Dependencies到Libraries下,其实只需要在.classpath文件中加入如下代码就好了.
[html]
view plain
copy
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
然后重新配置下项目,就好了。
问题18:only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT se……
解决18:删除本地库中所有文件,重新clean install.
备注附件(解释学习自网络资料,非常感谢作者):
[plain]
view plain
copy
dependencyManagement:
Maven 使用dependencyManagement 元素来提供了一种管理依赖版本号的方式。通常会在一个组织或者项目的最顶层的父POM 中看到dependencyManagement 元素。使用pom.xml 中的dependencyManagement 元素能让所有在子项目中引用一个依赖而不用显式的列出版本号。Maven 会沿着父子层次向上走,直到找到一个拥有dependencyManagement 元素的项目,然后它就会使用在这个dependencyManagement 元素中指定的版本号。
如果有多个子项目都引用同一样依赖,则可以避免在每个使用的子项目里都声明一个版本号,这样当想升级或切换到另一个版本时,只需要在顶层父容器里更新,而不需要一个一个子项目的修改 ;另外如果某个子项目需要另外的一个版本,只需要声明version就可。
dependencyManagement里只是声明依赖,并不实现引入,因此子项目需要显式的声明需要用的依赖。
dependencies:
相对于dependencyManagement,所有声明在dependencies里的依赖都会自动引入,并默认被所有的子项目继承。如果你要发布同样的代码,但是由于技术原因需要生成两个单独的构件,你就要使用一个分类器(classifier)。
classifier:
如果你要发布同样的代码,但是由于技术原因需要生成两个单独的构件,你就要使用一个分类器(classifier)。
例如,如果你想要构建两个单独的构件成JAR,一个使用Java 1.4 编译器,另一个使用Java 6 编译器,你就可以使用分类器来生成两个单独的JAR构件,它们有同样的groupId:artifactId:version组合。
如果你的项目使用本地扩展类库,你可以使用分类器为每一个目标平台生成一个构件。分类器常用于打包构件的源码,JavaDoc 或者二进制集合。
相关文章推荐
- Maven项目错误解决小结
- Maven项目错误解决小结
- Maven项目错误解决小结
- Maven项目错误解决小结
- Maven项目错误解决小结
- Maven项目错误解决小结
- 【转载】----Maven项目错误解决小结
- Maven项目错误解决小结
- Maven项目错误解决小结
- Maven项目错误解决小结
- MyEclipse重新导入Maven项目后启动服务器报java.lang.ClassNotFoundException错误解决办法
- Maven项目中 “错误: 找不到或无法加载主类" 的解决办法
- MAVEN项目错误:Missing artifact com.sun:tools:jar 1.5.0解决方法
- Maven 项目关于 plexus-utils:jar的错误解决
- 解决maven项目install之后报出Perhaps you are running on a JRE rather than a JDK?错误
- 在eclipse中创建maven项目错误的解决方法:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-qu
- 修改maven 的默认jdk版本解决导入maven 项目出现错误
- neo2 装完maven 3.5后新建项目报org.apache.maven.plugin.war.WarMojo错误解决办法
- maven项目中 “ 错误: 找不到或无法加载主类" 的解决办法
- 解决eclipse的maven项目无法引用到maven库的错误--mac