portals-jetspeed-dev mailing list archives

Hi, David. Thank you for the example. I am trying the maven solution you have below and get
the error below when running org.apache.maven.plugins:maven-war-plugin:2.0.2:war.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building extended-j2admin Maven Webapp
[INFO] task-segment: [org.apache.maven.plugins:maven-war-plugin:2.0.2:war]
[INFO] ------------------------------------------------------------------------
[INFO] [war:war {execution: default-cli}]
[INFO] Exploding webapp...
[INFO] Assembling webapp extended-j2admin in W:\eclipseWorkspace\extended-j2admin\target\extended-j2admin
[INFO] Copy webapp webResources to W:\eclipseWorkspace\extended-j2admin\target\extended-j2admin
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error unpacking file: W:\eclipseWorkspace\j2-admin\target\classesto: W:\eclipseWorkspace\extended-j2admin\target\war\work\cla
Embedded error: The source must not be a directory.
ThankS! Sandi
-----Original Message-----
From: David Sean Taylor [mailto:d.taylor@onehippo.com]
Sent: Wednesday, February 03, 2010 4:04 PM
To: Jetspeed Developers List
Subject: Re: login portlet extension
On Wed, Feb 3, 2010 at 7:44 AM, Dahl, Sandra <SDahl@dvsanalytics.com> wrote:
> Thanks for the information, David. In general, what is the best practice
> for extending an existing Jetspeed portlet so future Jetspeed updates can be
> easily implemented?
>
> I think there are two approaches you can take:
1. write your own administrative portlet application, and manage all code
yourself
2. overlay the j2-admin.war artifact from maven
The first solution doesn't work well for re-use, as much j2-admin's
functionality is hidden down in JSP files. Additionally, we do not
distribute j2-admin as a jar file to reuse java classes. With that in mind,
lets look at how you can approach the second solution.
Many people prefer Ant for this kind of processing. In fairness to Ant, lets
look at how you could do that. I didn't have an example with the j2-admin
war, but here is an similar example using the jetspeed layouts war.
<target name='overlay-layouts'>
<mkdir dir='${installer.target}/unpack/'/>
<unjar
src="${installer.target}/portal/webapps/dash/WEB-INF/deploy/local/jetspeed-layouts.war"
dest="${installer.target}/unpack/jetspeed-layouts/"/>
<copy overwrite='true'
todir='${installer.target}/unpack/jetspeed-layouts/WEB-INF/'
file="./src/layouts/portlet.xml"/>
<jar
destfile='${installer.target}/portal/webapps/dash/WEB-INF/deploy/local/jetspeed-layouts.war'
basedir="${installer.target}/unpack/jetspeed-layouts/" update='true'/>
</target>
In the target above, the Ant target overlays my customized portlet.xml on
top of the jetspeed-layouts war, and then create the new merged war file.
The downside to this approach, we don't take the jetspeed-layouts.war file
out of a Maven repository.
As a hybrid solution, if you prefer Ant but are required to use Maven, you
can embed ant commands into Maven at the generate-resources phase. There are
examples of this in the jetspeed-installer and enterprise sub-projects
Here is a pure Maven solution, which I would consider a best practice for
Maven builds. In this example I use the Maven War Plugin's overlay feature:
http://maven.apache.org/plugins/maven-war-plugin/overlays.html
Here is a complete pom.xml example:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.portals.jetspeed-2</groupId>
<artifactId>extended-j2admin</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>extended-j2admin Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.portals.jetspeed-2</groupId>
<artifactId>j2-admin</artifactId>
<type>war</type>
<version>2.2.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>extended-j2admin</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<overlays>
<overlay>
<id>j2-admin</id>
<groupId>org.apache.portals.jetspeed-2</groupId>
<artifactId>j2-admin</artifactId>
</overlay>
<overlay>
<!-- empty groupId/artifactId is detected as the current build
-->
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
</project>
I have zipped up the entire project for you to play around with and put it
on my retired server here:
http://www.bluesunrise.com/jetspeed-2/2.2/extended-j2admin.zip
There are two files in the overlay project's webapp source:
1. the web.xml, to show an example of replacing an existing file, where I
simply changed the display-name and description as an example:
<display-name>Sandra's Jetspeed-2 Portal Administration
Portlets</display-name>
<description>Sandra's Administration Portlets for the Jetspeed-2
Enterprise Portal</description>
2. the index.jsp, to show an example of adding a new file
Confidentiality Notice:
The information contained in this communication, including attachments, is privileged and
confidential. It is intended only for the exclusive use of the addressee. If the reader
is not the intended recipient, or the employee, or the agent responsible for delivering it
to the intended recipient, you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have received this communication
in error, please notify us by return email or telephone immediately. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org