Deploying Liferay Plugins with Maven

With Maven, it’s easy to deploy plugins to a Liferay Portal instance. This tutorial explain the process. Just follow these steps:

  1. Make sure you’ve specified the Liferay specific properties (the properties starting with liferay.) in your plugin’s (or your parent plugin’s) pom.xml. See the Using Maven Parent Plugin Projects tutorial for descriptions of these Liferay properties.

    Here’s an example where these properties are specified for a Liferay instance bundled with Apache Tomcat in the directory C:\liferay-portal-6.2:

  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]
    INFO  [pool-2-thread-2][HotDeployImpl:178] Deploying sample-portlet from que
    INFO  [pool-2-thread-2][PluginPackageUtil:1033] Reading plugin package for s
  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 or your parent project’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 2.29: Select the Summary tab of your repository to see how to specify it for distribution management in your plugins POM.

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

    If 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

Your plugin is now available in your Nexus repository!

Congratulations on deploying your plugin to Liferay and to your repository!

Deploying Plugins

« Using Liferay Maven Parent Plugin ProjectsCreating Liferay Maven Plugins from Liferay IDE »
Este artigo foi útil?
Utilizadores que acharam útil: 0 de 0