Mastering Liferay Workspaces and Tooling

Course Overview

Configuring Clarity's Workspaces

Liferay Workspace offers extensive configuration options. As Clarity's team prepares for upcoming development initiatives, they want to fine-tune their workspace and ensure it aligns with their project requirements. In these exercises, you'll gain hands-on experience modifying workspace configurations using Liferay Developer Studio.

Exercise: Upgrading the Liferay Workspace Version

In a previous exercise, you created the clarity-lds-workspace project based on the dxp-2023.q3.9 Liferay version. By default, this uses the 10.1.7 workspace version. Clarity wants to update the project’s workspace. Here' you’ll update the workspace’s version.

  1. In Liferay Developer Studio, open the settings.gradle file.

  2. Note the version for the com.liferay.gradle.plugins.workspace dependency (i.e., 10.1.7).
    In Liferay Developer Studio, note the version for the com.liferay.gradle.plugins.workspace dependency.

  3. Change the value to 12.1.0 and save the file.

  4. Click the Search button in the top right corner, search Terminal and select Open Local Terminal on Selection.
    This opens a terminal window in the workspace’s root folder (i.e., clarity-lds-workspace).

  5. In the terminal window, run this command:

    blade gw tasks
    
  6. Verify the build is successful.
    After running blade gw tasks, verify that the build is successful.

Once complete, the workspace has been updated.

Exercise: Configuring Portal Properties

During development, Clarity's team plans to test features with various users with different roles. By default, Liferay requires users to change their password upon initial login and verify their email address. To reduce manual configurations, Clarity wants to disable these requirements for local development. They also want to change the document library’s max file size and enable JQuery.

  1. In Liferay Developer Studio, open the configs/local/portal-ext.properties file.

  2. Add this property to the file to disable additional email verification:

    company.security.strangers.verify=false 
    
  3. Add these properties to the file to disable password from being changed upon initial login:

    passwords.default.policy.name=Custom Password Policy
    passwords.default.policy.change.required=false
    
  4. Add this property to change the document library’s max file size:

    dl.file.max.size=10485760
    

    This sets the limit to 10mb.

  5. Save the file.
    Add the new properties to portal-ext.properties file and save it.Now when you initialize and start the local bundle, you’re not required to verify emails or reset passwords.

  6. Within the /configs/commonfolder, create this folder structure: osgi/configs.

  7. Add a file to the /configs/common/osgi/configs folder with this name

    com.liferay.frontend.js.jquery.web.internal.configuration.JSJQueryConfiguration.config
    
  8. Open this file and add enableJQuery=B"true".
    Add a new file to the configs folder and add the enableJQuery=B"true" property to it.

  9. Save the file.

  10. Run this command to initialize the Liferay local bundle:

    blade server init
    
  11. Once finished, open the bundles/portal-ext.properties file and verify it includes the properties from the configs/local/portal-ext.properties file.
    Open the bundles/portal-ext.properties file and verify it includes the properties from the configs/local/portal-ext.properties file.Note: If the build is successful and the bundles folder does not appear, open the File drop-down menu and click Refresh.

  12. Verify the bundles/osgi/configs folder includes your JQuery configuration file.
    Verify the bundles/osgi/configs folder includes your JQuery configuration file.

  13. Open the configs/prod/portal-ext.properties file.

  14. Add this property:

    dl.file.max.size=52428800
    

    This increases the max file size to 50mb for your production environment.

  15. Save the file.

  16. Open the gradle.properties file and add this property:

    liferay.workspace.environment=prod
    

    This configures Gradle tasks to target the production environment.

  17. Save the file.
    Add the new property to configure Gradle tasks to target the production environment.

  18. Remove the bundles directory.

  19. Run this command to initialize the Liferay local bundle:  

    blade server init
    
  20. Once finished, open the bundles/portal-ext.properties file and verify it includes the properties from the configs/prod/portal-ext.properties file.

  21. Remove the bundles directory again.

  22. Run this command to target different environments on the fly:

    ./gradlew initBundle -Pliferay.workspace.environment=local
    
  23. Once finished, open the bundles/portal-ext.properties file and verify it includes the properties from the configs/local/portal-ext.properties file.

If files in the common folder and an environment-specific folder share the same name, the environment-specific version takes precedence. For example, if a portal-ext.properties file exists in both configs/common and an environment-specific folder (e.g., configs/prod), the version in the environment-specific folder is used.

Conclusion

Great! You’ve configured upgraded Clarity’s workspace and applied custom portal and Gradle properties. Next, you’ll review what you’ve learned before moving on to the next module.

  • Exercise: Upgrading the Liferay Workspace Version

  • Exercise: Configuring Portal Properties

  • Conclusion

Loading Knowledge

Capabilities

Product

Education

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy