Using external artifacts in your project requires configuring their dependencies. To do this, look up the artifact’s attributes and plug them into dependency entries for your build system (either Gradle or Maven). Your build system downloads the dependency artifacts your project needs to compile successfully.
Before specifying an artifact as a dependency, you must first find its attributes. Artifacts have these attributes:
- Group ID: Authoring organization
- Artifact ID: Name/identifier
- Version: Release number
Here you’ll learn how to find artifact attributes to specify artifact dependencies.
Finding Core Artifact Attributes
Each Liferay artifact is a JAR file whose META-INF/MANIFEST.MF
file specifies
OSGi bundle metadata the artifact’s attributes. For example, these two OSGi
headers specify the artifact ID and version:
Bundle-SymbolicName: [artifact ID]
Bundle-Version: [version]
This table lists each core Liferay DXP artifact’s group ID and artifact ID and where to find the artifact’s manifest, which lists the artifact version:
Core Liferay DXP Artifacts:
File | Group ID | Artifact ID | Version | Origin |
---|---|---|---|---|
portal-kernel.jar | com.liferay.portal | com.liferay.portal.kernel | (see JAR’s MANIFEST.MF ) | fix pack ZIP, Liferay DXP installation, or Liferay DXP dependencies ZIP |
portal-impl.jar | com.liferay.portal | com.liferay.portal.impl | (see JAR’s MANIFEST.MF ) | fix pack ZIP or Liferay DXP .war |
util-bridges.jar | com.liferay.portal | com.liferay.util.bridges | (see JAR’s MANIFEST.MF ) | fix pack ZIP or Liferay DXP .war |
util-java.jar | com.liferay.portal | com.liferay.util.java | (see JAR’s MANIFEST.MF ) | fix pack ZIP or Liferay DXP .war |
util-slf4j.jar | com.liferay.portal | com.liferay.util.slf4j | (see JAR’s MANIFEST.MF ) | fix pack ZIP or Liferay DXP .war |
util-taglibs.jar | com.liferay.portal | com.liferay.util.taglib | (see JAR’s MANIFEST.MF ) | fix pack ZIP or Liferay DXP .war |
com.liferay.* JAR files | com.liferay | (see JAR’s MANIFEST.MF ) | (see JAR’s MANIFEST.MF ) | fix pack ZIP, Liferay DXP installation, Liferay DXP dependencies ZIP, or the OSGi ZIP |
Next, you’ll learn how to find Liferay DXP app and independent module artifact attributes.
Finding Liferay App and Independent Artifacts
Independent modules and Liferay DXP app modules aren’t part of the Liferay DXP core. You must still, however, find their artifact attributes if you depend on them. The resources below provide the artifact details for Liferay DXP’s apps and independent modules:
Resource | Artifact Type |
---|---|
App Manager | Deployed modules |
Reference Docs | Liferay DXP modules (per release) |
Maven Central | All artifact types: Liferay DXP and third party, module and non-module |
The App Manager is the best source for information on deployed modules. You’ll learn about it next.
App Manager
The App Manager knows what’s deployed on your Liferay instance. Use it to find deployed module attributes.
-
In Liferay DXP, navigate to Control Panel → Apps → App Manager.
-
Search for the module by its display name, symbolic name, or related keywords. You can also browse for the module in its app. Whether browsing or searching, the App Manager shows the module’s artifact ID and version number.
If you don’t know a deployed module’s group ID, use the Felix Gogo Shell to find it:
-
Navigate to the Gogo Shell portlet in the Control Panel → Configuration → Gogo Shell. Enter commands in the Felix Gogo Shell command prompt.
-
Search for the module by its display name (e.g.,
Liferay Blogs API
) or a keyword. In the results, note the module’s number. You can use it in the next step. For example, Gogo command results in the figure below show the Liferay Blogs API module number. -
List the module’s manifest headers by passing the module number to the
headers
command. In the results, note theBundle-Vendor
value: you’ll match it with an artifact group in a later step: -
On Maven Central or MVNRepository, search for the module by its artifact ID.
-
Determine the group ID by matching the
Bundle-Vendor
value from step 3 with a group listed that provides the artifact.
Next, Liferay DXP’s reference documentation provides Liferay DXP app artifact attributes.
Reference Docs
Liferay DXP’s app Javadoc lists each app module’s artifact ID, version number, and display name. This is the best place to look up Liferay DXP app modules that aren’t yet deployed to your Liferay DXP instance.
Follow these steps to find a Liferay DXP app module’s attributes in the Javadoc:
-
Navigate to Javadoc for an app module class. If you don’t have a link to the class’s Javadoc, find it by browsing https://docs.liferay.com/dxp/apps.
-
Copy the class’s package name.
-
Navigate to the Overview page.
-
On the Overview page, search for the package name you copied in step 2.
The heading above the package name shows the module’s artifact ID, version
number, and display name. Remember, the group ID for all app modules is
com.liferay
.
Next, you’ll learn how to look up artifacts on MVNRepository and Maven Central.
Maven Central
Most artifacts, regardless of type or origin, are on
MVNRepository
and
Maven Central.
These sites can help you find artifacts based on class packages. It’s common to
include an artifact’s ID in the start of an artifact’s package names. For
example, if you depend on the class
org.osgi.service.component.annotations.Component
, search for the package name
org.osgi.service.component.annotations
on one of the Maven sites.
Now that you know the artifact’s attributes, you can configure a dependency on it.