You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Brent Paschall <bp...@spheris.com> on 2004/03/24 18:45:56 UTC

[patch] jnlp plugin

Greetings,

The jnlp plugin has been a huge help to some recent development efforts of
mine.  In order to meet all my requirements, I needed two additional
features that I believe might be of use to others, so I am submitting a
patch for the following:

1) Tweaked classpath generation.  I was having a problem where some
dependencies of the jnlp app I was using had some (log4j) configuration
files that were named identically to those in my app.  Because the resource
tags for dependencies are generated in the jnlp file prior to the resource
tag for the project being built, the dependencies appear on the jnlp
classpath before the project code, overriding the project's files.  The
attached patch resolves this by always putting the resource tag for the
current project ahead of any dependencies.

2) Added basic support for extensions.  The jnlp plugin already supports the
generation of jar and native jar resources.  The patch also adds support for
generating extension resources.  A <jnlp.extension>true</jnlp.extension>
added to the properties of a dependency will create an extension resource in
the jnlp file with an href set to the url of the dependency. The patch also
updates the properties documentation to reflect this change.  Basic support
means that there are additional attributes and subtags of <extension> that
are not included in this patch.  

Hope this helps!

Brent A. Paschall
Spheris
615-261-1575
bpaschall@spheris.com

Index: plugin.jelly
===================================================================
retrieving revision 1.24
diff -u -r1.24 plugin.jelly
--- plugin.jelly	4 Mar 2004 18:36:13 -0000	1.24
+++ plugin.jelly	24 Mar 2004 17:10:28 -0000
@@ -41,313 +41,277 @@
         description="Generate JNLP file and sign all jars"
         prereqs="jnlp:generate-jnlp"/>
 
-    <goal name="jnlp:generate-jnlp"
-             description="Generate the .jnlp file and sign all jars"
-             prereqs="jar:jar">
-
-        <ant:mkdir dir="${maven.jnlp.dir}"/>
-        <ant:echo>Creating ${maven.jnlp.dir}/${pom.artifactId}.jnlp
...</ant:echo>
-
-        <!-- ================== -->
-        <!-- Generate JNLP file -->
-        <!-- ================== -->
-        <maven:property name="maven.jnlp.description"
defaultValue="${pom.description}"/>
-        <maven:property name="maven.jnlp.description.short"
defaultValue="${pom.shortDescription}"/>
-        <maven:property name="maven.jnlp.http.codebase"
defaultValue="${pom.url}"/>
-        <maven:property name="maven.jnlp.signjar.alias"
defaultValue="${pom.artifactId}"/>
-        <maven:property name="maven.jnlp.signjar.dname.o"
defaultValue="${pom.organization.name}"/>
-        <maven:property name="maven.jnlp.title"
defaultValue="${pom.name}"/>
-        <j:set var="final.jar.name" value="${maven.final.name}.jar"/>
-        
-        <j:file name="${maven.jnlp.dir}/${pom.artifactId}.jnlp"
prettyPrint="true"
-          xmlns="dummy">
-
-
-            <jnlp spec="${maven.jnlp.spec}"
-              codebase="${maven.jnlp.http.codebase}"
-              href="${pom.artifactId}.jnlp">
-            <j:if test="${context.getVariable('maven.jnlp.cert.version') !=
null}">
-              <j:set var="certVer" value="${maven.jnlp.cert.version}"/>
-              <ant:echo>Appending Certificate Version:
${certVer}</ant:echo>
-            </j:if>
-
-              <information>
-                <title>${maven.jnlp.title}</title>
-                  <j:if test="${context.getVariable('maven.jnlp.vendor') !=
null}">
-                    <vendor>${maven.jnlp.vendor}</vendor>
-                  </j:if>
-                  <j:if test="${context.getVariable('maven.jnlp.homepage')
!= null}">
-                    <homepage href="${maven.jnlp.homepage}"/>
-                  </j:if>
-                  <j:if test="${context.getVariable('maven.jnlp.icon') !=
null}">
-                    <icon href="${maven.jnlp.icon}"/>
-                  </j:if>
-                  <j:if
test="${context.getVariable('maven.jnlp.icon.splash') != null}">
-                    <icon kind="splash" href="${maven.jnlp.icon.splash}"/>
-                  </j:if>
-                  <j:if
test="${context.getVariable('maven.jnlp.description') != null}">
-                    <description>${maven.jnlp.description}</description>
-                  </j:if>
-                  <j:if
test="${context.getVariable('maven.jnlp.description.one-line') != null}">
-                    <description
kind="one-line">${maven.jnlp.description.one-line}</description>
-                  </j:if>
-                  <j:if
test="${context.getVariable('maven.jnlp.description.short') != null}">
-                    <description
kind="short">${maven.jnlp.description.short}</description>
-                  </j:if>
-                  <j:if
test="${context.getVariable('maven.jnlp.description.tooltip') != null}">
-                    <description
kind="tooltip">${maven.jnlp.description.tooltip}</description>
-                    </j:if>
-                    <j:if
test="${context.getVariable('maven.jnlp.offline.allowed') != null}">
-                        <offline-allowed/>
-                    </j:if>
-                </information>
-                <security>
-                    <j:set var="permission"
value="${maven.jnlp.permission}X"/>
-                    <j:if test="${permission == 'allX'}">
-                        <all-permissions/>
-                    </j:if>
-                    <j:if test="${permission == 'j2eeX'}">
-                        <j2ee-application-client-permissions/>
-                    </j:if>
-                </security>
-
-                <resources>
-                    <j2se version="${maven.jnlp.j2se.version}"
-
initial-heap-size="${maven.jnlp.j2se.heapsize.initial}"
-
max-heap-size="${maven.jnlp.j2se.heapsize.max}"/>
-                    <j:set var="mainExists" value="false"/>
-
-                    <j:forEach var="lib" items="${pom.artifacts}">
-                        <j:set var="dep" value="${lib.dependency}"/>
-                        <j:set var="depVer" value="${dep.version}"/>
-                        <j:if
test="${context.getVariable('maven.jnlp.cert.version') != null}">
-                          <j:set var="depVer"
value="${depVer.concat('-').concat(certVer)}"/>
-                        </j:if>
-                        <j:if
test="${dep.getProperty('jnlp.jar')=='true'}">
-                            <j:choose>
-                              <j:when
test="${dep.getProperty('jnlp.main.jar')=='true'}">
-                                <j:set var="mainExists" value="true"/>
-                                <j:choose>
-                                  <j:when
test="${(context.getVariable('maven.jnlp.usejarversions') != null) and
(dep.version.indexOf('SNAPSHOT') lt 0)}">
-                                       <jar href="${lib.file.name}"
main="true" version="${depVer}"/>
-                                  </j:when>
-                                  <j:otherwise>
-                                    <jar href="${lib.file.name}"
main="true"/>
-                                  </j:otherwise>
-                                </j:choose>
-                              </j:when>
-                              <j:otherwise>
-                                <j:choose>
-                                  <j:when
test="${(context.getVariable('maven.jnlp.usejarversions') != null) and
(dep.version.indexOf('SNAPSHOT') lt 0)}">
-                                      <jar href="${lib.file.name}"
version="${depVer}"/>
-                                  </j:when>
-                                  <j:otherwise>
-                                    <jar href="${lib.file.name}" />
-                                  </j:otherwise>
-                                </j:choose>
-                              </j:otherwise>
-                            </j:choose>
-                        </j:if>
-                        <j:if
test="${dep.getProperty('jnlp.native.jar')=='true'}">
-                            <nativelib href="${lib.file.name}"/>
-                        </j:if>
-                    </j:forEach>
-                    <j:set var="depVer" value="${pom.currentVersion}"/>
-                    <j:if
test="${context.getVariable('maven.jnlp.cert.version') != null}">
-                      <j:set var="depVer"
value="${depVer.concat('-').concat(certVer)}"/>
-                    </j:if>
-                    <j:choose>
-                        <j:when test="${mainExists=='false'}">
-                            <j:choose>
-                              <j:when
test="${(context.getVariable('maven.jnlp.usejarversions') != null) and
(pom.currentVersion.indexOf('SNAPSHOT') lt 0)}">
-                                <jar href="${final.jar.name}" main="true"
version="${depVer}"/>
-                              </j:when>
-                              <j:otherwise>
-                                <jar href="${final.jar.name}" main="true"/>
-                              </j:otherwise>
-                            </j:choose>
-                        </j:when>
-                        <j:otherwise>
-                            <j:choose>
-                              <j:when
test="${(context.getVariable('maven.jnlp.usejarversions') != null) and
(pom.currentVersion.indexOf('SNAPSHOT') lt 0)}">
-                                <jar href="${final.jar.name}"
version="${depVer}"/>
-                              </j:when>
-                              <j:otherwise>
-                                <jar href="${final.jar.name}" />
-                              </j:otherwise>
-                            </j:choose>
-                        </j:otherwise>
-                    </j:choose>
-                    <!--  This is close to what it WILL look like, but for
now it is the ugly ass thing below  it-->
-
-                    <u:tokenize var="listOfProperties" delim="
">${maven.jnlp.properties}</u:tokenize>
-                    <j:forEach var="someProperty"
items="${listOfProperties}">
-                      <property name="${someProperty}"
value="${context.getVariable(someProperty)}"/>
-                    </j:forEach>
-                    
-                </resources>
-                <j:choose>
-                    <j:when test="${maven.jnlp.isapplet}">
-                        <applet-desc main-class="${maven.jnlp.mainclass}"
name="${maven.jnlp.applet.name}">
-                            <u:tokenize var="listOfArguments" delim="
">${maven.jnlp.mainclass.arguments}</u:tokenize>
-                            <j:forEach var="someArgument"
items="${listOfArguments}">
-                              <argument>${someArgument}</argument>
-                            </j:forEach>
-                        </applet-desc>
-                    </j:when>
-                    <j:when test="${maven.jnlp.isinstaller}">
-                        <installer-desc
main-class="${maven.jnlp.mainclass}"/>
-                    </j:when>
-                    <j:when test="${maven.jnlp.iscomponent}">
-                        <component-desc/>
-                    </j:when>
-                    <j:otherwise>
-                        <application-desc
main-class="${maven.jnlp.mainclass}">
-                            <u:tokenize var="listOfArguments" delim="
">${maven.jnlp.mainclass.arguments}</u:tokenize>
-                            <j:forEach var="someArgument"
items="${listOfArguments}">
-                              <argument>${someArgument}</argument>
-                            </j:forEach>
-                        </application-desc>
-                    </j:otherwise>
-                </j:choose>
-            </jnlp>
-        </j:file>
-        
-        <j:if test="${context.getVariable('maven.jnlp.usejarversions') !=
null}">
-        
-            <ant:echo>Creating ${maven.jnlp.dir}/version.xml ...</ant:echo>
-    
-            <!-- ================== -->
-            <!-- Generate version.xml file -->
-            <!-- ================== -->
-            <j:file name="${maven.jnlp.dir}/version.xml" prettyPrint="true"
-              xmlns="dummy">
-               <jnlp-versions>  
-                <j:forEach var="lib" items="${pom.artifacts}">
-                    <j:set var="dep" value="${lib.dependency}"/>
-                    <j:if test="${(dep.getProperty('jnlp.jar')=='true' or
dep.getProperty('jnlp.native.jar')=='true') and
(dep.version.indexOf('SNAPSHOT') lt 0)}">
-                      <resource>  
-                       <pattern>  
-                         <name>${lib.file.name}</name>  
-                         <j:set var="depVer" value="${dep.version}"/>
-                         <j:if
test="${context.getVariable('maven.jnlp.cert.version') != null}">
-                           <j:set var="depVer"
value="${depVer.concat('-').concat(certVer)}"/>
-                         </j:if>
-                         <version-id>${depVer}</version-id>
-                       </pattern>  
-                       <file>${lib.file.name}</file>  
-                      </resource>  
-                    </j:if>
-                </j:forEach>
-                    <j:if test="${pom.currentVersion.indexOf('SNAPSHOT') lt
0}">
-                      <resource>  
-                       <pattern>  
-                         <name>${final.jar.name}</name>  
-                         <j:set var="depVer"
value="${pom.currentVersion}"/>
-                         <j:if
test="${context.getVariable('maven.jnlp.cert.version') != null}">
-                           <j:set var="depVer"
value="${depVer.concat('-').concat(certVer)}"/>
-                         </j:if>
-                         <version-id>${depVer}</version-id>  
-                       </pattern>  
-                       <file>${final.jar.name}</file>  
-                      </resource>  
-                     </j:if>
-               </jnlp-versions>
-            </j:file>
-        </j:if>
-        
-        
-        <!-- =========================== -->
-        <!-- Copy jars in jnlp directory -->
-        <!-- =========================== -->
-        <ant:available file="${maven.jnlp.signjar.store}"
property="maven.jnlp.store.exists"/>
-        <j:choose>
-          <j:when test="${maven.jnlp.store.exists}">
-
-            <!-- ================ -->
-            <!-- Updates Manifest -->
-            <!-- ================ -->
-            <ant:mkdir dir="${maven.jnlp.tmpdir}"/>
-            
-            <jarfile:updateManifest
-                inputJar="${maven.build.dir}/${maven.final.name}.jar"
-                manifest="${plugin.resources}/jnlp.manifest"
-                outputDir="${maven.jnlp.tmpdir}"
-            />
-            
-            <j:forEach var="lib" items="${pom.artifacts}">
-              <j:set var="dep" value="${lib.dependency}"/>
-              <j:if test="${dep.getProperty('jnlp.jar')=='true'}">
-                <jarfile:updateManifest
-                    inputJar="${lib.file.absolutePath}"
-                    manifest="${plugin.resources}/jnlp.manifest"
-                    outputDir="${maven.jnlp.tmpdir}"
-                />
-              </j:if>
-              <j:if test="${dep.getProperty('jnlp.native.jar')=='true'}">
-                <jarfile:updateManifest
-                    inputJar="${lib.file.absolutePath}"
-                    manifest="${plugin.resources}/jnlp.manifest"
-                    outputDir="${maven.jnlp.tmpdir}"
-                />
-              </j:if>
-            </j:forEach>
-    
-            <!-- ========= -->
-            <!-- Sign jars -->
-            <!-- ========= -->
-            <ant:echo>Found a store...signing jars</ant:echo>
-
-            <ant:echo>Signing jar files ...</ant:echo>
-            <ant:signjar
-                jar="${maven.jnlp.tmpdir}/${maven.final.name}.jar"
-                signedjar="${maven.jnlp.dir}/${maven.final.name}.jar"
-                alias="${maven.jnlp.signjar.alias}"
-                storepass="${maven.jnlp.signjar.storepass}"
-                keystore="${maven.jnlp.signjar.store}"/>
-
-            <j:forEach var="lib" items="${pom.artifacts}">
-              <j:set var="dep" value="${lib.dependency}"/>
-              <j:if test="${dep.getProperty('jnlp.jar')=='true'}">
-                <ant:signjar
-                  jar="${maven.jnlp.tmpdir}/${lib.file.name}"
-                  signedjar="${maven.jnlp.dir}/${lib.file.name}"
-                  alias="${maven.jnlp.signjar.alias}"
-                  storepass="${maven.jnlp.signjar.storepass}"
-                  keystore="${maven.jnlp.signjar.store}"/>
-              </j:if>
-              <j:if test="${dep.getProperty('jnlp.native.jar')=='true'}">
-                <ant:signjar
-                  jar="${maven.jnlp.tmpdir}/${lib.file.name}"
-                  signedjar="${maven.jnlp.dir}/${lib.file.name}"
-                  alias="${maven.jnlp.signjar.alias}"
-                  storepass="${maven.jnlp.signjar.storepass}"
-                  keystore="${maven.jnlp.signjar.store}"/>
-              </j:if>
-            </j:forEach>
-          </j:when>
-          <j:otherwise>
-            <ant:copy todir="${maven.jnlp.dir}" flatten="true">
-              <j:forEach var="lib" items="${pom.artifacts}">
-                <j:set var="dep" value="${lib.dependency}"/>
-                <j:if test="${dep.getProperty('jnlp.jar')=='true'}">
-                  <ant:fileset dir="${lib.file.parent}">
-                    <ant:include name="${lib.file.name}"/>
-                  </ant:fileset>
-                </j:if>
-                <j:if test="${dep.getProperty('jnlp.native.jar')=='true'}">
-                  <ant:fileset dir="${lib.file.parent}">
-                    <ant:include name="${lib.file.name}"/>
-                  </ant:fileset>
-                </j:if>
-              </j:forEach>
-              <ant:fileset dir="${maven.build.dir}">
-                <ant:include name="${maven.final.name}.jar"/>
-              </ant:fileset>
-            </ant:copy>
-          </j:otherwise>
-        </j:choose>
-    </goal>
+		<goal name="jnlp:generate-jnlp" description="Generate the
.jnlp file and sign all jars" prereqs="jar:jar">
+		<ant:mkdir dir="${maven.jnlp.dir}"/>
+		<ant:echo>Creating ${maven.jnlp.dir}/${pom.artifactId}.jnlp
...</ant:echo>
+		<!-- ================== -->
+		<!-- Generate JNLP file -->
+		<!-- ================== -->
+		<maven:property name="maven.jnlp.description"
defaultValue="${pom.description}"/>
+		<maven:property name="maven.jnlp.description.short"
defaultValue="${pom.shortDescription}"/>
+		<maven:property name="maven.jnlp.http.codebase"
defaultValue="${pom.url}"/>
+		<maven:property name="maven.jnlp.signjar.alias"
defaultValue="${pom.artifactId}"/>
+		<maven:property name="maven.jnlp.signjar.dname.o"
defaultValue="${pom.organization.name}"/>
+		<maven:property name="maven.jnlp.title"
defaultValue="${pom.name}"/>
+		<j:set var="final.jar.name"
value="${maven.final.name}.jar"/>
+		<j:file name="${maven.jnlp.dir}/${pom.artifactId}.jnlp"
prettyPrint="true" xmlns="dummy">
+			<jnlp spec="${maven.jnlp.spec}"
codebase="${maven.jnlp.http.codebase}" href="${pom.artifactId}.jnlp">
+				<j:if
test="${context.getVariable('maven.jnlp.cert.version') != null}">
+					<j:set var="certVer"
value="${maven.jnlp.cert.version}"/>
+					<ant:echo>Appending Certificate
Version: ${certVer}</ant:echo>
+				</j:if>
+				<information>
+					<title>${maven.jnlp.title}</title>
+					<j:if
test="${context.getVariable('maven.jnlp.vendor') != null}">
+
<vendor>${maven.jnlp.vendor}</vendor>
+					</j:if>
+					<j:if
test="${context.getVariable('maven.jnlp.homepage') != null}">
+						<homepage
href="${maven.jnlp.homepage}"/>
+					</j:if>
+					<j:if
test="${context.getVariable('maven.jnlp.icon') != null}">
+						<icon
href="${maven.jnlp.icon}"/>
+					</j:if>
+					<j:if
test="${context.getVariable('maven.jnlp.icon.splash') != null}">
+						<icon kind="splash"
href="${maven.jnlp.icon.splash}"/>
+					</j:if>
+					<j:if
test="${context.getVariable('maven.jnlp.description') != null}">
+
<description>${maven.jnlp.description}</description>
+					</j:if>
+					<j:if
test="${context.getVariable('maven.jnlp.description.one-line') != null}">
+						<description
kind="one-line">${maven.jnlp.description.one-line}</description>
+					</j:if>
+					<j:if
test="${context.getVariable('maven.jnlp.description.short') != null}">
+						<description
kind="short">${maven.jnlp.description.short}</description>
+					</j:if>
+					<j:if
test="${context.getVariable('maven.jnlp.description.tooltip') != null}">
+						<description
kind="tooltip">${maven.jnlp.description.tooltip}</description>
+					</j:if>
+					<j:if
test="${context.getVariable('maven.jnlp.offline.allowed') != null}">
+						<offline-allowed/>
+					</j:if>
+				</information>
+				<security>
+					<j:set var="permission"
value="${maven.jnlp.permission}X"/>
+					<j:if test="${permission ==
'allX'}">
+						<all-permissions/>
+					</j:if>
+					<j:if test="${permission ==
'j2eeX'}">
+
<j2ee-application-client-permissions/>
+					</j:if>
+				</security>
+				<resources>
+					<j2se
version="${maven.jnlp.j2se.version}"
initial-heap-size="${maven.jnlp.j2se.heapsize.initial}"
max-heap-size="${maven.jnlp.j2se.heapsize.max}"/>
+					<j:set var="mainExists"
value="false"/>
+					<!-- Determine if one of the
dependencies is the main jar -->
+					<j:forEach var="lib"
items="${pom.artifacts}">
+						<j:set var="dep"
value="${lib.dependency}"/>
+						<j:if
test="${dep.getProperty('jnlp.jar')=='true'}">
+							<j:choose>
+								<j:when
test="${dep.getProperty('jnlp.main.jar')=='true'}">
+
<j:set var="mainExists" value="true"/>
+								</j:when>
+							</j:choose>
+						</j:if>
+					</j:forEach>
+					
+					<!-- Add resource info for current
project -->
+					<j:set var="depVer"
value="${pom.currentVersion}"/>
+					<j:if
test="${context.getVariable('maven.jnlp.cert.version') != null}">
+						<j:set var="depVer"
value="${depVer.concat('-').concat(certVer)}"/>
+					</j:if>
+					<j:choose>
+						<j:when
test="${mainExists=='false'}">
+							<j:choose>
+								<j:when
test="${(context.getVariable('maven.jnlp.usejarversions') != null) and
(pom.currentVersion.indexOf('SNAPSHOT') lt 0)}">
+									<jar
href="${final.jar.name}" main="true" version="${depVer}"/>
+								</j:when>
+
<j:otherwise>
+									<jar
href="${final.jar.name}" main="true"/>
+
</j:otherwise>
+							</j:choose>
+						</j:when>
+						<j:otherwise>
+							<j:choose>
+								<j:when
test="${(context.getVariable('maven.jnlp.usejarversions') != null) and
(pom.currentVersion.indexOf('SNAPSHOT') lt 0)}">
+									<jar
href="${final.jar.name}" version="${depVer}"/>
+								</j:when>
+
<j:otherwise>
+									<jar
href="${final.jar.name}"/>
+
</j:otherwise>
+							</j:choose>
+						</j:otherwise>
+					</j:choose>
+					<!--  This is close to what it WILL
look like, but for now it is the ugly ass thing below  it-->
+					<u:tokenize var="listOfProperties"
delim=" ">${maven.jnlp.properties}</u:tokenize>
+					<j:forEach var="someProperty"
items="${listOfProperties}">
+						<property
name="${someProperty}" value="${context.getVariable(someProperty)}"/>
+					</j:forEach>
+
+					<!-- Add dependencies to jnlp file
-->
+					<j:forEach var="lib"
items="${pom.artifacts}">
+						<j:set var="dep"
value="${lib.dependency}"/>
+						<j:set var="depVer"
value="${dep.version}"/>
+						<j:if
test="${context.getVariable('maven.jnlp.cert.version') != null}">
+							<j:set var="depVer"
value="${depVer.concat('-').concat(certVer)}"/>
+						</j:if>
+						<j:if
test="${dep.getProperty('jnlp.jar')=='true'}">
+							<j:choose>
+								<j:when
test="${dep.getProperty('jnlp.main.jar')=='true'}">
+
<j:set var="mainExists" value="true"/>
+
<j:choose>
+
<j:when test="${(context.getVariable('maven.jnlp.usejarversions') != null)
and (dep.version.indexOf('SNAPSHOT') lt 0)}">
+
<jar href="${lib.file.name}" main="true" version="${depVer}"/>
+
</j:when>
+
<j:otherwise>
+
<jar href="${lib.file.name}" main="true"/>
+
</j:otherwise>
+
</j:choose>
+								</j:when>
+
<j:otherwise>
+
<j:choose>
+
<j:when test="${(context.getVariable('maven.jnlp.usejarversions') != null)
and (dep.version.indexOf('SNAPSHOT') lt 0)}">
+
<jar href="${lib.file.name}" version="${depVer}"/>
+
</j:when>
+
<j:otherwise>
+
<jar href="${lib.file.name}"/>
+
</j:otherwise>
+
</j:choose>
+
</j:otherwise>
+							</j:choose>
+						</j:if>
+						<j:if
test="${dep.getProperty('jnlp.native.jar')=='true'}">
+							<nativelib
href="${lib.file.name}"/>
+						</j:if>
+						<j:if
test="${dep.getProperty('jnlp.extension')=='true'}">
+							<extension
href="${dep.url}"/>
+						</j:if>
+					</j:forEach>
+					
+
+				</resources>
+				<j:choose>
+					<j:when
test="${maven.jnlp.isapplet}">
+						<applet-desc
main-class="${maven.jnlp.mainclass}" name="${maven.jnlp.applet.name}">
+							<u:tokenize
var="listOfArguments" delim="
">${maven.jnlp.mainclass.arguments}</u:tokenize>
+							<j:forEach
var="someArgument" items="${listOfArguments}">
+
<argument>${someArgument}</argument>
+							</j:forEach>
+						</applet-desc>
+					</j:when>
+					<j:when
test="${maven.jnlp.isinstaller}">
+						<installer-desc
main-class="${maven.jnlp.mainclass}"/>
+					</j:when>
+					<j:when
test="${maven.jnlp.iscomponent}">
+						<component-desc/>
+					</j:when>
+					<j:otherwise>
+						<application-desc
main-class="${maven.jnlp.mainclass}">
+							<u:tokenize
var="listOfArguments" delim="
">${maven.jnlp.mainclass.arguments}</u:tokenize>
+							<j:forEach
var="someArgument" items="${listOfArguments}">
+
<argument>${someArgument}</argument>
+							</j:forEach>
+						</application-desc>
+					</j:otherwise>
+				</j:choose>
+			</jnlp>
+		</j:file>
+		<j:if
test="${context.getVariable('maven.jnlp.usejarversions') != null}">
+			<ant:echo>Creating ${maven.jnlp.dir}/version.xml
...</ant:echo>
+			<!-- ================== -->
+			<!-- Generate version.xml file -->
+			<!-- ================== -->
+			<j:file name="${maven.jnlp.dir}/version.xml"
prettyPrint="true" xmlns="dummy">
+				<jnlp-versions>
+					<j:forEach var="lib"
items="${pom.artifacts}">
+						<j:set var="dep"
value="${lib.dependency}"/>
+						<j:if
test="${(dep.getProperty('jnlp.jar')=='true' or
dep.getProperty('jnlp.native.jar')=='true') and
(dep.version.indexOf('SNAPSHOT') lt 0)}">
+							<resource>
+								<pattern>
+
<name>${lib.file.name}</name>
+
<j:set var="depVer" value="${dep.version}"/>
+
<j:if test="${context.getVariable('maven.jnlp.cert.version') != null}">
+
<j:set var="depVer" value="${depVer.concat('-').concat(certVer)}"/>
+
</j:if>
+
<version-id>${depVer}</version-id>
+								</pattern>
+
<file>${lib.file.name}</file>
+							</resource>
+						</j:if>
+					</j:forEach>
+					<j:if
test="${pom.currentVersion.indexOf('SNAPSHOT') lt 0}">
+						<resource>
+							<pattern>
+
<name>${final.jar.name}</name>
+								<j:set
var="depVer" value="${pom.currentVersion}"/>
+								<j:if
test="${context.getVariable('maven.jnlp.cert.version') != null}">
+
<j:set var="depVer" value="${depVer.concat('-').concat(certVer)}"/>
+								</j:if>
+
<version-id>${depVer}</version-id>
+							</pattern>
+
<file>${final.jar.name}</file>
+						</resource>
+					</j:if>
+				</jnlp-versions>
+			</j:file>
+		</j:if>
+		<!-- =========================== -->
+		<!-- Copy jars in jnlp directory -->
+		<!-- =========================== -->
+		<ant:available file="${maven.jnlp.signjar.store}"
property="maven.jnlp.store.exists"/>
+		<j:choose>
+			<j:when test="${maven.jnlp.store.exists}">
+				<!-- ================ -->
+				<!-- Updates Manifest -->
+				<!-- ================ -->
+				<ant:mkdir dir="${maven.jnlp.tmpdir}"/>
+				<jarfile:updateManifest
inputJar="${maven.build.dir}/${maven.final.name}.jar"
manifest="${plugin.resources}/jnlp.manifest"
outputDir="${maven.jnlp.tmpdir}"/>
+				<j:forEach var="lib"
items="${pom.artifacts}">
+					<j:set var="dep"
value="${lib.dependency}"/>
+					<j:if
test="${dep.getProperty('jnlp.jar')=='true'}">
+						<jarfile:updateManifest
inputJar="${lib.file.absolutePath}"
manifest="${plugin.resources}/jnlp.manifest"
outputDir="${maven.jnlp.tmpdir}"/>
+					</j:if>
+					<j:if
test="${dep.getProperty('jnlp.native.jar')=='true'}">
+						<jarfile:updateManifest
inputJar="${lib.file.absolutePath}"
manifest="${plugin.resources}/jnlp.manifest"
outputDir="${maven.jnlp.tmpdir}"/>
+					</j:if>
+				</j:forEach>
+				<!-- ========= -->
+				<!-- Sign jars -->
+				<!-- ========= -->
+				<ant:echo>Found a store...signing
jars</ant:echo>
+				<ant:echo>Signing jar files ...</ant:echo>
+				<ant:signjar
jar="${maven.jnlp.tmpdir}/${maven.final.name}.jar"
signedjar="${maven.jnlp.dir}/${maven.final.name}.jar"
alias="${maven.jnlp.signjar.alias}"
storepass="${maven.jnlp.signjar.storepass}"
keystore="${maven.jnlp.signjar.store}"/>
+				<j:forEach var="lib"
items="${pom.artifacts}">
+					<j:set var="dep"
value="${lib.dependency}"/>
+					<j:if
test="${dep.getProperty('jnlp.jar')=='true'}">
+						<ant:signjar
jar="${maven.jnlp.tmpdir}/${lib.file.name}"
signedjar="${maven.jnlp.dir}/${lib.file.name}"
alias="${maven.jnlp.signjar.alias}"
storepass="${maven.jnlp.signjar.storepass}"
keystore="${maven.jnlp.signjar.store}"/>
+					</j:if>
+					<j:if
test="${dep.getProperty('jnlp.native.jar')=='true'}">
+						<ant:signjar
jar="${maven.jnlp.tmpdir}/${lib.file.name}"
signedjar="${maven.jnlp.dir}/${lib.file.name}"
alias="${maven.jnlp.signjar.alias}"
storepass="${maven.jnlp.signjar.storepass}"
keystore="${maven.jnlp.signjar.store}"/>
+					</j:if>
+				</j:forEach>
+			</j:when>
+			<j:otherwise>
+				<ant:copy todir="${maven.jnlp.dir}"
flatten="true">
+					<j:forEach var="lib"
items="${pom.artifacts}">
+						<j:set var="dep"
value="${lib.dependency}"/>
+						<j:if
test="${dep.getProperty('jnlp.jar')=='true'}">
+							<ant:fileset
dir="${lib.file.parent}">
+								<ant:include
name="${lib.file.name}"/>
+							</ant:fileset>
+						</j:if>
+						<j:if
test="${dep.getProperty('jnlp.native.jar')=='true'}">
+							<ant:fileset
dir="${lib.file.parent}">
+								<ant:include
name="${lib.file.name}"/>
+							</ant:fileset>
+						</j:if>
+					</j:forEach>
+					<ant:fileset
dir="${maven.build.dir}">
+						<ant:include
name="${maven.final.name}.jar"/>
+					</ant:fileset>
+				</ant:copy>
+			</j:otherwise>
+		</j:choose>
+	</goal>
     
     <!-- ==================================================================
-->
     <!-- Generate keystore file for signing jar files
-->
Index: xdocs/properties.xml
===================================================================
retrieving revision 1.8
diff -u -r1.8 properties.xml
--- xdocs/properties.xml	4 Mar 2004 18:36:13 -0000	1.8
+++ xdocs/properties.xml	24 Mar 2004 17:10:28 -0000
@@ -412,6 +412,21 @@
       </properties>
     </dependency>
   ]]></source>
+  
+      <p>
+      Or for extensions :
+      </p>
+
+  <source><![CDATA[
+    <dependency>
+      <id>jarid</id>
+      <version>jarversion</version>
+      <url>http://some.host/path/to/installer.jnlp</url>
+      <properties>
+        <jnlp.extension>true</jnlp.extension>
+      </properties>
+    </dependency>
+  ]]></source>
     </section>
     <section name="How to define the main jar?">
       <p>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [patch] jnlp plugin

Posted by Emmanuel Venisse <em...@venisse.net>.
Could you create a correct patch?
Your patch rewrite all plugin lines. It's not simple to view changes.

After, you'll can post it in our issue tracker
(http://jira.codehaus.org/secure/BrowseProject.jspa?id=10342)
Thanks

Emmanuel

----- Original Message ----- 
From: "Brent Paschall" <bp...@spheris.com>
To: <de...@maven.apache.org>
Sent: Wednesday, March 24, 2004 6:45 PM
Subject: [patch] jnlp plugin


> Greetings,
>
> The jnlp plugin has been a huge help to some recent development efforts of
> mine.  In order to meet all my requirements, I needed two additional
> features that I believe might be of use to others, so I am submitting a
> patch for the following:
>
> 1) Tweaked classpath generation.  I was having a problem where some
> dependencies of the jnlp app I was using had some (log4j) configuration
> files that were named identically to those in my app.  Because the
resource
> tags for dependencies are generated in the jnlp file prior to the resource
> tag for the project being built, the dependencies appear on the jnlp
> classpath before the project code, overriding the project's files.  The
> attached patch resolves this by always putting the resource tag for the
> current project ahead of any dependencies.
>
> 2) Added basic support for extensions.  The jnlp plugin already supports
the
> generation of jar and native jar resources.  The patch also adds support
for
> generating extension resources.  A <jnlp.extension>true</jnlp.extension>
> added to the properties of a dependency will create an extension resource
in
> the jnlp file with an href set to the url of the dependency. The patch
also
> updates the properties documentation to reflect this change.  Basic
support
> means that there are additional attributes and subtags of <extension> that
> are not included in this patch.
>
> Hope this helps!
>
> Brent A. Paschall
> Spheris
> 615-261-1575
> bpaschall@spheris.com
>
> Index: plugin.jelly
> ===================================================================
> retrieving revision 1.24
> diff -u -r1.24 plugin.jelly
> --- plugin.jelly 4 Mar 2004 18:36:13 -0000 1.24
> +++ plugin.jelly 24 Mar 2004 17:10:28 -0000
> @@ -41,313 +41,277 @@
>          description="Generate JNLP file and sign all jars"
>          prereqs="jnlp:generate-jnlp"/>
>
> -    <goal name="jnlp:generate-jnlp"
> -             description="Generate the .jnlp file and sign all jars"
> -             prereqs="jar:jar">
> -
> -        <ant:mkdir dir="${maven.jnlp.dir}"/>
> -        <ant:echo>Creating ${maven.jnlp.dir}/${pom.artifactId}.jnlp
> ...</ant:echo>
> -
> -        <!-- ================== -->
> -        <!-- Generate JNLP file -->
> -        <!-- ================== -->
> -        <maven:property name="maven.jnlp.description"
> defaultValue="${pom.description}"/>
> -        <maven:property name="maven.jnlp.description.short"
> defaultValue="${pom.shortDescription}"/>
> -        <maven:property name="maven.jnlp.http.codebase"
> defaultValue="${pom.url}"/>
> -        <maven:property name="maven.jnlp.signjar.alias"
> defaultValue="${pom.artifactId}"/>
> -        <maven:property name="maven.jnlp.signjar.dname.o"
> defaultValue="${pom.organization.name}"/>
> -        <maven:property name="maven.jnlp.title"
> defaultValue="${pom.name}"/>
> -        <j:set var="final.jar.name" value="${maven.final.name}.jar"/>
> -
> -        <j:file name="${maven.jnlp.dir}/${pom.artifactId}.jnlp"
> prettyPrint="true"
> -          xmlns="dummy">
> -
> -
> -            <jnlp spec="${maven.jnlp.spec}"
> -              codebase="${maven.jnlp.http.codebase}"
> -              href="${pom.artifactId}.jnlp">
> -            <j:if test="${context.getVariable('maven.jnlp.cert.version')
!=
> null}">
> -              <j:set var="certVer" value="${maven.jnlp.cert.version}"/>
> -              <ant:echo>Appending Certificate Version:
> ${certVer}</ant:echo>
> -            </j:if>
> -
> -              <information>
> -                <title>${maven.jnlp.title}</title>
> -                  <j:if test="${context.getVariable('maven.jnlp.vendor')
!=
> null}">
> -                    <vendor>${maven.jnlp.vendor}</vendor>
> -                  </j:if>
> -                  <j:if
test="${context.getVariable('maven.jnlp.homepage')
> != null}">
> -                    <homepage href="${maven.jnlp.homepage}"/>
> -                  </j:if>
> -                  <j:if test="${context.getVariable('maven.jnlp.icon') !=
> null}">
> -                    <icon href="${maven.jnlp.icon}"/>
> -                  </j:if>
> -                  <j:if
> test="${context.getVariable('maven.jnlp.icon.splash') != null}">
> -                    <icon kind="splash"
href="${maven.jnlp.icon.splash}"/>
> -                  </j:if>
> -                  <j:if
> test="${context.getVariable('maven.jnlp.description') != null}">
> -                    <description>${maven.jnlp.description}</description>
> -                  </j:if>
> -                  <j:if
> test="${context.getVariable('maven.jnlp.description.one-line') != null}">
> -                    <description
> kind="one-line">${maven.jnlp.description.one-line}</description>
> -                  </j:if>
> -                  <j:if
> test="${context.getVariable('maven.jnlp.description.short') != null}">
> -                    <description
> kind="short">${maven.jnlp.description.short}</description>
> -                  </j:if>
> -                  <j:if
> test="${context.getVariable('maven.jnlp.description.tooltip') != null}">
> -                    <description
> kind="tooltip">${maven.jnlp.description.tooltip}</description>
> -                    </j:if>
> -                    <j:if
> test="${context.getVariable('maven.jnlp.offline.allowed') != null}">
> -                        <offline-allowed/>
> -                    </j:if>
> -                </information>
> -                <security>
> -                    <j:set var="permission"
> value="${maven.jnlp.permission}X"/>
> -                    <j:if test="${permission == 'allX'}">
> -                        <all-permissions/>
> -                    </j:if>
> -                    <j:if test="${permission == 'j2eeX'}">
> -                        <j2ee-application-client-permissions/>
> -                    </j:if>
> -                </security>
> -
> -                <resources>
> -                    <j2se version="${maven.jnlp.j2se.version}"
> -
> initial-heap-size="${maven.jnlp.j2se.heapsize.initial}"
> -
> max-heap-size="${maven.jnlp.j2se.heapsize.max}"/>
> -                    <j:set var="mainExists" value="false"/>
> -
> -                    <j:forEach var="lib" items="${pom.artifacts}">
> -                        <j:set var="dep" value="${lib.dependency}"/>
> -                        <j:set var="depVer" value="${dep.version}"/>
> -                        <j:if
> test="${context.getVariable('maven.jnlp.cert.version') != null}">
> -                          <j:set var="depVer"
> value="${depVer.concat('-').concat(certVer)}"/>
> -                        </j:if>
> -                        <j:if
> test="${dep.getProperty('jnlp.jar')=='true'}">
> -                            <j:choose>
> -                              <j:when
> test="${dep.getProperty('jnlp.main.jar')=='true'}">
> -                                <j:set var="mainExists" value="true"/>
> -                                <j:choose>
> -                                  <j:when
> test="${(context.getVariable('maven.jnlp.usejarversions') != null) and
> (dep.version.indexOf('SNAPSHOT') lt 0)}">
> -                                       <jar href="${lib.file.name}"
> main="true" version="${depVer}"/>
> -                                  </j:when>
> -                                  <j:otherwise>
> -                                    <jar href="${lib.file.name}"
> main="true"/>
> -                                  </j:otherwise>
> -                                </j:choose>
> -                              </j:when>
> -                              <j:otherwise>
> -                                <j:choose>
> -                                  <j:when
> test="${(context.getVariable('maven.jnlp.usejarversions') != null) and
> (dep.version.indexOf('SNAPSHOT') lt 0)}">
> -                                      <jar href="${lib.file.name}"
> version="${depVer}"/>
> -                                  </j:when>
> -                                  <j:otherwise>
> -                                    <jar href="${lib.file.name}" />
> -                                  </j:otherwise>
> -                                </j:choose>
> -                              </j:otherwise>
> -                            </j:choose>
> -                        </j:if>
> -                        <j:if
> test="${dep.getProperty('jnlp.native.jar')=='true'}">
> -                            <nativelib href="${lib.file.name}"/>
> -                        </j:if>
> -                    </j:forEach>
> -                    <j:set var="depVer" value="${pom.currentVersion}"/>
> -                    <j:if
> test="${context.getVariable('maven.jnlp.cert.version') != null}">
> -                      <j:set var="depVer"
> value="${depVer.concat('-').concat(certVer)}"/>
> -                    </j:if>
> -                    <j:choose>
> -                        <j:when test="${mainExists=='false'}">
> -                            <j:choose>
> -                              <j:when
> test="${(context.getVariable('maven.jnlp.usejarversions') != null) and
> (pom.currentVersion.indexOf('SNAPSHOT') lt 0)}">
> -                                <jar href="${final.jar.name}" main="true"
> version="${depVer}"/>
> -                              </j:when>
> -                              <j:otherwise>
> -                                <jar href="${final.jar.name}"
main="true"/>
> -                              </j:otherwise>
> -                            </j:choose>
> -                        </j:when>
> -                        <j:otherwise>
> -                            <j:choose>
> -                              <j:when
> test="${(context.getVariable('maven.jnlp.usejarversions') != null) and
> (pom.currentVersion.indexOf('SNAPSHOT') lt 0)}">
> -                                <jar href="${final.jar.name}"
> version="${depVer}"/>
> -                              </j:when>
> -                              <j:otherwise>
> -                                <jar href="${final.jar.name}" />
> -                              </j:otherwise>
> -                            </j:choose>
> -                        </j:otherwise>
> -                    </j:choose>
> -                    <!--  This is close to what it WILL look like, but
for
> now it is the ugly ass thing below  it-->
> -
> -                    <u:tokenize var="listOfProperties" delim="
> ">${maven.jnlp.properties}</u:tokenize>
> -                    <j:forEach var="someProperty"
> items="${listOfProperties}">
> -                      <property name="${someProperty}"
> value="${context.getVariable(someProperty)}"/>
> -                    </j:forEach>
> -
> -                </resources>
> -                <j:choose>
> -                    <j:when test="${maven.jnlp.isapplet}">
> -                        <applet-desc main-class="${maven.jnlp.mainclass}"
> name="${maven.jnlp.applet.name}">
> -                            <u:tokenize var="listOfArguments" delim="
> ">${maven.jnlp.mainclass.arguments}</u:tokenize>
> -                            <j:forEach var="someArgument"
> items="${listOfArguments}">
> -                              <argument>${someArgument}</argument>
> -                            </j:forEach>
> -                        </applet-desc>
> -                    </j:when>
> -                    <j:when test="${maven.jnlp.isinstaller}">
> -                        <installer-desc
> main-class="${maven.jnlp.mainclass}"/>
> -                    </j:when>
> -                    <j:when test="${maven.jnlp.iscomponent}">
> -                        <component-desc/>
> -                    </j:when>
> -                    <j:otherwise>
> -                        <application-desc
> main-class="${maven.jnlp.mainclass}">
> -                            <u:tokenize var="listOfArguments" delim="
> ">${maven.jnlp.mainclass.arguments}</u:tokenize>
> -                            <j:forEach var="someArgument"
> items="${listOfArguments}">
> -                              <argument>${someArgument}</argument>
> -                            </j:forEach>
> -                        </application-desc>
> -                    </j:otherwise>
> -                </j:choose>
> -            </jnlp>
> -        </j:file>
> -
> -        <j:if test="${context.getVariable('maven.jnlp.usejarversions') !=
> null}">
> -
> -            <ant:echo>Creating ${maven.jnlp.dir}/version.xml
...</ant:echo>
> -
> -            <!-- ================== -->
> -            <!-- Generate version.xml file -->
> -            <!-- ================== -->
> -            <j:file name="${maven.jnlp.dir}/version.xml"
prettyPrint="true"
> -              xmlns="dummy">
> -               <jnlp-versions>
> -                <j:forEach var="lib" items="${pom.artifacts}">
> -                    <j:set var="dep" value="${lib.dependency}"/>
> -                    <j:if test="${(dep.getProperty('jnlp.jar')=='true' or
> dep.getProperty('jnlp.native.jar')=='true') and
> (dep.version.indexOf('SNAPSHOT') lt 0)}">
> -                      <resource>
> -                       <pattern>
> -                         <name>${lib.file.name}</name>
> -                         <j:set var="depVer" value="${dep.version}"/>
> -                         <j:if
> test="${context.getVariable('maven.jnlp.cert.version') != null}">
> -                           <j:set var="depVer"
> value="${depVer.concat('-').concat(certVer)}"/>
> -                         </j:if>
> -                         <version-id>${depVer}</version-id>
> -                       </pattern>
> -                       <file>${lib.file.name}</file>
> -                      </resource>
> -                    </j:if>
> -                </j:forEach>
> -                    <j:if test="${pom.currentVersion.indexOf('SNAPSHOT')
lt
> 0}">
> -                      <resource>
> -                       <pattern>
> -                         <name>${final.jar.name}</name>
> -                         <j:set var="depVer"
> value="${pom.currentVersion}"/>
> -                         <j:if
> test="${context.getVariable('maven.jnlp.cert.version') != null}">
> -                           <j:set var="depVer"
> value="${depVer.concat('-').concat(certVer)}"/>
> -                         </j:if>
> -                         <version-id>${depVer}</version-id>
> -                       </pattern>
> -                       <file>${final.jar.name}</file>
> -                      </resource>
> -                     </j:if>
> -               </jnlp-versions>
> -            </j:file>
> -        </j:if>
> -
> -
> -        <!-- =========================== -->
> -        <!-- Copy jars in jnlp directory -->
> -        <!-- =========================== -->
> -        <ant:available file="${maven.jnlp.signjar.store}"
> property="maven.jnlp.store.exists"/>
> -        <j:choose>
> -          <j:when test="${maven.jnlp.store.exists}">
> -
> -            <!-- ================ -->
> -            <!-- Updates Manifest -->
> -            <!-- ================ -->
> -            <ant:mkdir dir="${maven.jnlp.tmpdir}"/>
> -
> -            <jarfile:updateManifest
> -                inputJar="${maven.build.dir}/${maven.final.name}.jar"
> -                manifest="${plugin.resources}/jnlp.manifest"
> -                outputDir="${maven.jnlp.tmpdir}"
> -            />
> -
> -            <j:forEach var="lib" items="${pom.artifacts}">
> -              <j:set var="dep" value="${lib.dependency}"/>
> -              <j:if test="${dep.getProperty('jnlp.jar')=='true'}">
> -                <jarfile:updateManifest
> -                    inputJar="${lib.file.absolutePath}"
> -                    manifest="${plugin.resources}/jnlp.manifest"
> -                    outputDir="${maven.jnlp.tmpdir}"
> -                />
> -              </j:if>
> -              <j:if test="${dep.getProperty('jnlp.native.jar')=='true'}">
> -                <jarfile:updateManifest
> -                    inputJar="${lib.file.absolutePath}"
> -                    manifest="${plugin.resources}/jnlp.manifest"
> -                    outputDir="${maven.jnlp.tmpdir}"
> -                />
> -              </j:if>
> -            </j:forEach>
> -
> -            <!-- ========= -->
> -            <!-- Sign jars -->
> -            <!-- ========= -->
> -            <ant:echo>Found a store...signing jars</ant:echo>
> -
> -            <ant:echo>Signing jar files ...</ant:echo>
> -            <ant:signjar
> -                jar="${maven.jnlp.tmpdir}/${maven.final.name}.jar"
> -                signedjar="${maven.jnlp.dir}/${maven.final.name}.jar"
> -                alias="${maven.jnlp.signjar.alias}"
> -                storepass="${maven.jnlp.signjar.storepass}"
> -                keystore="${maven.jnlp.signjar.store}"/>
> -
> -            <j:forEach var="lib" items="${pom.artifacts}">
> -              <j:set var="dep" value="${lib.dependency}"/>
> -              <j:if test="${dep.getProperty('jnlp.jar')=='true'}">
> -                <ant:signjar
> -                  jar="${maven.jnlp.tmpdir}/${lib.file.name}"
> -                  signedjar="${maven.jnlp.dir}/${lib.file.name}"
> -                  alias="${maven.jnlp.signjar.alias}"
> -                  storepass="${maven.jnlp.signjar.storepass}"
> -                  keystore="${maven.jnlp.signjar.store}"/>
> -              </j:if>
> -              <j:if test="${dep.getProperty('jnlp.native.jar')=='true'}">
> -                <ant:signjar
> -                  jar="${maven.jnlp.tmpdir}/${lib.file.name}"
> -                  signedjar="${maven.jnlp.dir}/${lib.file.name}"
> -                  alias="${maven.jnlp.signjar.alias}"
> -                  storepass="${maven.jnlp.signjar.storepass}"
> -                  keystore="${maven.jnlp.signjar.store}"/>
> -              </j:if>
> -            </j:forEach>
> -          </j:when>
> -          <j:otherwise>
> -            <ant:copy todir="${maven.jnlp.dir}" flatten="true">
> -              <j:forEach var="lib" items="${pom.artifacts}">
> -                <j:set var="dep" value="${lib.dependency}"/>
> -                <j:if test="${dep.getProperty('jnlp.jar')=='true'}">
> -                  <ant:fileset dir="${lib.file.parent}">
> -                    <ant:include name="${lib.file.name}"/>
> -                  </ant:fileset>
> -                </j:if>
> -                <j:if
test="${dep.getProperty('jnlp.native.jar')=='true'}">
> -                  <ant:fileset dir="${lib.file.parent}">
> -                    <ant:include name="${lib.file.name}"/>
> -                  </ant:fileset>
> -                </j:if>
> -              </j:forEach>
> -              <ant:fileset dir="${maven.build.dir}">
> -                <ant:include name="${maven.final.name}.jar"/>
> -              </ant:fileset>
> -            </ant:copy>
> -          </j:otherwise>
> -        </j:choose>
> -    </goal>
> + <goal name="jnlp:generate-jnlp" description="Generate the
> .jnlp file and sign all jars" prereqs="jar:jar">
> + <ant:mkdir dir="${maven.jnlp.dir}"/>
> + <ant:echo>Creating ${maven.jnlp.dir}/${pom.artifactId}.jnlp
> ...</ant:echo>
> + <!-- ================== -->
> + <!-- Generate JNLP file -->
> + <!-- ================== -->
> + <maven:property name="maven.jnlp.description"
> defaultValue="${pom.description}"/>
> + <maven:property name="maven.jnlp.description.short"
> defaultValue="${pom.shortDescription}"/>
> + <maven:property name="maven.jnlp.http.codebase"
> defaultValue="${pom.url}"/>
> + <maven:property name="maven.jnlp.signjar.alias"
> defaultValue="${pom.artifactId}"/>
> + <maven:property name="maven.jnlp.signjar.dname.o"
> defaultValue="${pom.organization.name}"/>
> + <maven:property name="maven.jnlp.title"
> defaultValue="${pom.name}"/>
> + <j:set var="final.jar.name"
> value="${maven.final.name}.jar"/>
> + <j:file name="${maven.jnlp.dir}/${pom.artifactId}.jnlp"
> prettyPrint="true" xmlns="dummy">
> + <jnlp spec="${maven.jnlp.spec}"
> codebase="${maven.jnlp.http.codebase}" href="${pom.artifactId}.jnlp">
> + <j:if
> test="${context.getVariable('maven.jnlp.cert.version') != null}">
> + <j:set var="certVer"
> value="${maven.jnlp.cert.version}"/>
> + <ant:echo>Appending Certificate
> Version: ${certVer}</ant:echo>
> + </j:if>
> + <information>
> + <title>${maven.jnlp.title}</title>
> + <j:if
> test="${context.getVariable('maven.jnlp.vendor') != null}">
> +
> <vendor>${maven.jnlp.vendor}</vendor>
> + </j:if>
> + <j:if
> test="${context.getVariable('maven.jnlp.homepage') != null}">
> + <homepage
> href="${maven.jnlp.homepage}"/>
> + </j:if>
> + <j:if
> test="${context.getVariable('maven.jnlp.icon') != null}">
> + <icon
> href="${maven.jnlp.icon}"/>
> + </j:if>
> + <j:if
> test="${context.getVariable('maven.jnlp.icon.splash') != null}">
> + <icon kind="splash"
> href="${maven.jnlp.icon.splash}"/>
> + </j:if>
> + <j:if
> test="${context.getVariable('maven.jnlp.description') != null}">
> +
> <description>${maven.jnlp.description}</description>
> + </j:if>
> + <j:if
> test="${context.getVariable('maven.jnlp.description.one-line') != null}">
> + <description
> kind="one-line">${maven.jnlp.description.one-line}</description>
> + </j:if>
> + <j:if
> test="${context.getVariable('maven.jnlp.description.short') != null}">
> + <description
> kind="short">${maven.jnlp.description.short}</description>
> + </j:if>
> + <j:if
> test="${context.getVariable('maven.jnlp.description.tooltip') != null}">
> + <description
> kind="tooltip">${maven.jnlp.description.tooltip}</description>
> + </j:if>
> + <j:if
> test="${context.getVariable('maven.jnlp.offline.allowed') != null}">
> + <offline-allowed/>
> + </j:if>
> + </information>
> + <security>
> + <j:set var="permission"
> value="${maven.jnlp.permission}X"/>
> + <j:if test="${permission ==
> 'allX'}">
> + <all-permissions/>
> + </j:if>
> + <j:if test="${permission ==
> 'j2eeX'}">
> +
> <j2ee-application-client-permissions/>
> + </j:if>
> + </security>
> + <resources>
> + <j2se
> version="${maven.jnlp.j2se.version}"
> initial-heap-size="${maven.jnlp.j2se.heapsize.initial}"
> max-heap-size="${maven.jnlp.j2se.heapsize.max}"/>
> + <j:set var="mainExists"
> value="false"/>
> + <!-- Determine if one of the
> dependencies is the main jar -->
> + <j:forEach var="lib"
> items="${pom.artifacts}">
> + <j:set var="dep"
> value="${lib.dependency}"/>
> + <j:if
> test="${dep.getProperty('jnlp.jar')=='true'}">
> + <j:choose>
> + <j:when
> test="${dep.getProperty('jnlp.main.jar')=='true'}">
> +
> <j:set var="mainExists" value="true"/>
> + </j:when>
> + </j:choose>
> + </j:if>
> + </j:forEach>
> +
> + <!-- Add resource info for current
> project -->
> + <j:set var="depVer"
> value="${pom.currentVersion}"/>
> + <j:if
> test="${context.getVariable('maven.jnlp.cert.version') != null}">
> + <j:set var="depVer"
> value="${depVer.concat('-').concat(certVer)}"/>
> + </j:if>
> + <j:choose>
> + <j:when
> test="${mainExists=='false'}">
> + <j:choose>
> + <j:when
> test="${(context.getVariable('maven.jnlp.usejarversions') != null) and
> (pom.currentVersion.indexOf('SNAPSHOT') lt 0)}">
> + <jar
> href="${final.jar.name}" main="true" version="${depVer}"/>
> + </j:when>
> +
> <j:otherwise>
> + <jar
> href="${final.jar.name}" main="true"/>
> +
> </j:otherwise>
> + </j:choose>
> + </j:when>
> + <j:otherwise>
> + <j:choose>
> + <j:when
> test="${(context.getVariable('maven.jnlp.usejarversions') != null) and
> (pom.currentVersion.indexOf('SNAPSHOT') lt 0)}">
> + <jar
> href="${final.jar.name}" version="${depVer}"/>
> + </j:when>
> +
> <j:otherwise>
> + <jar
> href="${final.jar.name}"/>
> +
> </j:otherwise>
> + </j:choose>
> + </j:otherwise>
> + </j:choose>
> + <!--  This is close to what it WILL
> look like, but for now it is the ugly ass thing below  it-->
> + <u:tokenize var="listOfProperties"
> delim=" ">${maven.jnlp.properties}</u:tokenize>
> + <j:forEach var="someProperty"
> items="${listOfProperties}">
> + <property
> name="${someProperty}" value="${context.getVariable(someProperty)}"/>
> + </j:forEach>
> +
> + <!-- Add dependencies to jnlp file
> -->
> + <j:forEach var="lib"
> items="${pom.artifacts}">
> + <j:set var="dep"
> value="${lib.dependency}"/>
> + <j:set var="depVer"
> value="${dep.version}"/>
> + <j:if
> test="${context.getVariable('maven.jnlp.cert.version') != null}">
> + <j:set var="depVer"
> value="${depVer.concat('-').concat(certVer)}"/>
> + </j:if>
> + <j:if
> test="${dep.getProperty('jnlp.jar')=='true'}">
> + <j:choose>
> + <j:when
> test="${dep.getProperty('jnlp.main.jar')=='true'}">
> +
> <j:set var="mainExists" value="true"/>
> +
> <j:choose>
> +
> <j:when test="${(context.getVariable('maven.jnlp.usejarversions') != null)
> and (dep.version.indexOf('SNAPSHOT') lt 0)}">
> +
> <jar href="${lib.file.name}" main="true" version="${depVer}"/>
> +
> </j:when>
> +
> <j:otherwise>
> +
> <jar href="${lib.file.name}" main="true"/>
> +
> </j:otherwise>
> +
> </j:choose>
> + </j:when>
> +
> <j:otherwise>
> +
> <j:choose>
> +
> <j:when test="${(context.getVariable('maven.jnlp.usejarversions') != null)
> and (dep.version.indexOf('SNAPSHOT') lt 0)}">
> +
> <jar href="${lib.file.name}" version="${depVer}"/>
> +
> </j:when>
> +
> <j:otherwise>
> +
> <jar href="${lib.file.name}"/>
> +
> </j:otherwise>
> +
> </j:choose>
> +
> </j:otherwise>
> + </j:choose>
> + </j:if>
> + <j:if
> test="${dep.getProperty('jnlp.native.jar')=='true'}">
> + <nativelib
> href="${lib.file.name}"/>
> + </j:if>
> + <j:if
> test="${dep.getProperty('jnlp.extension')=='true'}">
> + <extension
> href="${dep.url}"/>
> + </j:if>
> + </j:forEach>
> +
> +
> + </resources>
> + <j:choose>
> + <j:when
> test="${maven.jnlp.isapplet}">
> + <applet-desc
> main-class="${maven.jnlp.mainclass}" name="${maven.jnlp.applet.name}">
> + <u:tokenize
> var="listOfArguments" delim="
> ">${maven.jnlp.mainclass.arguments}</u:tokenize>
> + <j:forEach
> var="someArgument" items="${listOfArguments}">
> +
> <argument>${someArgument}</argument>
> + </j:forEach>
> + </applet-desc>
> + </j:when>
> + <j:when
> test="${maven.jnlp.isinstaller}">
> + <installer-desc
> main-class="${maven.jnlp.mainclass}"/>
> + </j:when>
> + <j:when
> test="${maven.jnlp.iscomponent}">
> + <component-desc/>
> + </j:when>
> + <j:otherwise>
> + <application-desc
> main-class="${maven.jnlp.mainclass}">
> + <u:tokenize
> var="listOfArguments" delim="
> ">${maven.jnlp.mainclass.arguments}</u:tokenize>
> + <j:forEach
> var="someArgument" items="${listOfArguments}">
> +
> <argument>${someArgument}</argument>
> + </j:forEach>
> + </application-desc>
> + </j:otherwise>
> + </j:choose>
> + </jnlp>
> + </j:file>
> + <j:if
> test="${context.getVariable('maven.jnlp.usejarversions') != null}">
> + <ant:echo>Creating ${maven.jnlp.dir}/version.xml
> ...</ant:echo>
> + <!-- ================== -->
> + <!-- Generate version.xml file -->
> + <!-- ================== -->
> + <j:file name="${maven.jnlp.dir}/version.xml"
> prettyPrint="true" xmlns="dummy">
> + <jnlp-versions>
> + <j:forEach var="lib"
> items="${pom.artifacts}">
> + <j:set var="dep"
> value="${lib.dependency}"/>
> + <j:if
> test="${(dep.getProperty('jnlp.jar')=='true' or
> dep.getProperty('jnlp.native.jar')=='true') and
> (dep.version.indexOf('SNAPSHOT') lt 0)}">
> + <resource>
> + <pattern>
> +
> <name>${lib.file.name}</name>
> +
> <j:set var="depVer" value="${dep.version}"/>
> +
> <j:if test="${context.getVariable('maven.jnlp.cert.version') != null}">
> +
> <j:set var="depVer" value="${depVer.concat('-').concat(certVer)}"/>
> +
> </j:if>
> +
> <version-id>${depVer}</version-id>
> + </pattern>
> +
> <file>${lib.file.name}</file>
> + </resource>
> + </j:if>
> + </j:forEach>
> + <j:if
> test="${pom.currentVersion.indexOf('SNAPSHOT') lt 0}">
> + <resource>
> + <pattern>
> +
> <name>${final.jar.name}</name>
> + <j:set
> var="depVer" value="${pom.currentVersion}"/>
> + <j:if
> test="${context.getVariable('maven.jnlp.cert.version') != null}">
> +
> <j:set var="depVer" value="${depVer.concat('-').concat(certVer)}"/>
> + </j:if>
> +
> <version-id>${depVer}</version-id>
> + </pattern>
> +
> <file>${final.jar.name}</file>
> + </resource>
> + </j:if>
> + </jnlp-versions>
> + </j:file>
> + </j:if>
> + <!-- =========================== -->
> + <!-- Copy jars in jnlp directory -->
> + <!-- =========================== -->
> + <ant:available file="${maven.jnlp.signjar.store}"
> property="maven.jnlp.store.exists"/>
> + <j:choose>
> + <j:when test="${maven.jnlp.store.exists}">
> + <!-- ================ -->
> + <!-- Updates Manifest -->
> + <!-- ================ -->
> + <ant:mkdir dir="${maven.jnlp.tmpdir}"/>
> + <jarfile:updateManifest
> inputJar="${maven.build.dir}/${maven.final.name}.jar"
> manifest="${plugin.resources}/jnlp.manifest"
> outputDir="${maven.jnlp.tmpdir}"/>
> + <j:forEach var="lib"
> items="${pom.artifacts}">
> + <j:set var="dep"
> value="${lib.dependency}"/>
> + <j:if
> test="${dep.getProperty('jnlp.jar')=='true'}">
> + <jarfile:updateManifest
> inputJar="${lib.file.absolutePath}"
> manifest="${plugin.resources}/jnlp.manifest"
> outputDir="${maven.jnlp.tmpdir}"/>
> + </j:if>
> + <j:if
> test="${dep.getProperty('jnlp.native.jar')=='true'}">
> + <jarfile:updateManifest
> inputJar="${lib.file.absolutePath}"
> manifest="${plugin.resources}/jnlp.manifest"
> outputDir="${maven.jnlp.tmpdir}"/>
> + </j:if>
> + </j:forEach>
> + <!-- ========= -->
> + <!-- Sign jars -->
> + <!-- ========= -->
> + <ant:echo>Found a store...signing
> jars</ant:echo>
> + <ant:echo>Signing jar files ...</ant:echo>
> + <ant:signjar
> jar="${maven.jnlp.tmpdir}/${maven.final.name}.jar"
> signedjar="${maven.jnlp.dir}/${maven.final.name}.jar"
> alias="${maven.jnlp.signjar.alias}"
> storepass="${maven.jnlp.signjar.storepass}"
> keystore="${maven.jnlp.signjar.store}"/>
> + <j:forEach var="lib"
> items="${pom.artifacts}">
> + <j:set var="dep"
> value="${lib.dependency}"/>
> + <j:if
> test="${dep.getProperty('jnlp.jar')=='true'}">
> + <ant:signjar
> jar="${maven.jnlp.tmpdir}/${lib.file.name}"
> signedjar="${maven.jnlp.dir}/${lib.file.name}"
> alias="${maven.jnlp.signjar.alias}"
> storepass="${maven.jnlp.signjar.storepass}"
> keystore="${maven.jnlp.signjar.store}"/>
> + </j:if>
> + <j:if
> test="${dep.getProperty('jnlp.native.jar')=='true'}">
> + <ant:signjar
> jar="${maven.jnlp.tmpdir}/${lib.file.name}"
> signedjar="${maven.jnlp.dir}/${lib.file.name}"
> alias="${maven.jnlp.signjar.alias}"
> storepass="${maven.jnlp.signjar.storepass}"
> keystore="${maven.jnlp.signjar.store}"/>
> + </j:if>
> + </j:forEach>
> + </j:when>
> + <j:otherwise>
> + <ant:copy todir="${maven.jnlp.dir}"
> flatten="true">
> + <j:forEach var="lib"
> items="${pom.artifacts}">
> + <j:set var="dep"
> value="${lib.dependency}"/>
> + <j:if
> test="${dep.getProperty('jnlp.jar')=='true'}">
> + <ant:fileset
> dir="${lib.file.parent}">
> + <ant:include
> name="${lib.file.name}"/>
> + </ant:fileset>
> + </j:if>
> + <j:if
> test="${dep.getProperty('jnlp.native.jar')=='true'}">
> + <ant:fileset
> dir="${lib.file.parent}">
> + <ant:include
> name="${lib.file.name}"/>
> + </ant:fileset>
> + </j:if>
> + </j:forEach>
> + <ant:fileset
> dir="${maven.build.dir}">
> + <ant:include
> name="${maven.final.name}.jar"/>
> + </ant:fileset>
> + </ant:copy>
> + </j:otherwise>
> + </j:choose>
> + </goal>
>
>      <!-- 
==================================================================
> -->
>      <!-- Generate keystore file for signing jar files
> -->
> Index: xdocs/properties.xml
> ===================================================================
> retrieving revision 1.8
> diff -u -r1.8 properties.xml
> --- xdocs/properties.xml 4 Mar 2004 18:36:13 -0000 1.8
> +++ xdocs/properties.xml 24 Mar 2004 17:10:28 -0000
> @@ -412,6 +412,21 @@
>        </properties>
>      </dependency>
>    ]]></source>
> +
> +      <p>
> +      Or for extensions :
> +      </p>
> +
> +  <source><![CDATA[
> +    <dependency>
> +      <id>jarid</id>
> +      <version>jarversion</version>
> +      <url>http://some.host/path/to/installer.jnlp</url>
> +      <properties>
> +        <jnlp.extension>true</jnlp.extension>
> +      </properties>
> +    </dependency>
> +  ]]></source>
>      </section>
>      <section name="How to define the main jar?">
>        <p>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org