Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Use gradle to build a sample QB Plug-in #3729

ribeiromauro ·

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

  • replies 2
  • views 3480
  • stars 1
ribeiromauro ·

Oh, yes... this is the error msg on a gradlew build --stacktrace run:

> Task :compileGroovy
warning: Implicitly compiled files were not subject to annotation processing.
  Use -implicit to specify a policy for implicit compilation.
1 warning


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileGroovy'.
> Unable to load class com.foo.bar.CustomItem due to missing dependency com/pmease/quickbuild/QuickbuildException

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileGroovy'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.NoClassDefFoundError: Unable to load class com.foo.bar.CustomItem due to missing dependency com/pmease/quickbuild/QuickbuildException
        at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:175)
        at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:56)
        at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerRunnable.run(AbstractDaemonCompiler.java:87)
        at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:36)
        at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:46)
        at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:30)
        at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:100)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:146)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:128)
        at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
        ... 3 more
robinshen ADMIN ·

I am not familiar with Gradle, and can not tell what should be done to make it working for now. Please submit a feature request at track.pmease.com