This is a Python 3 application designed to facilitate the migration of Struts 2 source code by refactoring CSS class names and JSP property classes. It handles Java Action classes and Java objects that map with JSP properties.
- Python 3.6 or higher
- Tkinter (usually included with Python)
- Required Python packages:
pip install tkinter
- Clone or download the repository
- Ensure Python 3 is installed
- Place the
struts_migrator.pyandrules_example.jsonin your working directory
-
Run the application:
python struts_migrator.py
-
Use the GUI to:
- Select the Struts 2 project folder
- Select the rules JSON file
- Click "Start Migration" to begin the refactoring process
-
The application will:
- Create a backup of the project folder
- Process all JSP and Java files
- Apply refactoring rules
- Display progress and status messages
The rules file must be in JSON format. See rules_example.json for an example:
{
"css_class_name_changes": {
"oldClassName": "newClassName",
"anotherOldClass": "anotherNewClass"
},
"jsp_property_changes": {
"oldProperty": "newProperty",
"oldAction": "newAction"
}
}- Intuitive GUI with file selection and progress monitoring
- Automatic backup of original files
- Error handling for invalid paths and parsing issues
- Logging of operations and errors
- Support for CSS class name refactoring
- Support for JSP property and Java Action class refactoring
- Always verify the backup before proceeding with migration
- Test the rules file with a small project first
- The application creates a timestamped backup folder
- Check the status window for detailed processing information
- Ensure all paths are valid
- Verify the rules file is properly formatted JSON
- Check the console for detailed error messages