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

Problem integrating plugin with gradle-git... #19

Closed
philbeiler opened this issue Nov 24, 2014 · 8 comments
Closed

Problem integrating plugin with gradle-git... #19

philbeiler opened this issue Nov 24, 2014 · 8 comments
Assignees
Milestone

Comments

@philbeiler
Copy link

I think this plugin is great, but I can't get it to work when I combine it with another plugin...
classpath 'org.ajoberstar:gradle-git:0.12.0'

the currentVersion and verifyRelease methods work as expected...
~/workspace/publish-example$ gradle currentVersion
:currentVersion
Project version: 0.1.16-SNAPSHOT
BUILD SUCCESSFUL
Total time: 1.36 secs

but when I say

gradle r
:verifyRelease
Looking for uncommited changes..
Checking if branch is ahead of remote..
:release FAILED
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':release'.

    Input string is NULL or empty

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    BUILD FAILED

Caused by: java.lang.IllegalArgumentException: Input string is NULL or empty
at com.github.zafarkhaja.semver.VersionParser.(VersionParser.java:162)
at com.github.zafarkhaja.semver.VersionParser.parsePreRelease(VersionParser.java:222)
at com.github.zafarkhaja.semver.Version.setPreReleaseVersion(Version.java:431)
at com.github.zafarkhaja.semver.Version$setPreReleaseVersion$2.call(Unknown Source)
at pl.allegro.tech.build.axion.release.ReleaseTask.release(ReleaseTask.groovy:40)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)

If I take out the gradle-git plugin - the release works as expected. Any ideas?

BTW - I think this is a great alternative for releasing, especially coming from a maven background.

Simple script -- just comment out the line - and you see it breaks...

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'pl.allegro.tech.build', name: 'axion-release-plugin', version: '0.9.4'
// classpath 'org.ajoberstar:gradle-git:0.12.0'
}
}
apply plugin: 'axion-release'
apply plugin: 'maven-publish'

scmVersion {
tag {
prefix = 'release'
}
}

project.group = 'com.yourdomain'
project.version = scmVersion.version

def artifactRepositoryURL
if (project.version.toString().contains("-SNAPSHOT")) {
artifactRepositoryURL = 'http://localhost:8081/content/repositories/snapshots/'
}
else {
artifactRepositoryURL = 'http://localhost:8081/content/repositories/releases/'
}

repositories {
mavenCentral ()
}

dependencies {
}

publishing {
publications {
myPublication(MavenPublication) {
artifact ('README.txt') {
classifier = 'README'
extension = 'txt'
}
}
}
repositories {
maven {
url artifactRepositoryURL
credentials {
username = 'admin'
password = 'admin123'
}

    }
}

}

@adamdubiel
Copy link
Collaborator

It might be that we have some dependency clashes - both this plugin and axion-release use Grgit underneath. I think i should bump version to newest (0.4.0) to be compatible with gradle-git. Can be done in 0.9.5 - i have some other changes for this version. Would it be okay if i released it tomorrow?

Of course i will test my assumption first :)

@philbeiler
Copy link
Author

That would be great! I was also wondering - if I could get this information from the classes you are dependent on.. it seems like I can at least get the branch name from your classes easily (maybe?) I think I would be more than fine with just the last commit hash and the branch name. Is that possible without using gradle-git (just your plugin)?

println "* Repository: " + repo.remote.list().url
println "* Branch Name: " + gitBranch
println "* Last Commit ID: " + gitId
println "* Last Commited By: " + repo.head().committer.name
println "* Last Commit Message: " + repo.head().shortMessage
println "* Last Commit Time: " + repo.head().getDate()

@adamdubiel
Copy link
Collaborator

You can get branch name and last tag outside of versionCreator using undocumented API on scmVersion extension, i think commit hash is also available. However i would not advise that - it's internal and noone knows when i will need to change it :) I think that we should stick to KISS and let aixon-release release and gradle-git work on repo.

@adamdubiel
Copy link
Collaborator

Okay, i see the problem. gradle-git uses com.github.zafarkhaja:java-semver:0.8.0, while axion-release uses com.github.zafarkhaja:java-semver:0.7.2. It seems that it no longer tolerates null/empty strings - feature that i used. I will create fix for that now.

@adamdubiel
Copy link
Collaborator

Done, now it's a bit hackish, but i also added issue in Semver library that would make it bit nicer in future.

@adamdubiel adamdubiel added this to the 0.9.5 milestone Nov 24, 2014
@adamdubiel adamdubiel self-assigned this Nov 24, 2014
@philbeiler
Copy link
Author

Thanks for your help -- Silly question -- when will this get pushed to maven central? Thanks again for being so responsive.

@adamdubiel
Copy link
Collaborator

I will try to implement one more feature before pushing it to Maven, but should be there tomorrow morning - look for 0.9.5 version.

@philbeiler
Copy link
Author

Ok. No problem at all!! Thanks.

On Mon Nov 24 2014 at 1:43:36 PM Adam Dubiel [email protected]
wrote:

I will try to implement one more feature before pushing it to Maven, but
should be there tomorrow morning - look for 0.9.5 version.


Reply to this email directly or view it on GitHub
#19 (comment)
.

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