<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jayway Team Blog &#187; archetype</title>
	<atom:link href="http://blog.jayway.com/tag/archetype/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jayway.com</link>
	<description>Sharing Experience</description>
	<lastBuildDate>Sun, 05 Sep 2010 20:32:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Mavenizing the Liferay Plugin SDK</title>
		<link>http://blog.jayway.com/2009/03/14/mavenizing-the-liferay-plugin-sdk/</link>
		<comments>http://blog.jayway.com/2009/03/14/mavenizing-the-liferay-plugin-sdk/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 08:58:00 +0000</pubDate>
		<dc:creator>Henrik Bernström</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[User Experience]]></category>
		<category><![CDATA[archetype]]></category>
		<category><![CDATA[artifact]]></category>
		<category><![CDATA[liferay]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[maven2]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[portlet]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.jayway.com/?p=1094</guid>
		<description><![CDATA[Liferay is the leading Open Source enterprise portal platform in the Java market. It's certainly an impressive piece of software. I've been following it for some time now and the product is improving a great deal in many areas, perhaps most in end user usability. One area that, in my opinion, could still be improved [...]]]></description>
			<content:encoded><![CDATA[<p>Liferay is the leading Open Source enterprise portal platform in the Java market. It's certainly an impressive piece of software. I've been following it for some time now and the product is improving a great deal in many areas, perhaps most in end user usability.</p>
<p>One area that, in my opinion, could still be improved is the development environment. It may be a heck of a good build system <a href="http://www.liferay.com">Liferay</a> has come up with, but at the bottom line it takes time to learn it and to just start studying it you easily become a bit uncertain. It consists of homegrown ant scripts. To have a flatter learning curve for newcomers <a href="http://maven.apache.org/">Maven 2</a> might be suitable.</p>
<p>Anyway, I sat down one evening some time ago and looked into how Maven 2 could be used for creating Jsp Portlets for Liferay. Some hours later the work had resulted in a new archetype for creating Liferay Jsp Portlets. </p>
<p><a href="http://svn.liferay.com/browse/plugins/trunk/tools/portlet_tmpl">The structure and content of the standard Liferay Jsp Portlet can be viewed here.</a></p>
<h3>So, what did I do?</h3>
<p>1. I followed these instructions to manipulate the Jsp Portlet part of Liferay's plugin SDK into a maven archetype:</p>
<p><a href="http://maven.apache.org/guides/mini/guide-creating-archetypes.html">http://maven.apache.org/guides/mini/guide-creating-archetypes.html</a></p>
<p>This involved editing these property and xml files:</p>
<pre>liferay-plugin-package.properties
name=${artifactId}
module-group-id=liferay
module-incremental-version=1
tags=
short-description=
change-log=
page-url=http://www.liferay.com
author=Liferay, Inc.
licenses=MIT
</pre>
<pre class="xml">portlet.xml
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="font-weight: bold; color: black;">?&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;portlet-app</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd&quot;</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;2.0&quot;</span> <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;portlet<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;portlet-name<span style="font-weight: bold; color: black;">&gt;</span></span></span>jspPortlet<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/portlet-name<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;display-name<span style="font-weight: bold; color: black;">&gt;</span></span></span>${artifactId}<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/display-name<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;portlet-class<span style="font-weight: bold; color: black;">&gt;</span></span></span>${groupId}.JSPPortlet<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/portlet-class<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;init-param<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;name<span style="font-weight: bold; color: black;">&gt;</span></span></span>view-jsp<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/name<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;value<span style="font-weight: bold; color: black;">&gt;</span></span></span>/view.jsp<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/value<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/init-param<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;expiration-cache<span style="font-weight: bold; color: black;">&gt;</span></span></span>0<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/expiration-cache<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;supports<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mime-type<span style="font-weight: bold; color: black;">&gt;</span></span></span>text/html<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/mime-type<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/supports<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;portlet-info<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>${artifactId}<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;short-title<span style="font-weight: bold; color: black;">&gt;</span></span></span>${artifactId}<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/short-title<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;keywords<span style="font-weight: bold; color: black;">&gt;</span></span></span>${artifactId}<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/keywords<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/portlet-info<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;security-role-ref<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;role-name<span style="font-weight: bold; color: black;">&gt;</span></span></span>administrator<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/role-name<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/security-role-ref<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;security-role-ref<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;role-name<span style="font-weight: bold; color: black;">&gt;</span></span></span>guest<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/role-name<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/security-role-ref<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;security-role-ref<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;role-name<span style="font-weight: bold; color: black;">&gt;</span></span></span>power-user<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/role-name<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/security-role-ref<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;security-role-ref<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;role-name<span style="font-weight: bold; color: black;">&gt;</span></span></span>user<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/role-name<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/security-role-ref<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/portlet<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/portlet-app<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<p>to insert ${artifactId} and ${groupId} for the portlet name and package structure. These files are part of the file list finally being wrapped up within the archetype and used to generate the resulting portlet from Maven 2.</p>
<p>2. I ran '<strong>mvn install</strong>' on that particular archetype to have it installed in my local repository.</p>
<p>3. I used the archetype to create a new Liferay Jsp Portlet artifact:</p>
<pre>
mvn archetype:create -DarchetypeGroupId=com.liferay.maven.archetypes.portlet.jsp
  -DarchetypeArtifactId=liferay-jsp-portlet
  -DarchetypeVersion=1.0-SNAPSHOT
  -DgroupId=[my.package]
  -DartifactId=[MyFirstLiferayJspPortlet]
</pre>
<p>4. I stepped into the artifact and ran '<strong>mvn install</strong>' on it which generated my MyFirstLiferayJspPortlet-1.0-SNAPSHOT.war.</p>
<p>5. I then uploaded the war file to my portal instance via the Liferay admin GUI Plugin Installer.</p>
<p>6. Et voila. It worked, showing up in the portal.</p>
<p>And of course, worth mentioning, to have a development environment up and running in eclipse in seconds this is all you have to do:</p>
<pre>
1. mvn eclipse:add-maven-repo -Declipse.workspace=[full-path-to-workspace]

2. mvn eclipse:eclipse
</pre>
<p>To have the archetype play with the existing build situation of Liferay it would probably need to be generated from some ant target and be based on the portlet template in subversion located at "plugins/tools/portlet_tmpl/" to have it follow updates of Liferay.</p>
<p><a href="http://blog.jayway.com/wordpress/wp-content/uploads/2009/03/jspportlet-archetype.zip">Here you can download the final result, as a zipped archetype.</a></p>
<p>If a generated archetype like this was to be uploaded to a public maven repository, working from above point #3 and down is what would be necessary for a developer to have a project and all the necessary property and xml files (correctly edited with package structures and all) in place for a Liferay Jsp Portlet development environment. It could at least become a complement to the Plugins SDK. And yes, it could for sure still be enhanced. For example, there is no JSPPortletTest class generated for the JSPPortlet class.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jayway.com/2009/03/14/mavenizing-the-liferay-plugin-sdk/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
