aleksandr-m / gitflow-maven-plugin

The Git-Flow Maven Plugin supports various Git workflows, including GitFlow and GitHub Flow. This plugin runs Git and Maven commands from the command line.
https://aleksandr-m.github.io/gitflow-maven-plugin/
Apache License 2.0
492 stars 182 forks source link

Releasing multi-module project fails on snapshot dependencies #180

Closed safiahlberg closed 4 years ago

safiahlberg commented 5 years ago

I just upgraded from 1.10.0 to 1.12.0 and now the release fails due to snapshot dependencies in my multi module build, the snapshots are present in the dependencies betweeen child-modules, but not in external dependencies.

This seems to have worked (for me) in the 1.10.0 version, but now the behaviour is different?

To clarify: In level 1 I have the parent pom In level 2 I have 2 modules, with a dependency on a module in level 3 In level 3 I have 1 module

The dependency on the lvl 3 module is a snapshot dependency, this is how I have understood that dependencies in multi-module project is to be set up.

I may have misunderstood something in Mavens dependency mechanism or how the plugin works.

Or could this be issue #39 that has reappeared?

safiahlberg commented 5 years ago

Now I have done bisect, and for me, the first rev that causes this problem is 3499b324a8bdd7e1c4b0214b269f183443051196 which closes issue #169

aleksandr-m commented 5 years ago

@safiahlberg Can you provide some test project to reproduce this issue.

safiahlberg commented 5 years ago

@aleksandr-m I made a small test project which has the same structure as my production project, but I couldn’t reproduce the error. So it’s not impossible that my production project has a flaw, or maybe I was unable to capture the situation that causes the fault with my test project.

I will look more closely into this and let you know if I find anything suspicious.

manderson23 commented 5 years ago

I think #182 is similar to this.

glianeric commented 5 years ago

I have just run into the same problem. I have provided the parameter true, but I'm getting:

build 15-Jul-2019 07:37:13 [WARNING] :[inherited] -> Dependency {groupId=x, artifactId=y, version=1.1.21-SNAPSHOT, type=z}

for each module of the multi-module build.

I'll try to build a project to reproduce, but one of the main things that are going on here is a several-level inheritance. What we have is:

framework-parent-pom (defines all the stuff, including gitflow plugin definition for all of framework) domain-pom (inherits the framework parent) multi-module build (inherits the domain-pom)

So I ran with -X and I get release-start configured with: build 15-Jul-2019 10:31:30 [DEBUG] (f) useSnapshotInRelease = true Unfortunately, it seems that this is ignored for module dependencies.

The work-around is to add 'allowSnapshots' as true for release-start, but then we have to split release-start and release-finish (as opposed to running them in the same command) since I don't want to risk having snapshots in a release.

Note: I'm still testing this part because I've run into another issue with this plugin that has to do with how it runs the maven lifecycle, I think.

glianeric commented 5 years ago

Further comments: Splitting release-start and release-finish does not work, both need -DallowSnapshots=true despite the fact that useSnapshotInRelease is provided (inherited through POM hierarchy).

As I understand it, -DallowSnapshots=true is not a good work-around as I risk having snapshots in my release. I have enough controls to live with it for now, but it would be nice to get this fixed.

I'll try to come up with a reasonable test project to fix this.

glianeric commented 5 years ago

I suggest making the check for snapshots ignore reactor dependencies until after the version is set to release for the modules, just before the release build begins. At that point it would be correct to check for any snapshots whatsoever. I note that also I can build with snapshot versions of plugins (they are not checked).

manderson23 commented 5 years ago

Coincidentally the project I reported #182 against may also have had multiple levels of parent poms but I can't confirm at the moment.

On Tue, 16 Jul 2019, 15:34 glianeric, notifications@github.com wrote:

I suggest making the check for snapshots ignore reactor dependencies until after the version is set to release for the modules, just before the release build begins. At that point it would be correct to check for any snapshots whatsoever. I note that also I can build with snapshot versions of plugins (they are not checked).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aleksandr-m/gitflow-maven-plugin/issues/180?email_source=notifications&email_token=AAM3JILQ2HVTA2VKTUHQ2G3P7XE7DA5CNFSM4HTQLOY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2A3TOY#issuecomment-511818171, or mute the thread https://github.com/notifications/unsubscribe-auth/AAM3JIIFQ5NIO3NT24FPQFTP7XE7DANCNFSM4HTQLOYQ .

aleksandr-m commented 4 years ago

Should be fixed by #204.