Ant脚本不编译war文件中的spring类文件

时间:2012-01-02 09:47:46

标签: java ant

我正在使用Ant脚本生成一个ear文件。我看到该脚本完美地编译了java类文件但是当我检查生成的war文件中的类文件时,它们显示如下错误,因为我无法将ear部署到服务器

 public TransportationController()
{
    throw new Error("Unresolved compilation problems: \n\tThe import org.springframework cannot be re" +"solved\n\tThe import org.springframework cannot be resolved\n\tThe import org.sp" +"ringframework cannot be resolved\n\tThe import org.springframework cannot be res" +"olved\n\tThe import org.springframework cannot be resolved\n\tThe import org.spr" +"ingframework cannot be resolved\n\tThe import org.springframework cannot be reso" +"lved\n\tThe import com.pepsico.us.sc.updateprocessflagob cannot be resolved\n\tC" 
);
}

我的生成战争的Ant脚本如下:

 <target name="do.package" depends="common.do.package">
 <war webxml="WebContent/WEB-INF/web.xml"
  warfile="${output.dir}/sn-ecr-web.war"
  manifest="WebContent/META-INF/MANIFEST.MF">
 <zipfileset dir="WebContent"/>
 <zipfileset dir="${output.dir}" includes="**/*.jar" prefix="WEB-INF/lib"/>
 </war>
 <delete dir="${output.dir}" includes="**/*.jar"/>
 </target>

1 个答案:

答案 0 :(得分:1)

这意味着您已使用Eclipse编译器编译自己的类,并且某些类未编译(由于编译类路径中缺少Spring jar)。 Eclipse为非编译类文件生成类文件,但是方法抛出错误而不是包含实际代码(因为它不能编译)。

修复编译问题,并重新生成罐子。