I’m trying to use the new Atlassian JGitFlow library from within Gradle, but I seem to have errors.
buildscript{
repositories{
mavenRepo (name:'Maven Central Proxy', url:'http://myserver:8089/nexus/content/repositories/central/')
}
dependencies{
classpath 'com.atlassian.jgitflow:jgit-flow:0.9'
}
}
task initFlow << {
//your local working copy is now on the develop branch
JGitFlow flow = JGitFlow.getOrInit(new File("."));
}
And the error is:
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
build file 'C:\path\to\gdl-JGitFlow\build.gradle': 13: unable to resolve class JGitFlow
@ line 13, column 14.
JGitFlow flow = JGitFlow.getOrInit(new File("."));
^
1 error
at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileScript(DefaultScriptCompilationHandler.java:118)
... 53 more
BUILD FAILED
You need to add an import for the class.
Thanks for the prompt reply.
I had tried that:
buildscript{
repositories{
mavenRepo (name:'Maven Central Proxy', url:'http://myserver:8089/nexus/content/repositories/central/')
}
dependencies{
classpath 'com.atlassian.jgitflow:jgit-flow:0.9'
}
}
import com.atlassian.jgitflow.core.JGitFlow
task initFlow << {
//your local working copy is now on the develop branch
JGitFlow flow = JGitFlow.getOrInit(new File("."));
}
but still had:
AILURE: Build failed with an exception.
* Where:
Build file 'C:\LV\src\IdeaProjects\gdl-JGitFlow\build.gradle' line: 11
* What went wrong:
Could not compile build file 'C:\LV\src\IdeaProjects\gdl-JGitFlow\build.gradle'.
> startup failed:
build file 'C:\LV\src\IdeaProjects\gdl-JGitFlow\build.gradle': 11: unable to resolve class com.atlassian.jgitflow.core.JGitFlow
@ line 11, column 1.
import com.atlassian.jgitflow.core.JGitFlow
^
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
You have the wrong dependency.
It should be: 'classpath ‘com.atlassian.jgitflow:jgit-flow-core:0.9’
Works perfectly! How did I miss that…