简体   繁体   English

使用Ant和Eclipse创建Struts 1.X项目

[英]Create Struts 1.X project using Ant and Eclipse

I have a war(built using Struts 1.x jars) which has been deployed on server but do not have the corresponding source code so I have basically extracted the .class files from the jar and de-compiled them and trying to build the source code(project) and commit to repository. 我有一个战争(使用Struts 1.x jar构建)已部署在服务器上,但没有相应的源代码,因此我基本上从jar中提取了.class文件并对其进行了解编译并尝试构建源代码代码(项目)并提交到存储库。

So, I want to create a Struts 1.x project using Ant tool, import it into Eclipse IDE and then generate a war. 所以,我想使用Ant工具创建一个Struts 1.x项目,将其导入Eclipse IDE然后生成一个war。

I tried the following: 我尝试了以下方法:

1. Created a dynamic web project & added struts jars 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. Created an Ant build file for existing project 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. Run Ant build to build a war. 3.运行Ant build来构建战争。

Is this the correct way of building war using ant tool? 这是使用蚂蚁工具建立战争的正确方法吗? Or is there any other way? 或者还有其他方法吗?

You need to create Target for bulding war file: 您需要为建筑物战争文件创建目标:

see this link http://www.tutorialspoint.com/ant/ant_creating_war_files.htm 请参阅此链接http://www.tutorialspoint.com/ant/ant_creating_war_files.htm

for how to create target for building war file. 如何创建构建war文件的目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM