What to modify when upgrading Struts?

后端 未结 1 357
灰色年华
灰色年华 2021-01-27 17:18

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 de

相关标签:
1条回答
  • 2021-01-27 18:01

    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>
    

    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.

    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.

    You can't upgrade Struts2 just changing the major version number.


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

    0 讨论(0)
提交回复
热议问题