RobWin / jgitflow-gradle-plugin

A Gradle Plugin which adds tasks to support the Gitflow Workflow.
Apache License 2.0
48 stars 44 forks source link

Fails in multi-module projects #12

Closed mrollo closed 8 years ago

mrollo commented 8 years ago

If I attempt to use this plugin in multiple module projects (featureStart, releaseStart, etc.) it fails because it tells git to create the new feature/release branch for as many modules as there are in the project. Git then errors out when trying to create a branch that already exists:

$ ./gradlew featureStart -PfeatureName=test-feature
Incremental java compilation is an incubating feature.
:libraryone:featureStart
:librarytwo:featureStart FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':librarytwo:featureStart'.
> com.atlassian.jgitflow.core.exception.LocalBranchExistsException: local branch 'feature/test-feature' already exists
RobWin commented 8 years ago

Hi, where did you apply the plugin? In the root project or in a subproject closure?

mrollo commented 8 years ago

Thanks for the fast response @RobWin

My project's root build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'io.github.robwin:jgitflow-gradle-plugin:0.3.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

subprojects {
    apply plugin: 'io.github.robwin.jgitflow'
}

allprojects {
    repositories {
        jcenter()
    }
}
RobWin commented 8 years ago

Could you please try to apply the plugin on the root and not inside of the allprojects and subprojects closures.

mrollo commented 8 years ago

That worked - thank you. I see that your documentation did specify to do this. I think I was following the pattern of another project and missed this in your docs.

RobWin commented 8 years ago

No problem. If it works for you, feel free to close the issue.

RobWin commented 8 years ago

If you like the plugin, I would love to get your GitHub star.

mrollo commented 8 years ago

Done and done.