Deploying Liferay Plugins with Maven

With Maven it’s easy to deploy plugins to a Liferay Portal instance. Just follow these steps:

  1. Make sure your parent POM’s Liferay-specific properties specify the correct Liferay version and your Liferay Portal’s deploy directory path.

    Here’s an example of these properties using Liferay 6.1.30 and a deploy directory path of E:\liferay-portal-6.1.30-ee-ga3\deploy:


    If you haven’t already created a parent plugin project, see Using a Parent Plugin Project for details.

  2. In your command prompt, navigate to your Liferay plugin project’s directory.

  3. Package your plugin by entering

    mvn package

    Your command output should be similar to the following output:

    [INFO] Building war:
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
  4. Deploy the plugin into your Liferay bundle by entering

    mvn liferay:deploy

    The command output should look similar to the following output:

    [INFO] Deploying sample-portlet-1.0-SNAPSHOT.war to [liferay version]\deploy
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------

    Your Liferay console output shows your plugin deploying. It looks like this:

    INFO: Deploying web application directory [liferay version]\[tomcat version]\webapps\sample-portlet
    INFO  [pool-2-thread-2][HotDeployImpl:178] Deploying sample-portlet from queue
    INFO  [pool-2-thread-2][PluginPackageUtil:1033] Reading plugin package for sample-portlet
  5. If you’re deploying the plugin to a release or snapshot repository, specify the repository by adding a distribution management section to your plugin’s pom.xml.

    Here’s an example distribution management section for a snapshot repository:

            <name>Liferay Snapshots Repository</name>

    The proper contents for your <distributionManagement> element can be found in the Summary tab for each of your repositories.

    Figure 9.13: Select the Summary tab of your repository to see how to specify it for distribution management in your plugins POM.

    Figure 9.13: Select the *Summary* tab of your repository to see how to specify it for distribution management in your plugin's POM.

    Since you created the plugin as a snapshot, you’ll have to deploy it to a snapshot repository. You can deploy a plugin as a release, but the plugin’s POM must specify a valid release version (e.g., <version>1.0</version>), not a snapshot version (e.g., <version>1.0-SNAPSHOT</version>).

  6. Deploy your plugin into your specified Nexus repository:

    mvn deploy

Now that you’ve deployed a plugin using Maven, let’s consider the types of Liferay plugins you can develop with Liferay Maven archetypes.

« Creating Liferay Plugins with MavenLiferay Plugin Types to Develop with Maven »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0