> Hack the jar plugin :)

Ok, you have said.

Here is a patch that allows use of user-supplied manifest file.

This file wil be merged with Maven-supplied properties (Created-By,
version properties etc.) and included in JAR-file.
If there is no user-supplied manifest file the behaviour is the same as
now just Maven-generated properties will be in manifest file included in
JAR-file.
User may set property maven.jar.manifest to specify path to manifest
file. Default is ${basedir}/Manifest.mf (or may be
${basedir}/src/Manifest.mf is better?)

The patch created again maven-1.0-beta-6 distribution.

bash-2.04$ diff -rub maven-1.0-beta-6.orig/plugins/maven-java-plugin-1.0
maven-1.0-beta-6/plugins/maven-java-plugin-1.0
diff -rub
maven-1.0-beta-6.orig/plugins/maven-java-plugin-1.0/plugin.jelly
maven-1.0-beta-6/plugins/maven-java-plugin-1.
0/plugin.jelly
--- maven-1.0-beta-6.orig/plugins/maven-java-plugin-1.0/plugin.jelly
Tue Aug 20 08:31:10 2002
+++ maven-1.0-beta-6/plugins/maven-java-plugin-1.0/plugin.jelly Wed Sep
4 12:47:06 2002
@@ -100,10 +100,22 @@
         description="Create the deliverable jar file."
         prereqs="test:test">

+    <available property="maven.jar.manifest.available"
file="${maven.jar.manifest}" />
+    <j:choose>
+      <j:when test="${maven.jar.manifest.available}">
+        <echo>Using manifest file ${maven.jar.manifest}</echo>
+      </j:when>
+      <j:otherwise>
+        <touch file="${maven.build.dir}/Manifest.mf" />
+        <j:set var="maven.jar.manifest"
value="${maven.build.dir}/Manifest.mf" />
+      </j:otherwise>
+    </j:choose>
+
     <jar
       jarfile="${maven.build.dir}/${maven.final.name}.jar"
       basedir="${maven.build.dest}"
-      excludes="${maven.jar.excludes}">
+      excludes="${maven.jar.excludes}"
+      manifest="${maven.jar.manifest}">

       <metainf dir="${basedir}">
         <include name="LICENSE.txt"/>
diff -rub
maven-1.0-beta-6.orig/plugins/maven-java-plugin-1.0/project.properties
maven-1.0-beta-6/plugins/maven-java-plu
gin-1.0/project.properties
---
maven-1.0-beta-6.orig/plugins/maven-java-plugin-1.0/project.properties
Tue Aug 20 08:31:10 2002
+++ maven-1.0-beta-6/plugins/maven-java-plugin-1.0/project.properties
Wed Sep  4 12:45:58 2002
@@ -3,3 +3,4 @@
 # -------------------------------------------------------------------

 #maven.jarResources.basedir = src
+maven.jar.manifest = ${basedir}/Manifest.mf

> --
> dIon Gillard, Multitask Consulting
> Work:      http://www.multitask.com.au
> Developers: http://adslgateway.multitask.com.au/developers
> 
> 
> "Alexei Barantsev" <[EMAIL PROTECTED]> wrote on 04/09/2002 
> 12:00:57 AM:
> 
> > Hi!
> > 
> > I need to create jar file with Main-Class directive.
> > How to do that with Maven?
> > 
> > --
> > Alexei Barantsev, ISP RAS
> > E-mail: [EMAIL PROTECTED]
> > ICQ   : 3959207
> 




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to