Skip to main content

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

Thanks, Simon.  That information indeed got the 'maven-bundle-plugin' executing.  However, I'm still having difficulty getting the generated manifest file packaged.

My first attempt was to include the 'maven-jar-plugin' into the build, and specify the manifest file location that was generated by 'maven-bundle-plugin'.  That didn't work, as the 'eclipse-plugin' packaging uses 'tycho-packaging-plugin' to generate the .JAR, which I'm thinking I need to retain.

I can't see a way to configure 'tycho-packaging-plugin' to grab my generated manifest.  I tried configuring 'tycho-packaging-plugin' with

      <plugin>
        <groupId>${tycho-groupId}</groupId>
        <artifactId>tycho-packaging-plugin</artifactId>
        <version>${tycho-version}</version>
        <configuration>
          <archive>
            <manifestFile>${project.build.directory}/whatever/output/dir/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
        <goals>
          <goal>jar</goal>
        </goals>
      </plugin>

...but the "archive" configuration for that plugin isn't the typical maven-jar-plugin archive block, but rather some classpath class identifier(?).

Furthermore, if I configure 'maven-bundle-plugin' to generate the manifest to ${project.build.directory} (where any pre-existing manifest gets copied to as part of packaging), it appears it gets overwritten with the pre-existing manifest.mf file (I'm guessing as part of the 'prepare-package' phase).

I can't seem to get manifest.mf generation to occur as part of the 'prepare-package' phase, but after whatever the tycho plugins are doing.  Nor can I get manifest generation to occur as part of the 'package' phase, but before 'tycho-packaging-plugin' generates the .JAR.

Any ideas?



On Fri, Mar 30, 2012 at 1:53 AM, Simon Goodall <simon.goodall@xxxxxxxxxxxxxxx> wrote:
David,

You need to add 'eclipse-plugin' to supportedProjectTypes in the
maven-bundle-plugin configuration. See [1].

[1] http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html

Simon

On 30 March 2012 00:52, David Aldridge <daldridge@xxxxxxxxx> wrote:
> 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
>
>
> _______________________________________________
> tycho-user mailing list
> tycho-user@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/tycho-user
>
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user


Back to the top