Liferay Workspace

Upgrading Code with Liferay Workspace

When moving to a new release of Liferay, your code must move with it. Liferay Workspace has a dedicated Blade/Gradle command to help you migrate your code to an upgraded Liferay release. It updates your code in-place to account for breaking changes in the new Liferay version. While it can’t ensure your code compiles and runs, it can provide

  • Automatic source code migration for projects to a target Liferay version
  • Liferay version-specific code upgrades to account for breaking changes

It takes only two steps to run the tool:

  1. Set your target platform or the workspace’s liferay.workspace.product property to the new version of Liferay. You can retrieve a list of target platform versions with this command:

    blade gw help --task upgradeSourceCode
    
  2. Navigate to your project’s directory and run the task with Blade:

    blade gw upgradeSourceCode
    

    or with Gradle:

    ./gradlew upgradeSourceCode
    

That’s it! The tool analyzes your code for breaking changes and makes the necessary updates.

Note

You can override the target platform property value by specifying the flag --to-version while executing the command.

If you are moving from an older version of Liferay to a Jakarta-based version of Liferay, run this task before running the upgradeJakarta task.