eclipse maven项目运行时报错could not find the main class的解决办法

打开.project文件,从其他可以有运行main的地方copy一个maven的builder过来,补上就好了。

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>xxx</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.m2e.core.maven2Builder</name>
			<arguments>
			</arguments>
		</buildCommand>
...

 原因猜测:ecilpse的工程运行main的时候需要builder去提供类路径吧,然后没有builder相当于classpath少了一部分,纯属猜测

猜你喜欢

转载自floydd.iteye.com/blog/2372433