我有一战(使用Struts 1.x jars构建),已部署在服务器上,但没有相应的源代码,因此我基本上从jar中提取了.class文件,并将其反编译并尝试构建源代码代码(项目)并提交到存储库。
因此,我想使用 Ant工具创建 Struts 1.x 项目,将其导入Eclipse IDE ,然后产生 war 。
我尝试了以下方法:
1.创建一个动态Web项目并添加struts jars
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 build进行 war 。
这是使用 Ant 工具发动 war 的正确方法吗?还是有其他方法吗?
最佳答案
您需要创建用于构建 war 文件的目标:
看到这个链接ojita
有关如何创建构建 war 文件的目标。
关于java - 使用Ant和Eclipse创建Struts 1.X项目,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31252944/