【问题标题】:Create Struts 1.X project using Ant and Eclipse使用 Ant 和 Eclipse 创建 Struts 1.X 项目
【发布时间】:2015-07-06 18:20:53
【问题描述】:

我有一个战争(使用 Struts 1.x jars 构建)已部署在服务器上但没有相应的源代码,所以我基本上已经从 jar 中提取了 .class 文件并对其进行反编译并尝试构建源代码(项目)并提交到存储库。

所以,我想使用 Ant 工具创建一个 Struts 1.x 项目,将其导入 Eclipse IDE,然后生成一个战争。

我尝试了以下方法:

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 来构建战争。

这是使用ant工具构建战争的正确方法吗?或者有没有其他办法?

【问题讨论】:

  • 我尝试了以下步骤 1) 创建了一个动态 Web 项目并添加了 struts jar 2) 为现有项目创建了一个 ant 构建文件 3) 运行 ant build 来构建一个战争。
  • 我没有遇到任何问题。我想知道如何使用 ANT 工具创建一个 struts 项目。我是 ANT 工具的新手(在 maven 中,我们指定 struts-archetype 来构建项目,它会创建整个项目结构并下载所需的 jars)。那么,如何使用ant工具创建一个struts项目呢?
  • 您必须向我们展示您的尝试。有了这些信息,我什至不能给你写一个 Ant build.xml 文件本身。根本没有足够的信息。 Ant 是一个复杂的软件。整本书都写在上面。我无法在单个 StackOverflow 答案中为您提供完整的教程。转到Ant 页面并尝试教程。读几本关于Ant 的书。尝试一些事情,然后问一些更具体的问题。
  • Struts 1.3.x 已被正式废弃多年。并且您正在使用 Struts 1.0 开始一个新项目?为什么?
  • 我有一个战争(使用 Struts 1.x jars 构建)已部署在生产服务器上但没有相应的源代码,所以我基本上已经从 jar 和 de -编译它们并尝试构建源代码(项目)并提交到存储库

标签: java ant struts-1


【解决方案1】:

您需要为构建war文件创建Target:

查看此链接http://www.tutorialspoint.com/ant/ant_creating_war_files.htm

关于如何创建构建war文件的目标。

【讨论】:

    猜你喜欢
    • 2011-07-28
    • 1970-01-01
    • 2013-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-20
    • 2012-07-10
    相关资源
    最近更新 更多