maven和tomcat发布失败出现notfindclass的解决方法
2015-01-31 09:48
399 查看
由于Maven项目通过pom文件自动管理依赖,所以在WEB-INF/lib下不会有任何的jar包文件,需要修改项目配置文件.project和classpath配置文件.clsspath文件。
打开.project文件先在buildSpecs下面加入两个节点。 <buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
在natures节点下面加入
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
最后修改.classpath文件(这个文件在工程的根目录下面),加入:
<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>重新发布到tomcat即可。
打开.project文件先在buildSpecs下面加入两个节点。 <buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
在natures节点下面加入
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
最后修改.classpath文件(这个文件在工程的根目录下面),加入:
<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>重新发布到tomcat即可。
相关文章推荐
- maven项目,多个依赖,打成一个可执行jar包,可根据profiles进行打包,出现的Could not find or load main class的解决方法。
- 双击jar包出现:could not find the main class .和could not create the java virtual machine.win7/xp解决方法详解
- 双击jar包出现:could not find the main class .和could not create the java virtual machine.win7/xp解决方法详解
- maven工程发布到tomcat下启动报ClassNotFoundException的异常的解决办法
- 在centos中运行java命令时出现Error: Could not find or load main class XXX问题的解决方法
- 安装MyEclipse时,双击安装包后出现“could not find main class”的错误提示的解决方法
- 运行jar文件时,出现“could not find the main class”的解决方法
- 【解决】Maven myeclipse出现Could not find the main class
- 双击jar包出现:could not find the main class .和could not create the java virtual machine.win7/xp解决方法详解
- 双击jar包出现:could not find the main class .和could not create the java virtual machine.win7/xp解决方法详解
- 解决Win7/XP中双击jar文件出现could not find the main class的方法
- 解决maven工程中出现The project was not built since its build path is incomplete. Cannot find the class file
- 关于eclipse 运行了 maven install后 在tomcat中启动web项目出现classnofind的异常解决方法
- 安装mysql出现Could NOT find Curses (missing CURSES_LIBRARY CURSES_INCLUDE_PATH),提示解决方法
- linux升级内核,出现:mount:could not find filesystem‘/dev/root’的解决方法
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法 .
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法
- 关于TOMCAT6+COMET出现405 Method Not Allowed错误解决方法
- Myeclipse(Tomcat)发布工程出现java.io.EOFException异常的原因和解决方法