Hello Robin,
I would like to know if its possible to build a new plug-in for Quickbuild using gradle instead of Eclipse PDE's "wizard export" function ?
In my particular case, the plug-in I am trying to build is mixed between Java and Groovy classes. and I developed this build.grade file (which fails during compileGroovy defaut task)
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'eclipse'
project.description = "An awesome Quickbuild 7.x Plug-in (com.foo.bar_0.0.1.jar)"
// TODO: Think in a better way to state these properties.
ext.eclipseLibs = new File('C:/Eclipse/plugins')
ext.qb7RuntimeLibs = new File('D:/QB/7.0.21/plugins')
ext.qb7ProjectLibs = new File('D:/Eclipse-Workspace/com.pmease.quickbuild/lib')
dependencies {
// Bind Eclipse Libs, but select only ONE version for groovy compiler (in this case, only 2.4) to be loaded in the classpath (from local lib).
compile fileTree(dir: eclipseLibs, includes: [ '**/*.jar'], excludes: ['org.codehaus.groovy_*'])
// Bind QB7 Project libs for resolve groovy compiler dependencies on Reflection (jersey classes)
compile fileTree(dir: qb7ProjectLibs, includes: [ 'jersey*.jar' ])
// Bind QB7 Bootstrap classes in the classpath.
compile fileTree(dir: "${qb7RuntimeLibs}/com.pmease.quickbuild.bootstrap", includes: [ '**/*.class'])
// Bind QB7 Runtime libs that are available on a QB7 installation, except for the groovy compiler and the plug-in itself.
compile fileTree(dir: qb7RuntimeLibs, includes: [ '**/*.jar'], excludes: ['com.foo.bar*.jar', 'groovy-all*.jar'])
// Bind Plug-in's internal libraries (there is a groovy-all-2.4.x.jar here)
compile fileTree(dir: 'lib')
}
eclipse.project.natures = [
'org.eclipse.pde.PluginNature',
'org.eclipse.jdt.groovy.core.groovyNature',
'org.eclipse.jdt.core.javanature',
'org.eclipse.buildship.core.gradleprojectnature'
]
eclipse.classpath.file.withXml { xml ->
def node = xml.asNode()
node.appendNode('classpathentry', [ combineaccessrules: false, exported: true, kind: 'con', path: 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/' ])
node.appendNode('classpathentry', [ combineaccessrules: false, exported: true, kind: 'con', path: 'org.eclipse.pde.core.requiredPlugins' ])
node.appendNode('classpathentry', [ combineaccessrules: false, exported: true, kind: 'con', path: 'org.eclipse.buildship.core.gradleclasspathcontainer' ])
node.appendNode('classpathentry', [ combineaccessrules: false, exported: true, kind: 'src', path: '/com.pmease.quickbuild' ])
node.appendNode('classpathentry', [ combineaccessrules: false, exported: true, kind: 'src', path: '/com.pmease.quickbuild.bootstrap' ])
node.appendNode('classpathentry', [ combineaccessrules: false, exported: true, kind: 'src', path: '/com.pmease.quickbuild.equinoxadapter' ])
node.appendNode('classpathentry', [ combineaccessrules: false, kind: 'src', path: 'src' ])
node.appendNode('classpathentry', [ combineaccessrules: false, kind: 'output', path: 'bin' ])
}
sourceSets.main.java.srcDirs = [ ]
sourceSets.main.groovy.srcDirs = [ 'src' ]
// continues ...
I didn't find a easy way to mimic what Eclipse PDE does by adding the project's folder in the "Plug-in Dependencies" area under "Configure Build Path..." > "Libraries".
My Plug-in already works well and build successfully using the IDE, I just needed a solution for a gradle command line operation.
Thanks and Best Regards,
Mauro