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

Proper Usage of Release Plugin #20

Closed
johnpfeifer4 opened this issue Mar 5, 2013 · 8 comments
Closed

Proper Usage of Release Plugin #20

johnpfeifer4 opened this issue Mar 5, 2013 · 8 comments

Comments

@johnpfeifer4
Copy link

I'm new to gradle and I'm looking to port my existing maven builds to gradle this year. One of the biggest requirements that I have is that we must be able to cut release builds like we do with maven today. I've been working on migrating a single project to gradle using the release plugin but it doesn't seem to work as I would expect it to. Basically, I'm looking for behavior like I have with maven today.

  1. run gradle release with a snapshot version
  2. version is updated from 1.0.0-SNAPSHOT to 1.0.0
  3. build runs and if it succeeds, 1.0.0 artifacts are tagged and published to the repo
  4. version is updated to 1.0.1-SNAPSHOT and checked in

My project has several subprojects... build.gradle looks like this. When I run the build I would expect the tagged version to have a non-snapshot version in the gradle.properties (it has the snapshot version). Also, the SNAPSHOT artifacts are published, not the 1.0.0 versioned artifacts. I'm sure that I'm doing something wrong, so any help would be appreciated!

apply from: "https://launchpad.net/gradle-release/trunk/1.0/+download/apply.groovy"
.....

uploadArchives {
def mvnUser = 'XXX'
def mvnPassword = 'YYY'
repositories.mavenDeployer {
//configuration = configurations.mavenDeployer
uniqueVersion = false
def mainPom = addFilter('main') {artifact, file -> !artifact.name.endsWith("-tests") }
def testsPom = addFilter('tests') {artifact, file -> artifact.name.endsWith("-tests") }
def poms = [ mainPom, testsPom ]
poms.each { it.version = project.version }

    repository(url: 'http://maven01.xxx.com:8080/nexus/content/repositories/releases') {
        authentication(userName: "${mvnUser}", password: "${mvnPassword}")
    }

    snapshotRepository(url: 'http://maven01.xxx.com:8080/nexus/content/repositories/snapshots') {
        authentication(userName: "${mvnUser}", password: "${mvnPassword}")
    }

}

}
release {
project.setProperty("gradle.release.useAutomaticVersion", "true");
//project.setProperty("gradle.release.unSnapshotVersion", "true");
tagPrefix = "enterprise-services-common"
preCommitText = "ESC-3 Release Build"
preTagCommitMessage = "ESC-3 Release Build"
tagCommitMessage = "ESC-3 Release Build"
newVersionCommitMessage = "ESC-3 Release Build"
}

@townsfolk
Copy link
Contributor

Looks like you're using an older version of the plugin. Please try this instead:
apply from: 'http://www.tellurianring.com/projects/gradle-plugins/gradle-release/1.2.0.1/apply-1.2.0.1.groovy'

@townsfolk
Copy link
Contributor

Sorry, the installation script wasn't set up correctly - it was set to download version 1.0. If you already tried this, please clear out your gradle cache and try again.

@johnpfeifer4
Copy link
Author

I'm not quite sure what you mean by clearing the gradle cache... If that means rm -rf ~/.gradle and rm -rf .gradle (in the project directory) then I did that. I'm still seeing that the snapshot versions are the ones that are promoted to my nexus repo.

@townsfolk
Copy link
Contributor

That's what I meant, thanks. :) Can you verify in the gradle cache that you're getting the 1.2.0.1 version of the jar file?

Also, at what stage are you adding uploadArchives?
I'm assuming you did it as described in the README: createReleaseTag.dependsOn uploadArchives

That correct?

Tested this with a mock project: https://sourceforge.net/p/gradlerelease/git

Started with version = 1.2.2-SNAPSHOT. Using the latest dev version of the gradle-release plugin, did a release:
http://tellurianring.com/projects/gradle-plugins/release-test/1.2.2/ivy-1.2.2.xml

@johnpfeifer4
Copy link
Author

I see the following in my cache....

./caches/artifacts-23/filestore/gradle-release/gradle-release/1.2.0.1/jar
./caches/artifacts-23/filestore/gradle-release/gradle-release/1.2.0.1/jar/be7f1803d8667e3978c8341e17757fe28dfec0a7/gradle-release-1.2.0.1.jar

I should also note that I'm using subversion as well. In addition, I did include the following line from the readme

createReleaseTag.dependsOn uploadArchives

@townsfolk
Copy link
Contributor

Great. Thank you for checking, and the additional info. I will check it out with a subversion project.

@townsfolk
Copy link
Contributor

Hmm. I tested this with a svn project:
https://sourceforge.net/p/gradlerelease/svn

Again started with version 1.0-SNAPSHOT, ran release process and the 1.0 (no snapshot) version was uploaded:
http://tellurianring.com/projects/gradle-plugins/release-test-svn/1.0/ivy-1.0.xml

I was using a local install of the gradle-release plugin (version 1.2.0.2), but the changes are minimal and don't meddle with the process at all.

Still, I pushed 1.2.0.2 out for you if you'd like to try it, change your apply script to this:
apply from: 'http://tellurianring.com/projects/gradle-plugins/gradle-release/1.2.0.2/apply.groovy'

Not sure why the 1.2.0.1 version isn't working for you.

@townsfolk
Copy link
Contributor

Going to consider this closed, if it's still not working for you please re-open it.

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

No branches or pull requests

2 participants