Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tygerpatch
Created August 17, 2014 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tygerpatch/c3a9917f2e97d10d83df to your computer and use it in GitHub Desktop.
Save tygerpatch/c3a9917f2e97d10d83df to your computer and use it in GitHub Desktop.
Gradle build script for working with Google App Engine in Eclipse
apply plugin: 'java'
apply plugin: 'eclipse'
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
defaultOutputDir = file('war/WEB-INF/classes')
file {
withXml {
def node = it.asNode()
node.appendNode('classpathentry', [kind: 'src', path: 'src'])
node.appendNode('classpathentry', [kind: 'con', path: 'com.google.appengine.eclipse.core.GAE_CONTAINER'])
node.appendNode('classpathentry', [kind: 'con', path: 'org.eclipse.jdt.launching.JRE_CONTAINER'])
}
}
}
project {
buildCommand 'org.eclipse.wst.common.project.facet.core.builder'
buildCommand 'org.eclipse.jdt.core.javabuilder'
buildCommand 'com.google.gdt.eclipse.core.webAppProjectValidator'
buildCommand 'com.google.appengine.eclipse.core.enhancerbuilder'
buildCommand 'com.google.appengine.eclipse.core.gaeProjectChangeNotifier'
buildCommand 'com.google.appengine.eclipse.core.projectValidator'
natures 'org.eclipse.jdt.core.javanature'
natures 'com.google.appengine.eclipse.core.gaeNature'
natures 'org.eclipse.wst.common.project.facet.core.nature'
natures.remove('org.eclipse.wst.common.modulecore.ModuleCoreNature')
natures.remove('org.eclipse.jem.workbench.JavaEMFNature')
}
}
tasks.eclipse {
doFirst {
def props = new Properties()
props.setProperty("eclipse.preferences.version", "1");
props.setProperty("filesCopiedToWebInfLib", "appengine-api-1.0-sdk-1.9.9.jar|appengine-api-labs.jar|appengine-endpoints-deps.jar|appengine-endpoints.jar|appengine-jsr107cache-1.9.9.jar|asm-4.0.jar|datanucleus-api-jdo-3.1.3.jar|datanucleus-api-jpa-3.1.3.jar|datanucleus-appengine-2.1.2.jar|datanucleus-core-3.1.3.jar|geronimo-jpa_2.0_spec-1.0.jar|jdo-api-3.0.1.jar|jsr107cache-1.1.jar|jta-1.1.jar")
props.setProperty("gaeDatanucleusVersion", "v2")
props.setProperty("gaeHrdEnabled", "true")
file(".settings/com.google.appengine.eclipse.core.prefs").withOutputStream {
stream -> props.store(stream, null)
}
props = new Properties()
props.setProperty("eclipse.preferences.version", "1");
props.setProperty("warSrcDir", "war");
props.setProperty("warSrcDirIsOutput", "true");
file(".settings/com.google.gdt.eclipse.core.prefs").withOutputStream {
stream -> props.store(stream, null)
}
file(".settings/org.eclipse.wst.common.project.facet.core.xml").withWriter {
new groovy.xml.MarkupBuilder(it).'faceted-project' {
installed(facet: "java", version: "1.7")
}
}
}
}
eclipse {
jdt {
file {
withProperties { properties ->
properties.put("eclipse.preferences.version", "1")
properties.put("org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode", "enabled")
properties.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.7")
properties.put("org.eclipse.jdt.core.compiler.compliance", "1.7")
properties.put("org.eclipse.jdt.core.compiler.problem.assertIdentifier", "error")
properties.put("org.eclipse.jdt.core.compiler.problem.enumIdentifier", "error")
properties.put("org.eclipse.jdt.core.compiler.source", "1.7")
properties.remove("org.eclipse.jdt.core.compiler.debug.localVariable")
properties.remove("org.eclipse.jdt.core.compiler.codegen.unusedLocal")
properties.remove("org.eclipse.jdt.core.compiler.debug.sourceFile")
properties.remove("org.eclipse.jdt.core.compiler.debug.lineNumber")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment