0

In my eclipse workspace, saving a file in a java editor makes m2e run defaultGoal (install) on the project, which involves rewritting the MANIFEST.MF file. Because I am using another plugin that has no m2e connector (maven-scr-plugin), this makes my manifest file useless.

What I would like to do is prevent the maven-bundle-plugin from being executed on save, and I've so far come up with two possible solutions:

You can edit the eclipse lifecycle mappings, but this just won't do the trick for some reason (I do think it should):

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
    <pluginExecutions>
        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <versionRange>[0.0,)</versionRange>
                <goals>
                    <goal>instructions</goal>
                    <goal>bundle</goal>
                    <goal>manifest</goal>
                </goals>
            </pluginExecutionFilter>
            <action>
                <ignore />
            </action>
        </pluginExecution>
    </pluginExecutions>
</lifecycleMappingMetadata>

Alternatively, changing the defaultGoal in my pom.xml's <build> to something like compile would also mean not getting to the point where the bundle plugin kicks in, but I'd really hate to change my pom because of an eclipse peculiarity.

Is there a way to define a defaultGoal for the m2e plugin? Do you guys have any other approach for this? Thanks!

Miquel
  • 15,405
  • 8
  • 54
  • 87

2 Answers2

0

You can use your own manifest file as described in http://maven.apache.org/shared/maven-archiver/examples/manifestFile.html

Zilvinas
  • 5,518
  • 3
  • 26
  • 26
  • Thanks for your answer! I actually need to have a dynamically generated manifest, but only if it's later enriched by the other plugins. Because eclipse is missing some of the connectors for those plugins, it generates an incomplete manifest, so I'd rather it doesn't touch it and I keep using the one from the last full build – Miquel May 29 '13 at 09:26
0

So far, the only solution I've found (but which actually works) is setting <defaultGoal> to compile in my parent pom. It solves the problem, but as said in the question, it's far from optimal because it spreads eclipse stuff into an otherwise IDE independent build.

Miquel
  • 15,405
  • 8
  • 54
  • 87