Specifying Dependencies

You must satisfy all dependencies to compile and deploy a module successfully. After you find the dependency artifacts, add them as dependencies in your Gradle build file. Liferay already includes many artifacts at run time. If you depend on other artifacts, you must deploy them manually or include them in your module. Here you’ll find dependency configuration steps and examples.

Configuring Dependencies

  1. Open your build.Gradle file.

  2. Declare a dependencies set, if one doesn’t already exist.

    dependencies {
    }
    
  3. If your module requires packages from Liferay, OSGi, or Bnd, add a compileOnly dependency on the Liferay Portal API.

    dependencies {
        compileOnly group: "com.liferay.portal", name: "release.portal.api"
    }
    
  4. If your module doesn’t compile or deploy, find an artifact that provides the packages you need and add a compileInclude dependency on the artifact.

    dependencies {
        compileOnly group: "com.liferay.portal", name: "release.portal.api",
        compileInclude group: 'com.google.guava', name: 'guava', version: '19.0'
    }
    
  5. Deploy your module and check for unsatisfied package dependencies by using Gogo Shell commands or browsing the logs.

  6. If you have unsatisfied dependencies, resolve them:

    For module dependencies, deploy the needed modules. Please see Installing and Managing Apps for more information.

    For library dependencies, follow the instructions at Resolving Third Party Library Dependencies.

Nice! Specifying dependencies is a skill you can depend on!

Capabilities

Product

Contact Us

Connect

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