我有一个 war(使用 Struts 1.x jar 构建)已经部署在服务器上但没有相应的源代码所以我基本上从 jar 中提取了 .class 文件并反编译它们并尝试构建源代码(项目)并提交到存储库。
所以,我想用Ant工具创建一个Struts 1.x项目,导入Eclipse IDE,然后生成war。
我尝试了以下方法:
<强>1。创建了一个动态 web 项目并添加了 struts jar
New -> Other -> Web - >Dynamic Web Project
Updated web.xml & created struts-config.xml under WEB-INF
Then struts jars were added to build path
<强>2。为现有项目创建了一个 Ant 构建文件
Select File > Export from main menu<br/>
In the Export dialog, select General > Ant Buildfilesas follows:
Click Next. In the Generate Ant Buildfilesscreen:
Check the project in list.
Uncheck the option "Create target to compile project using Eclipse compiler" because we want to create a build file which is independent of Eclipse.
Leave the Name for Ant buildfile as default: build.xml
Click Finish, Eclipse will generate the build.xmlfile
<强>3。运行 Ant 构建以构建 war 。
这是使用 Ant 工具构建 war 的正确方法吗?还是有其他办法?
最佳答案
您需要为构建 war 文件创建 Target:
请参阅此链接 http://www.tutorialspoint.com/ant/ant_creating_war_files.htm
关于如何创建构建 war 文件的目标。
关于java - 使用 Ant 和 Eclipse 创建 Struts 1.X 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31252944/