I’m trying to import an existing project as a Gradle project.
The import goes well, the Gradle nature is added to the .project, and the grade.prefs is correctly populated in .settings directory.
However,
Loading tasks of project located at D:\git\acceptanceTests\acceptanceTests failed due to an error in the referenced Gradle build.
The stacktrace gives more info about it:
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id ‘dataset-plugin’]
…
Caused by: org.gradle.internal.reflect.ObjectInstantiationException: Could not create an instance of type xxx.dataset.model.DatasetExtension_Decorated (that is a custom extension)
…
Caused by: java.lang.IllegalArgumentException: One of setGitDir or setWorkTree must be called.
at org.eclipse.jgit.lib.BaseRepositoryBuilder.requireGitDirOrWorkTree(BaseRepositoryBuilder.java:586)
at org.eclipse.jgit.lib.BaseRepositoryBuilder.setup(BaseRepositoryBuilder.java:554)
at org.eclipse.jgit.storage.file.FileRepositoryBuilder.build(FileRepositoryBuilder.java:92)
at org.eclipse.jgit.storage.file.FileRepositoryBuilder$build.call(Unknown Source)
at org.ajoberstar.grgit.operation.OpenOp.call(OpenOp.groovy:95)
at org.ajoberstar.grgit.operation.OpenOp.call(OpenOp.groovy)
at java_util_concurrent_Callable$call.call(Unknown Source)
at org.ajoberstar.grgit.util.OpSyntaxUtil.tryOp(OpSyntaxUtil.groovy:45)
at org.ajoberstar.grgit.Grgit$__clinit__closure1.doCall(Grgit.groovy:191)
at xxx.dataset.model.DatasetExtension.(DatasetExtension.groovy:60)
Since Grgit 1.3.0, Grgit.open() does not need any parameters, as it calls JGit with parameters to infer the .git location (in the parent directory hierachy of the current directory)
I’m using a recompiled internal Grgit version (that is compatible with java 6)
Everything is correctly set in my settings.gradle file
gradle.projectsLoaded { g ->
g.rootProject.buildscript {
repositories {
//local repo to get my internal plugins
}
dependencies {
classpath 'xxx:dataset-plugin:latest.release’
classpath ‘xxx:grgit-java6:latest.release’
}
}
}
Before switching my project to a Gradle project, this was workingfine, because it was probably pulling my version of Grgit.
When Buildship tries to build the task view, it does not seem to pick the correct version of Grgit, hence the error.
Do you have an idea of what could go wrong ? Maybe the projectsLoaded closure is called ‘too late’ ?
(I’m adding andrew @ajoberstar , he might have an idea about it)