...
In order to simplify setting up such an automated workflow we provide maven archetypes to help with setting up maven projects to build plugins and assemble servers. As an example we'll describe setting up such a workflow for the liferay 4.4.1 portal. Note that this is two steps removed from a description of how to deploy liferay on geronimo, and one step removed from a description of how to build plugins for the liferay portal. For a completed example of such a workflow see the roller plugins at https://svn.apache.org/repos/asf/geronimo/plugins/roller/trunk
Notes:
- Due to maven lifecycle improvements in the car-maven-plugin the assembly artifact only generates poms that work with Geronimo 2.1.1 or later. The archetypes are currently available only as snapshots from branches/2.1 and trunk.
- Maven tends to strip out all comments from the new pom.xml so a pom.sample.xml is included that has more comments on how to set up the pom.xml for common situations.
- Archetypes use some attributes (groupId, version) of parent projects when they exist. The instructions use this: for standalone use you may need to supply more command line options.The archetypes are not included in geronimo 2.1 but the snapshots should be readily available
- Some of this would not be necessary given a project built with maven in the first place
- As of writing, the server starts (given enough memory) but the liferay portal doesn't show up. Hopefully we'll figure out why soon.
...
Code Block |
---|
mvn archetype:create \ -DarchetypeGroupId=org.apache.geronimo.buildsupport \ -DarchetypeArtifactId=geronimo-plugin-archetype \ -DarchetypeVersion=2.2-SNAPSHOT \ -DgroupId=org.apache.geronimo.plugins \ -DartifactId=liferay-derby \ -Dversion=1.0-SNAPSHOT |
Change the plan so it looks like this:
...
Code Block |
---|
mvn archetype:create \ -DarchetypeGroupId=org.apache.geronimo.buildsupport \ -DarchetypeArtifactId=geronimo-plugin-archetype \ -DarchetypeVersion=2.2-SNAPSHOT \ -DgroupId=org.apache.geronimo.plugins \ -DartifactId=liferay-jetty \ -Dversion=1.0-SNAPSHOT |
Edit the plan so it looks like:
NOTE: this is derived from the liferay plan at and is under the liferay (MIT) license
...
Code Block |
---|
<dependencies> <!-- if you are deploying a jee application, use scope provided --> <!-- other dependencies will normally end up as dependencies in the plan and geronimo-plugin.xml --> <!-- include dependencies on all deployer modules needed, with scope provided --> <dependency> <groupId>com.liferay</groupId> <artifactId>liferay-portal-lesslibs</artifactId> <version>${liferayVersion}-SNAPSHOT</version> <type>war</type> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>javamail</artifactId> <type>car</type> <version>${geronimoVersion}</version> </dependency> <!-- replaces activemq jar in lib dir --> <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-core</artifactId> <type>jar</type> <version>4.1.1</version> </dependency> <!-- activemq car does not work because liferay wants to use spring to configure activemq. If we can eliminate the spring files in portal-impl.jar perhaps this would work. <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>activemq-ra</artifactId> <type>car</type> <version>${geronimoVersion}</version> </dependency> --> <dependency> <groupId>org.apache.geronimo.plugins</groupId> <artifactId>liferay-derby</artifactId> <type>car</type> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>portlet-api</groupId> <artifactId>portlet-api</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>com.liferay</groupId> <artifactId>portal-kernel</artifactId> <version>${liferayVersion}</version> </dependency> <dependency> <groupId>com.liferay</groupId> <artifactId>portal-service</artifactId> <version>${liferayVersion}</version> </dependency> <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.8.1</version> </dependency> <dependency> <groupId>saxpath</groupId> <artifactId>saxpath</artifactId> <version>1.0-FCS</version> </dependency> <dependency> <groupId>commons-digester</groupId> <artifactId>commons-digester</artifactId> <version>1.8</version> </dependency> <dependency> <groupId>org.apache.geronimo.framework</groupId> <artifactId>geronimo-gbean-deployer</artifactId> <type>car</type> <version>${geronimoVersion}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>jetty6-deployer</artifactId> <type>car</type> <version>${geronimoVersion}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>jasper-deployer</artifactId> <type>car</type> <version>${geronimoVersion}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>persistence-jpa10-deployer</artifactId> <type>car</type> <version>${geronimoVersion}</version> <scope>provided</scope> </dependency> </dependencies> |
...
Code Block |
---|
<plugin> <groupId>org.apache.geronimo.buildsupport</groupId> <artifactId>car-maven-plugin</artifactId> <configuration> <deploymentConfigs> <!-- gbean deployer is default. For jee apps include all deployers your app needs, see properties --> <deploymentConfig>${gbeanDeployer}</deploymentConfig> <deploymentConfig>${j2eeDeployer}</deploymentConfig> <deploymentConfig>${jetty6Deployer}</deploymentConfig> <deploymentConfig>${jasperDeployer}</deploymentConfig> <!--<deploymentConfig>${jpaDeployer}</deploymentConfig>--> </deploymentConfigs> <!-- if you are deploying a jee app specify it here --> <module> <groupId>com.liferay</groupId> <artifactId>liferay-portal<portal-lesslibs</artifactId> <version>${liferayVersion}</version> <type>war</type> </module> <!-- Normally you can use the maven dependencies unaltered. If you need to specify import scope you can list the dependencies here as you want them in the plan.xml --> <useMavenDependencies> <value>true</value> <includeVersion>true</includeVersion> </useMavenDependencies> <!-- the instance sets up most of the optional geronimo-plugin.xml content --> <instance> <plugin-artifact> <!-- extract stuff from the car to the specified location (good for config info --> <!--<copy-file relative-to="server" dest-dir="var/roller-data">themes</copy-file>--> <!-- content that should go into var/config/config.xml for module customization --> <!-- note the variable ${LiferayContextPath} which is further specified in var/config/config-substitutions.properties --> <config-xml-content server="default"> <gbean name="org.apache.geronimo.plugins/liferay-jetty/${liferayPluginVersion}/car"> <attribute name="contextPath">${LiferayContextPath}</attribute> </gbean> </config-xml-content> <!-- a user-tweakable variable to go into var/config/config-substitutions.properties --> <config-substitution key="LiferayContextPath">/liferay</config-substitution> </plugin-artifact> </instance> </configuration> </plugin> |
...
As of writing the server will start but accessing http://localhost:8080/liferay redirects to http://localhost:8080/c
and gives a 404 error.