gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 15:37:11 26 4
gpt4 key购买 nike

我正在使用 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"
);
}

我的生成 war 的 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>

最佳答案

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

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

关于java - Ant脚本不编译war文件中的spring类文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8699387/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com