Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to use it in an external script #280

Open
AGuyNamedRichie opened this issue Jan 14, 2019 · 3 comments
Open

Make it possible to use it in an external script #280

AGuyNamedRichie opened this issue Jan 14, 2019 · 3 comments

Comments

@AGuyNamedRichie
Copy link

AGuyNamedRichie commented Jan 14, 2019

Hi,

I want to use the plugin in an external (init.gradle) script so that is automatically applied to every gradle project we use.

E.g:
init.gradle

rootproject{
buildscript {
  repositories {
    maven {
      url 'https://plugins.gradle.org/m2/'
    }
  }
  dependencies {
    classpath 'net.researchgate:gradle-release:2.8.0'
  }
}
}
gradle.projectsEvaluated{rootProject{apply plugin: 'net.researchgate.release'}}

This works fine as the plugin is correctly applied to the project, but I am unable to produce a release with

gradle release -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=1.0.0 -Prelease.newVersion=1.1.0-SNAPSHOT

because I always get a warning about an uncommmited gradle.properties file (see #237 ). It works if I apply the project directly to project, but this is cumbersome and can easily be forgotten if you have many projects. Even if I skip the uncommitedFilesCheck the task never finishes because there is an endless loop:

> Task :gr-tutorial:gr-tutorial:checkCommitNeeded
!!WARNING!! You have uncommitted files:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 M gradle.properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> Task :gr-tutorial:gr-tutorial:gr-tutorial:checkCommitNeeded
!!WARNING!! You have uncommitted files:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 M gradle.properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> Task :gr-tutorial:gr-tutorial:gr-tutorial:gr-tutorial:checkCommitNeeded
!!WARNING!! You have uncommitted files:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 M gradle.properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

How can this be fixed?

@Hillkorn
Copy link
Collaborator

Did you also tried to not use the projectsEvaluated and instead just apply it? Like

rootproject{
buildscript {
  repositories {
    maven {
      url 'https://plugins.gradle.org/m2/'
    }
  }
  dependencies {
    classpath 'net.researchgate:gradle-release:2.8.0'
  }
}
  rootProject{apply plugin: 'net.researchgate.release'}
}

@AGuyNamedRichie
Copy link
Author

AGuyNamedRichie commented Jan 14, 2019

I have tried it, but this doesn't work:

* What went wrong:
Plugin with id 'net.researchgate.release' not found.

@Vampire
Copy link
Contributor

Vampire commented Aug 25, 2019

Try applying it by type instead of ID.
See here for more info: gradle/gradle#1262

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

No branches or pull requests

3 participants