将 Struts 从 2.0 升级到 2.5 时需要修改什么? [英] What to modify when upgrading Struts from 2.0 to 2.5?

查看:41
本文介绍了将 Struts 从 2.0 升级到 2.5 时需要修改什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 Struts 在 Eclipse 上运行的大项目,我想将 Struts 从 2.0.11.1 升级到 2.5.3.

I have a big project running on Eclipse that uses Struts, I want to upgrade Struts from 2.0.11.1 to 2.5.3.

但是,我查看了迁移指南,但没有详细说明应该删除、更新、添加什么等信息.

However, I checked the Migration Guide but there was no info detailing what should really be removed, updated, added, etc..

我下载了struts 2.5.3,里面有很多库、插件、源文件等.

I downloaded struts 2.5.3 and there are a lot of libraries, plugins, source files, etc..

我的问题是我可以直接将 Struts 从 2.0.11.1 升级到 2.5.3 吗?如果是,那么应该改变什么以及如何做到这一点?如果没有,请提出解决方案.

My question is that can I upgrade Struts from 2.0.11.1 to 2.5.3 directly? If yes, then what should be changed and how will this be done? If no, kindly propose a solution.

推荐答案

当你升级Struts2的版本时,你必须将你的应用程序需要的库更新到目标版本.每个 Struts2 版本都在 lib 文件夹中提供了与 Struts 版本兼容的相应库集.如果您使用 maven 来解析和获取依赖项,您应该考虑工件 struts2-core.

When you upgrade the version of Struts2, you have to update the libraries requires by your application to the target version. Each Struts2 release is supplied with the corresponding set of libraries in the lib folder that are compatible with the version of Struts. If you use maven to resolve and fetch the dependencies you should consider the artifact struts2-core.

<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>2.5.3</version>
</dependency>


它将获取此工件所需的所有依赖项,其他依赖项,例如您需要单独添加的插件.使用针对插件的相同版本.例如添加约定插件使用


It will fetch all required dependencies for this artifact, other dependencies, such as plugins you need to add separately. Use the same version targeted to plugins. For example to add a convention plugin use

<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-convention-plugin</artifactId>
    <version>2.5.3</version>
</dependency>


目标版本号是 2.5.3,但它可能与其他功能不兼容,即 Hibernate 和 Spring,哪些版本需要通过将相应的工件添加到依赖项来单独升级.


The targeted version number is 2.5.3, but it's possibly incompatible with the other features i.e. Hibernate and Spring which versions need to upgrade separately by adding corresponding artifacts to the dependencies.

最后也是最耗时的是对项目源代码的更改、根据较新的 DTD 更新配置文件、API 更改、修复弃用.为此,请考虑阅读发行说明.

And finally and most time consuming are changes to the source code of the project, update the configuration files according to newer DTDs, API changes, fix deprecations. For this purpose consider reading the release notes.

您不能只更改主版本号就升级 Struts2.

另见开发maven项目的例子:使用 Maven 创建 Struts 2 Web 应用程序来管理工件并构建应用程序.

Also see the example of developing a maven project: Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Application.

这篇关于将 Struts 从 2.0 升级到 2.5 时需要修改什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆