If you’re an avid Maven user and have been using it for Liferay Portal 6.2 project development or older, you must upgrade your Maven build to be compatible with Liferay DXP 7.2 development. There are two main parts of the Maven environment upgrade process that you must address:
For more information on using Maven with Liferay DXP 7.2, see the Maven section.
Liferay also offers a Maven development environment tailored specifically for Liferay DXP 7.2 development. Learn more about this in the Liferay Workspace section.
You’ll start off by upgrading your Maven environment’s Liferay Maven plugins.
Upgrading to New Liferay DXP 7.2 Maven Plugins
The biggest change for your project’s build plugins is the removal of the
liferay-maven-plugin
. Liferay now provides several individual Maven plugins
that accomplish specific tasks. For example, you can configure Maven plugins for
Liferay’s CSS Builder, Service Builder, Theme Builder, etc. With smaller plugins
available to accomplish specific tasks in your project, you no longer have to
rely on one large plugin that provides many things you may not want.
For example, suppose your Liferay Portal 6.2 project was using the
liferay-maven-plugin
for Liferay CSS Builder only. First, you should remove
the legacy liferay-maven-plugin
plugin dependency from your project’s
pom.xml
file:
<plugin>
<groupId>com.liferay.maven.plugins</groupId>
<artifactId>liferay-maven-plugin</artifactId>
<version>${liferay.version}</version>
<configuration>
<autoDeployDir>${liferay.auto.deploy.dir}</autoDeployDir>
<liferayVersion>${liferay.version}</liferayVersion>
<pluginType>portlet</pluginType>
</configuration>
</plugin>
Then, add the CSS Builder plugin dependency to your project’s pom.xml
file:
<plugin>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.css.builder</artifactId>
<version>2.1.3</version>
<executions>
<execution>
<id>default-build</id>
<phase>generate-sources</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<docrootDirName>src/main/webapp</docrootDirName>
</configuration>
</plugin>
Some common Liferay Maven plugins are listed below, with their corresponding artifact IDs and articles explaining how to configure them:
Common Liferay Maven Plugins
Name | Artifact ID | Tutorial |
---|---|---|
Bundle Support | com.liferay.portal.tools.bundle.support | Bundle Support Plugin |
CSS Builder | com.liferay.css.builder | CSS Builder Plugin |
DB Support | com.liferay.portal.tools.db.support | DB Support Plugin |
Deployment Helper | com.liferay.deployment.helper | Deployment Helper Plugin |
Javadoc Formatter | com.liferay.javadoc.formatter | Javadoc Formatter Plugin |
Lang Builder | com.liferay.lang.builder | Lang Builder Plugin |
REST Builder | com.liferay.portal.tools.rest.builder | REST Builder Plugin |
Service Builder | com.liferay.portal.tools.service.builder | Service Builder Plugin |
Source Formatter | com.liferay.source.formatter | Source Formatter Plugin |
Theme Builder | com.liferay.portal.tools.theme.builder | Theme Builder Plugin |
TLD Formatter | com.liferay.tld.formatter | TLD Formatter Plugin |
WSDD Builder | com.liferay.portal.tools.wsdd.builder | WSDD Builder Plugin |
XML Formatter | com.liferay.xml.formatter | XML Formatter Plugin |
In Liferay Portal 6.2, you were also required to specify all your app server configuration settings. For example, your parent POM probably contained settings similar to these:
<properties>
<liferay.app.server.deploy.dir>
E:\liferay-portal-6.2.0-ce-ga1\tomcat-7.0.42\webapps
</liferay.app.server.deploy.dir>
<liferay.app.server.lib.global.dir>
E:\liferay-portal-6.2.0-ce-ga1\tomcat-7.0.42\lib\ext
</liferay.app.server.lib.global.dir>
<liferay.app.server.portal.dir>
E:\liferay-portal-6.2.0-ce-ga1\tomcat-7.0.42\webapps\root
</liferay.app.server.portal.dir>
<liferay.auto.deploy.dir>
E:\liferay-portal-6.2.0-ce-ga1\deploy
</liferay.auto.deploy.dir>
<liferay.version>
6.2.0
</liferay.version>
<liferay.maven.plugin.version>
6.2.0
</liferay.maven.plugin.version
</properties>
This is no longer required in Liferay DXP 7.2 because Liferay’s Maven tools no longer rely on your Liferay DXP installation’s specific versions. You should remove them from your POM file.
Awesome! You’ve learned about the new Maven plugins available to you for Liferay DXP 7.2 development. Next, you’ll learn about updating your Liferay Maven artifacts.
Updating Liferay Maven Artifact Dependencies
Many Liferay Portal 6.2 artifact dependencies you were using have changed in Liferay DXP 7.2. See the table below for popular Liferay Maven artifacts that have changed:
Liferay Portal 6.2 Artifact ID | Liferay DXP 7.2 Artifact ID |
---|---|
portal-service | com.liferay.portal.kernel |
util-bridges | com.liferay.util.bridges |
util-java | com.liferay.util.java |
util-slf4j | com.liferay.util.slf4j |
util-taglib | com.liferay.util.taglib |
For more information on resolving dependencies in Liferay DXP 7.2, see the Resolving a Plugin’s Dependencies article.
Of course, you must also update the artifacts you’re referencing for your projects. If you’re using the Central Repository to install Liferay Maven artifacts, you won’t need to do anything more than update the artifacts in your POMs. If, however, you’re working behind a proxy or don’t have Internet access, you must update your company-shared or local repository with the latest Liferay DXP 7.2 Maven artifacts.
With these updates, you can easily upgrade your Liferay Maven build so you can begin developing projects for Liferay DXP 7.2.