Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] Modifying manifest.mf during 'generate-resources' phase?

I have an Eclipse plugin which needs to bundle some platform-specific native resources in the generated bundle. (I.e. a whole bunch of stuff listed for "Bundle-Native" in the manifest).

With the required Bundle-Native files existing locally on disk at the locations specified in the manifest, everything compiles and packages fine, both inside Eclipse using the normal plugin tooling, and via the command line with Maven (I'm not yet concerned with using m2e).

However, what I actually need to do is download those native resource dependencies on the fly during the build.

I've already solved the resolve/download/unpack part of the issue using the ivy-maven-plugin (downloads from a non-maven-compatible artifact path) and maven-antrun-plugin (to extract the subset of files from what's downloaded into the Bundle-Native specified location) during the 'generate-resources' lifecycle phase.

Unfortunately, if the Bundle-Native resources don't exist at the time of the maven build (i.e. files aren't downloaded yet, but the manifest still contains the Bundle-Native reference), the build fails.  (I suppose it fails the 'validate' lifecycle invocation, though I'm not positive -- the 'generate-resources' phase definitely isn't reached, though).

So... the thought was to gut the existing manifest.mf and remove the Bundle-Native block, and then generate a custom manifest.mf during the 'generate-resources' phase (just a guess - I think it really just needs to happen before 'packaging'?).

Attempts to use org.apache.felix's maven-bundle-plugin are skipped, as that only runs for 'jar' and 'bundle' packaging types -- but the plugin is using tycho's 'eclipse-plugin'.

Here's what would likely work if maven-bundle-plugin could be used:

        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>2.3.7</version>
          <extensions>true</extensions>
          <executions>
            <execution>
              <phase>generate-resources</phase>
              <goals>
                <goal>manifest</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <instructions>
              <Bundle-NativeCode>
                /path/to/somefile;
                osname=win32;
                processor=x86
              </Bundle-NativeCode>
            </instructions>
          </configuration>
        </plugin>

Maven command-line output from using the above:

[INFO] --- maven-bundle-plugin:2.3.7:manifest (default) @ com.mgam.mforce.gdk.ogre ---
[WARNING] Ignoring project type eclipse-plugin - supportedProjectTypes = [jar, bundle]


So, does anybody have an idea how I can accomplish this?

Cheers,
David


Back to the top