Please review the pom diffs below.
This pom change uses a simple (if brute-force) technique to add
additional elements to the Class-Path for the gf-client.jar (for
example, for the queuing JARs and, soon, the RA JARs).
Briefly:
0. There are no changes in dependencies or osgi.bundle.
1. Uses the dependency plug-in to create a file which contains the class
path that Maven computes for the JAR.
2. After the JAR is created, runs ant to
2a. Extract the manifest from the JAR.
2b. Replace colons in the class path file (#1) with spaces so it's
suitable for use in the manifest's Class-Path.
2c. Append the non-OSGi JARs specified to the class path.
2d. Update the manifest with the new class path.
2e. Update the JAR with the revised manifest.
3. I also removed a previously-commented-out section.
I've attached the fixup.xml ant file in case anyone is interested.
The QL tests and the deployment and ejb devtests pass.
Thanks.
- Tim
Index: pom.xml
===================================================================
--- pom.xml (revision 26656)
+++ pom.xml (working copy)
@@ -44,9 +44,16 @@
This module builds the free-standing JAR file for the app client
container which can be run without using an OSGi implementation.
- This module contains no source of its own but simply packages a JAR
+ This module contains little source of its own but mostly
packages a JAR
with a manifest Class-Path that specifies all the OSGi JARs on
which
it directly or indirectly depends.
+
+ Note that additional JARs which clients might need but which
are not
+ declared as dependencies are added by updating the generated
manifest's
+ Class-Path using some ant tasks. The nicer way to do this
would be to
+ create a custom plug-in which would delegate most of the work
to the
+ archiver but would augment the generated Class-Path with the
extra JARs.
+ Perhaps later.
-->
<parent>
<groupId>org.glassfish.appclient</groupId>
@@ -58,6 +65,14 @@
<packaging>jar</packaging>
<name>Client library (including ACC)</name>
+ <properties>
+
<classpath.file>${project.build.directory}/tmp/classpath.txt</classpath.file>
+ <mq.dir.path>../../mq</mq.dir.path>
+ <mq.lib>${mq.dir.path}/lib</mq.lib>
+ <jmsra.apps.dir>../install/applications/jmsra</jmsra.apps.dir>
+ <mq.classpath.additions>${mq.lib}/imq.jar
${mq.lib}/imqadmin.jar ${mq.lib}/imqutil.jar ${mq.lib}/fscontext.jar
${mq.lib} ${jmsra.apps.dir}/imqjmsra.jar</mq.classpath.additions>
+
+ </properties>
<developers>
<developer>
<id>tjquinn</id>
@@ -73,6 +88,35 @@
<build>
<plugins>
+ <!--
+ Create a text file containing the generated class
path. This
+ file is used in the ant tasks when the original
Class-Path is
+ augmented. Note: we force the path separator to be a colon
+ because the plug-in will use the platform-specific
separator
+ otherwise. The ant logic replaces colons with spaces to
+ reformat the contents of the file so it's useful in the
manifest.
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-classpath-file</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>build-classpath</goal>
+ </goals>
+ <configuration>
+ <outputFile>${classpath.file}</outputFile>
+ <outputFilterFile>true</outputFilterFile>
+ <pathSeparator>:</pathSeparator>
+ <prefix>../modules</prefix>
+ <stripVersion>true</stripVersion>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
@@ -96,8 +140,7 @@
<packageName>org.glassfish.appclient.client.acc</packageName>
<addClasspath>true</addClasspath>
<classpathLayoutType>custom</classpathLayoutType>
-
<customClasspathLayout>$${artifact.artifactId}$${dashClassifier?}.$${artifact.extension}</customClasspathLayout>
-
+
<customClasspathLayout>../modules/$${artifact.artifactId}$${dashClassifier?}.$${artifact.extension}</customClasspathLayout>
</manifest>
<manifestEntries>
<PreMain-Class>org.glassfish.appclient.client.acc.agent.AppClientContainerAgent</PreMain-Class>
@@ -106,38 +149,35 @@
</configuration>
</plugin>
-
- <!--
- Creates a zip file containing the stand-alone ACC JAR
and all the
- module JARs on which the ACC depends.
- -->
-<!--
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.1</version>
- <configuration>
- <descriptors>
- <descriptor>src/assemble/bundle.xml</descriptor>
- </descriptors>
- </configuration>
- <executions>
- <execution>
- <id>create-ACC-bundle</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
--->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>fixup-jar-classpath</id>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="output.file"
value="${project.build.finalName}.jar"/>
+ <property name="output.dir"
value="${project.build.directory}"/>
+ <property name="stage.dir"
value="${project.build.directory}/stage"/>
+ <property name="classpath.additions"
value="${mq.classpath.additions}"/>
+ <property name="classpath.file"
value="${classpath.file}"/>
+ <ant antfile="${basedir}/fixup.xml"/>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
-
</build>
<dependencies>
<!--
- We only need to specify the ACC's OSGi JAR as the single
dependency.
+ We specify the ACC's OSGi JAR as a dependency.
The maven-jar-plugin will do the work of finding the transitive
closure of it and the modules on which it depends to build the
accurate Class-Path for the manifest.