Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Maven 3: Plugin execution not covered by lifecycle configuration #22

Closed
Raptor399 opened this Issue Jan 8, 2012 · 10 comments

Comments

Projects
None yet
5 participants

Hi,

Thanks for this great plugin!
I am using it with Maven 3, configured as follows:

        <plugin>
            <groupId>pl.project13.maven</groupId>
            <artifactId>git-commit-id-plugin</artifactId>
            <version>1.9</version>
            <executions>
                <execution>
                    <phase>initialize</phase>
                    <goals>
                        <goal>revision</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <dateFormat>yyyy-MM-dd</dateFormat>
                <verbose>false</verbose>
                <generateGitPropertiesFile>false</generateGitPropertiesFile>
            </configuration>
        </plugin>

However, Eclipse does not like it and reports an error at the <execution> line:

Plugin execution not covered by lifecycle configuration: pl.project13.maven:git-commit-id-plugin:1.9:revision (execution: default, phase: initialize)

On Mac OS X it works regardless, but on Windows the error results in a build failure.

I have experimented a bit to see if other phases would work. It turns out that of the default Maven lifecycle only the following are accepted by Eclipse:

  • test
  • package
  • verify
  • install
  • deploy

Sadly, all of these phases are too late to make use of the properties.

Is there a way to get Maven 3 to run the plugin before the process-resources phase ("initialize" would be ideal)?

@ghost ghost assigned ktoso Jan 8, 2012

Owner

ktoso commented Jan 8, 2012

Hello,
I'm glad you're using and like the plugin.
I've also been using it successfuly with Maven3, so it's not the issue here - but windows is ;-)

First tip/idea: Why do you need to specify <phase>initialize</phase>? It shouldn't be required - just use:

<execution> 
  <goals>
    <goal>revision</goal>
  </goals>
</execution>

and it should work fine. Let's try this first, and eventually come up with something else if it doesn't resolve your problem. Looking forward to hearing from you :-) IMHO it might be windows specific, so you may want to include the error it's giving you on windows so we can debug further.

Btw, another nice visualisation of maven phases: http://cvs.peopleware.be/training/maven/maven2/buildLifecyclePhases.html

That's how I started out: without the explicit <phase>initialize</phase>.
Eclipse (Indigo Service Release 1, build 20110916-0149) does not like it that way either:

Eclipse warning

Exactly the same as with the explicit phase definition.

Mind you, I'm on Mac OS X myself and can't really test to see it fail on Windows.
I merely get the reports back from others that their building results in the exact same problems that the Eclipse warnings predict. I assume Eclipse somehow knows wrong from right. ;-)

I stripped down the pom.xml to only contain the git-commit-id-plugin and still the warning persists, so I'm pretty sure it's something with my local repository or the plugin.

Hope this information helps you.

People have investigated some more; the plugin works with the "initialize" phase on Windows as expected.
Another problem in the build process was clouding the reports.

Eclipse is still giving the error warning (also on Windows), but it can safely be ignored.

I'm closing this issue because everything appears to work as advertised.
Thanks for the assistance!

@Raptor399 Raptor399 closed this Jan 11, 2012

Owner

ktoso commented Jan 11, 2012

Cool - I'm glad it's working for you :-)

Thanks for the feedback!

kdhunter commented Nov 2, 2012

You can get rid of the Eclipse warning by following the steps listed in here: http://wiki.eclipse.org/M2E_plugin_execution_not_covered
Basically, "quick fix" to ignore, and then change "ignore" to "execute". This gives M2E the metadata it needs.

This adds a section to your pom file that only Eclipse uses:

    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>pl.project13.maven</groupId>
                                    <artifactId>git-commit-id-plugin</artifactId>
                                    <versionRange>[2.1.1,)</versionRange>
                                    <goals>
                                        <goal>revision</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute/>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

afinnell commented Dec 8, 2012

Why was this closed? It is simple to add a src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml

Owner

ktoso commented Dec 8, 2012

I probably missed the last comment.
So... basically just adding the above snippet to my pom will make eclipse happy?
I like @afinnell's way of dealing with this more (lifecycle-mapping-metadata.xml)...
I'll look into that, but it would really help me out (time-wise) if you could do a pull req :-)

Note to self: Related docs: http://wiki.eclipse.org/M2E_compatible_maven_plugins

@ktoso ktoso reopened this Dec 8, 2012

afinnell commented Dec 9, 2012

Already ahead of you. Making and verifying the change now.

Owner

ktoso commented Dec 9, 2012

Awesome 👍

@ktoso ktoso closed this in ac59173 Dec 9, 2012

@TheSnoozer TheSnoozer added this to the 2.1.3 milestone Sep 23, 2017

Collaborator

TheSnoozer commented Sep 23, 2017

fixed by #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment