Community Forums
Combination View Flat View Tree View
Threads [ Previous | Next ]
RE: Maven2 for portlet projects?
toggle
Has anyone used Maven2 to build/deploy portlets? Are there any howtos or tutorials available that I could research? I'm trying to put together a M2 build but I'd hate to waste time on any duplicate efforts. Thanx in advance!

emoticonCliff
RE: Maven2 for portlet projects?
9/5/07 9:05 AM as a reply to Clifton Craig.
Clifton Craig:
Has anyone used Maven2 to build/deploy portlets? Are there any howtos or tutorials available that I could research? I'm trying to put together a M2 build but I'd hate to waste time on any duplicate efforts. Thanx in advance!

emoticonCliff


Sorry for being so late in posting this, but I haven't been doing much looking at the forums lately. I've been working with liferay and maven2 in the last few months. It's easy to use maven2 to build a portlet since you only need to include the portlet related jars in your pom.xml and then the liferay related xml's in your webapp/WEB-INF directory... basically you are just using the maven2 webapp artifact and adding the portlet libraries... the following is an example of what we add when building one. Using maven, I can stand up a new portlet and have it ready to deploy within a minute or two. The only thing to watch out for, is that everytime liferay releases a new version, you have to manually figure out what they changed and update all the dependencies yourself. I lose probably all the time I save, trying to deal with the version upgrades since libraries are always changing. Currently 4.3.1 is giving me a fun headache. Here are the 2 relevant sections that I think will help you, everything else is just a normal portlet webapp (with the liferay xmls included):

...
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${sun-jsf-version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>${sun-jsf-version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.java.jsfportletbridge</groupId>
<artifactId>jsf-portlet</artifactId>
<version>${sun-jsf-portlet-bridge}</version>
</dependency>
<dependency>
<groupId>portlet-api</groupId>
<artifactId>portlet-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>

...

...
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy file="${project.build.directory}/${project.build.finalName}.war" todir="${portlet-hotdeploy}"></copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
...
RE: Maven2 for portlet projects?
10/31/08 12:03 AM as a reply to Clifton Craig.
I just opened LPS-381. It contains a Maven plugin to invoke the Liferay deployer during your maven build.