从svn中check out maven项目 所遇到的一系列问题:

来源:互联网 发布:openwrt端口转发 编辑:程序博客网 时间:2024/04/30 09:26

1、maven项目从svn导出后,不是maven结构:

右键项目-->configure--->convert  to maven project 

2、maven项目check out后,java文件是空心J,不是实心:

原因: 
eclipse认为检出内容为资源文件,而不是项目。 
解决办法: 
编辑项目下的.project文件, 
(1)在<buildCommand>中加<name>org.eclipse.jdt.core.javabuilder</name> 
(2)<natures>中加<nature>org.eclipse.jdt.core.javanature</nature> 

3、tomcat中不能识别刚检出的web项目:

右键项目--->config->convert to fat project


右键项目--->config->convert to plug_in

4、pom文件总是有错误提示,红‘X’号,提示有错误。

setting.xml文件是否配置正确。(E:\apache-maven-3.3.1\conf\setting.xml)

查看setting.xml的路径:windows-->properties-->maven-->user settings -->看右半部分内容。

5、新导出的项目总没有Maven Dependencies 和JRE System Library :

右键项目---》properties---》Deployment Assembly --->add --->maven Dependencies

后来再上网搜索,找到了解决办法:

找自己出错项目的.classpath文件,打开,ctrl+f,找是否有以下文件,如果没有在末尾加进去,再refresh项目即可:

<span style="font-size:14px;"><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></span>

添加后我的.classpath文件是这样的:

<span style="font-size:14px;"><?xml version="1.0" encoding="UTF-8"?><classpath><classpathentry kind="src" path="src/main/java"/><classpathentry kind="src" path="src/main/resources"/><classpathentry kind="src" path="src/extend/java"/><classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"><attributes><attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/></attributes></classpathentry><classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/><classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0 (2)"><attributes><attribute name="owner.project.facets" value="jst.web"/></attributes></classpathentry><classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"><attributes><attribute name="owner.project.facets" value="java"/></attributes></classpathentry><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><classpathentry kind="output" path="build/classes"/></classpath></span>

右键项目---》build path -->configre build path --->右面窗口Libraries -->add Library--->jar system library 

6、在tomcat中启动maven项目,提示找不到类:严重: Error configuring application listener of class org.springframework.web.context.request.RequestContextListener
java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener

(1)普通的web项目:http://www.cnblogs.com/zhouyalei/archive/2011/11/30/2268606.html

(2)maven项目:http://www.yihaomen.com/article/java/471.htm

右键项目---》properties-->Deployment Assembly --->

1、右键单击工程项目 ->点击 properties
2. 选择 Deployment Assembly
3. 点击 Add -> Java Build Path Entries -> Next
4. 选择 Maven Dependencies -> Finish -> Apply -> OK
5. Clean project and server. 重启server

8、新建出的项目转换成maven项目后,目录结构不是标准的maven项目:




选中项目,在右上角”倒三角“的地方,Package Presentation --->Hierarchical,此时目录显示为标准包结构。


0 0
原创粉丝点击