e-gineering/gitflow-helper-maven-plugin

Exception when using full qualified goals

tompluess opened this issue · 3 comments

Maven commands fail when using full qualified goals on commandline, when gitflow-helper-maven-plugin is configured to have extensions enabled (as described on README.md).

e.g.: mvn org.codehaus.mojo:versions-maven-plugin:2.1:set

It fails in #descriptorCreator.findPluginForPrefix(prefix, session) in class MasterPromoteExtension, line 66.

Context:
This happend in using gitflow-helper-maven-plugin in conjunction with the gitflow-maven-plugin, where mvn commands are executed on the commandline.

tl;dr Try adding this to your pom.xml and let me know if it resolves the issue. I'll revisit if we should fail the build on line 68 based on an exception from line 66.

...
<build>
    <plugins>
    ...
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>versions-maven-plugin</artifactId>
            <version>2.1</version>
        </plugin>
    ...
    </plugins>
</build>

You shouldn't have to define any goals in your pom for the versions plugin, but the extension will want to be able to resolve it.

-- Longer response below --

Judging from what I'm seeing in you bug report, and looking through the source for the gitflow-maven-plugin source, the gitflow-maven-plugin is effectively doing sub-shell exeuctions of maven to execute alternate plugin goals outside the scope of the initial maven execution.

Since it's referencing plugin goals which don't resolve to plugins in your pom, the sub-execution fails, which is going to cause other problems.

Based on what I'm seeing in your log, you might be able to get away with just adding a plugin section for the org.codehaus.mojo:versions-maven-plugin to your pom as a hold-over for a better fix in this extension. Perhaps we shouldn't fail the master build if we can't resolve the plugin for the arbitrary goal...

One improvement I could see, would be to modify our extension so it only tries to resolve goals to plugins when it is run from the 'master' branch, and to not 'error' when it runs across a goal it cannot map to a plugin in the pom.

I think if we only log warnings when we cannot resolve, then it would make a lot of sense. Since clearly the user wanted those goals to execute, or they wouldn't have tried to include them on the command line.

thanks for your reply!

actually I added a plugin configuration for the versions-maven-plugin, but that does not help since the gitflow-maven-plugin calls full qualified goals.

However, thanks for removing throwing an exception on unresolvable plugin. I'll try with version 1.7.1

Wow. yeah. I'm not sure why I had that tossing exceptions. I think that was a hold-over from some of the very early trial & error with modifying the plugins that will execute during the build.

Please let me know if it works better, and if it doesn't, if you could give me a really verbose example I'll try to run through it and reproduce, so I know what to address.