Mastering Liferay Workspaces and Tooling

Course Overview

Configuring Clarity's Local Developer Environment

As demonstrated in the previous exercise, the blade server init command initializes a local Liferay server within a Liferay workspace. While most of the default configurations suite Clarity's needs, they want to experiment with customizing some aspects of their local bundle setup to better match their development workflow. In these exercises, you’ll configure the Liferay bundle you created in the previous exercise.

Exercise: Setting a Bundle Location

The liferay.workspace.home.dir property determines where the local Liferay bundle is initialized. You can modify this setting to achieve the desired directory structure. Here, you'll modify this setting for Clarity's workspace.

  1. Go to the workspace’s root folder and open the gradle.properties file.
  2. Add this property and save the file:

    liferay.workspace.home.dir=liferay-runtime
    
  3. Open a terminal window and navigate to the workspace’s root folder.
  4. Run this command:

    blade server init
    This initializes a second Liferay server called liferay-runtime.
  5. Verify the liferay-runtime folder appears in the workspace’s root folder.

Exercise: Setting a Bundle Cache Location

The liferay.workspace.bundle.cache.dir property determines where downloaded Liferay bundle archives are cached. Managing the cache location can be helpful for optimizing disk space usage or complying with specific security policies. Here, you'll configure the cache directory for Clarity's workspace.

  1. Remove both the bundles folders:

    For Mac/Linux:

    rm -rf bundles

    For Windows:

    rmdir /s /q bundles
  2. Repeat the above step to remove the liferay-runtime folder.
  3. Get the COMPLETE path to the root of your workspace (e.g. /Users/me/projects/clarity-liferay-workspace or C:\projects\clarity-liferay-workspace)
  4. Open the workspace’s gradle.properties file.
  5. Add this property and save the file:

    liferay.workspace.bundle.cache.dir=[full path to your workspace]/liferay-bundles
    
    If you're on Windows, insert a \ behind each \ and : character to escape them in the workspace path. For example: C\:\\projects\\clarity-liferay-workspace\\liferay-bundles.
  6. Run this command:

    blade server init
    By changing the cache directory, the init process will download the bundle as if it was your first time because it does not yet exist in the new cache location.
  7. Verify the liferay-runtime folder appears in the workspace’s root folder.
  8. Verify the liferay-bundles folder appears as well. This folder should include a single archive inside of it for the workspace’s Liferay version.

Exercise: Setting a Bundle URL

The liferay.workspace.bundle.url property determines the URL for downloading Liferay bundles. This is useful when your organization has restrictions on accessing public CDNs or when you need to use a specific bundle version. Here, you'll modify the bundle URL for Clarity's workspace.

  1. Remove the liferay-runtime directory again.
  2. Copy the name of the archive file found in the liferay-bundles directory.
  3. Open the workspace’s gradle.properties file.
  4. Add this property and save the file:

    liferay.workspace.bundle.url=file://[full path to your workspace]/liferay-bundles/[bundle filename]
  5. Run this command:

    blade server init
    This ensures the initialization process uses the specified archive file from the liferay-bundles folder.
  6. Verify the liferay-runtime folder appears in the workspace’s root folder.

Conclusion

Great! You’ve configured the workspace’s gradle.properties file to customize Clarity’s local Liferay bundle. Next, you’ll practice creating code projects in it.

  • Exercise: Setting a Bundle Location

  • Exercise: Setting a Bundle Cache Location

  • Exercise: Setting a Bundle URL

  • Conclusion

Loading Knowledge

Capabilities

Product

Education

Contact Us

Connect

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