Platform: Ubuntu 8.04, Intel Pentium M,
          maven 2.0.8,
          maven-antrun-plugin 1.1

I have a <plugin> config to fix the version numbers of OSGi bundles for
snapshot version.  Eg. change "1.1.0-SNAPSHOT" to "1.1.0.SNAPSHOT".  The
full <plugin> config is shown at the end of this message.

It works by:
 - unzipping the bundle jar
 - fixing the META-INF/MANIFEST.MF
 - zipping up the jar again

This is done in the verify phase, so that it should be performed after
the jar:jar goal, which is done in the package phase, and before the
install phase.

The problem is that the <zip> isn't always executed when running the
bundle projects as part of a multi-project.  And when the <zip> target
isn't run, the bundle doesn't have the correct version number (the
bundles aren't proper bundles.  They are meant as scaffolding for
thirdparty libraries.  That's why only the META-INF directory is
packaged up).

Which projects in the multi-project that fails, differs from run to run.
I build with "mvn clean install.

Does anyone know why this might fail?  Is it some sort of timing issue?


When it works it looks like this
    [unzip] Expanding: 
/home/sb/p4/depot/myproj/MAIN/com.mycompany.thirdparty.commons.codec/target/com.mycompany.thirdparty.commons.codec_1.1.0-SNAPSHOT.jar
 into 
/home/sb/p4/depot/myproj/MAIN/com.mycompany.thirdparty.commons.codec/target
      [zip] Building zip: 
/home/sb/p4/depot/myproj/MAIN/com.mycompany.thirdparty.commons.codec/target/com.mycompany.thirdparty.commons.codec_1.1.0-SNAPSHOT.jar

When it fails, there's just the [unzip] line.  And sometimes I see
something like this:
    [unzip] Expanding: 
/home/sb/p4/depot/myproj/MAIN/com.mycompany.thirdparty.xercesimpl/target/com.mycompany.thirdparty.xercesimpl_1.1.0-SNAPSHOT.jar
 into /home/sb/p4/depot/myproj/MAIN/com.mycompany.thirdparty.xercesimpl/target
      [zip] Warning: META-INF/maven modified in the future.
      [zip] Warning: META-INF/maven/com.mycompany.thirdparty.xercesimpl 
modified in the future.
      [zip] Warning: 
META-INF/maven/com.mycompany.thirdparty.xercesimpl/com.mycompany.thirdparty.xercesimpl
 modified in the future.

(no NFS mounted drives to give modify time strangeness.  Everything is
taking place on the same ext3 filesystem, with a single-core Pentium-M)

I've followed this pattern in other places, to fix things in zip and jar
files, but I have never seen strangeness like this.


The full <plugin> config looks like this:
   <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
     <execution>
      <id>fix-snapshot-bundle-version</id>
      <goals>
       <goal>run</goal>
      </goals>
      <phase>verify</phase>
      <configuration>
       <tasks>
        <unzip src="${project.build.directory}/${artifactId}_${version}.jar" 
dest="${project.build.directory}" />
        <replace file="${project.build.directory}/META-INF/MANIFEST.MF" 
token="-SNAPSHOT" value=".SNAPSHOT" />
        <zip destfile="${project.build.directory}/${artifactId}_${version}.jar">
         <fileset dir="${project.build.directory}" includes="META-INF/**" />
        </zip>
       </tasks>
      </configuration>
     </execution>
    </executions>
   </plugin>


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

Reply via email to