« Back to Maven SDK

liferay-maven-plugin for 6.0 EE

 

By lucus theisen

I was able to successfully use the liferay-maven-plugin when building against 6.0.6. However, my environment is 6.0-ee-sp2. There is no 6.0-ee-sp2 version of the liferay-maven-plugin available, nor is there a 6.0.12 version. I tried using the 6.0.6 liferay-maven-plugin and then changing the my artifacts dependency to 6.0-ee-sp2 artifacts, but that results in errors on the .model.xxxClp and .model.xxxWrapper classes (note that I published the ee artifacts portal-impl, portal-service, portal-client, portal-web, util-java, util-bridge, util-taglib to my internal maven repository). This leads me to believe the service builder was changed to accommodate changes in the base interfaces, but I cannot find any way to get a 6.0.12 or 6.0-ee-sp2 version of the liferay-maven-plugin. I see that the src zip file contains the support-maven folder with the plugin inside, but any attempt to build it fails as it is dependent on the 6.0.12-SNAPSHOT artifacts that are also not published. Please help...

--------------------------------------------- EDIT -------------------------------------------------

I have found a temporary workaround, but its a bit of a PITA. I will write it up here in case anyone else may be trying to do this.

First, grab the ee src for your version. Unpack it and go into the /support-maven/plugins/liferay-maven-plugin directory. Edit the pom.xml in that directory as follows:

Change the version from SNAPSHOT to:
 


    <version>6.0-ee-sp2</version>


Add a properties section:

    <properties>
        <maven.version>2.0.10</maven.version>
    </properties>


Modify the distributionManagement section so that it points to your internal maven repo:

    <distributionManagement>
        <repository>
            <id>my-repo</id>
            <name>My Repo Releases</name>
            <url>http://my.internal.repo/nexus/content/repositories/my-repo-releases</url>
        </repository>
    </distributionManagement>


Add the following dependencies:

        <!-- 6.0.12 funkiness -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.6.8</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.6.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jdbc</artifactId>
            <version>7.0.19</version>
        </dependency>


Now run mvn deploy from that folder and it should deploy liferay-maven-plugin with a version of 6.0-ee-sp2 or whatever you choose. This is clearly a bit of a hack, but it worked for me. I know that they have release a 6.1 version in maven central, and 6.1 promises to have more maven support (like support for uploading maven dependencies from ee src distributions to your maven repo), but for those of us stuck using older versions, maybe this will help temporarily?

One last note: this assumes you have already deployed the liferay artifacts (portal-impl, portal-service, portal-client, portal-web, util-java, util-bridge, util-taglib) to your internal maven repository, and if you are using maven 3, you will need to disable postBuildDependencyModules in your project pom for the liferay-maven-plugin as maven 3 got rid of the reactor "-r" command line option and the liferay-maven-plugin tries to make use of it.

Anyway, hope this helps someone out there!

------------------------------------- EDIT 2 --------------------------------------

One thing I forgot to mention, you must remove the <parent> section:


    <parent>
        <artifactId>plugins</artifactId>
        <groupId>com.liferay.maven</groupId>
        <version>6.0.12-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>


as well since it points to liferays internal server.
0 Attachments
10767 Views
Average (0 Votes)
The average rating is 0.0 stars out of 5.
Comments
Threaded Replies Author Date
Very nice. I'm testing this out now! I'm in the... John Källström April 10, 2012 7:17 AM
Look my Liferay maven plugin port : ... Sampsa Sohlman May 18, 2012 3:52 AM

Very nice. I'm testing this out now! I'm in the same situation as you where I want to use maven together with 6.0 EE. Hey, Liferay, if you are reading this - Backport the fixes you've done for 6.1!
Posted on 4/10/12 7:17 AM.
Look my Liferay maven plugin port :

https://github.com/sammso/liferay-maven-support

There is build.xml at

https://github.com/sammso/liferay-maven-support/tree/master/artifact-installer­/src/main/resources

That is able to import even LR internal dependencies to your local and remote repository.

I have even back ported version for LR 5.1.7 where service builder is working also.
Posted on 5/18/12 3:52 AM in reply to John Källström.