I have been working on trying to configure the DataNucleus enhancer to enhance JDO classes in a Java Google App Engine Gradle project. So far, I have been unsuccessful. I have tried using Gradle's ant integration to create an enhancer task in Gradle, and I've also tried this directly from Ant.
At this point, I'm now trying to do it manually, hoping that this might give me insight into what I'm doing wrong in Gradle and Ant.
However, the output from Java isn't very helpful either, and I'm hoping someone can tell me how I can get this to enhance my classes or tell me how I can find out what is causing the IllegalArgumentException.
Below is the output trying to enhance the classes. This command was actually reconstructed from digging through the Gradle logs in debug mode:
/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre/bin/java -classpath /Users/jem/Documents/internworkspace/GPEHelloWorldGAE/build/classes/java/main:/Users/jem/.gradle/caches/modules-2/files-2.1/org.apache.taglibs/taglibs-standard-impl/1.2.5/9b9783ccb2a323383e6e20e36d368f8997b71967/taglibs-standard-impl-1.2.5.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/org.jsoup/jsoup/1.8.3/65fd012581ded67bc20945d85c32b4598c3a9cf1/jsoup-1.8.3.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-collections4/4.0/da217367fd25e88df52ba79e47658d4cf928b0d1/commons-collections4-4.0.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.appengine.orm/datanucleus-appengine/2.1.2/c94b27586d50c55ab7dd54ee2174282e6a1e96a6/datanucleus-appengine-2.1.2.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/javax.jdo/jdo-api/3.1/f6a3c20cb994b8cea14e7da9e52f780bddc89d47/jdo-api-3.1.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/org.datanucleus/datanucleus-api-jdo/3.1.1/e1c53ac9a9a0867da9f4136b8df58173c2d5b170/datanucleus-api-jdo-3.1.1.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/org.datanucleus/javax.persistence/2.1.1/d903075c7989102ce74956029ceb6a725209861d/javax.persistence-2.1.1.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/org.datanucleus/datanucleus-core/3.1.3/7d242e12ee2171a092b6ba1da6a03f8872f422d7/datanucleus-core-3.1.3.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.appengine/appengine-api-1.0-sdk/1.9.63/1078044e7123f81e54d13014b53126590e7ad1ae/appengine-api-1.0-sdk-1.9.63.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/jstl/jstl/1.2/74aca283cd4f4b4f3e425f5820cda58f44409547/jstl-1.2.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/javax.servlet/javax.servlet-api/3.1.0/3cd63d075497751784b2fa84be59432f4905bf7c/javax.servlet-api-3.1.0.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/javax.transaction/transaction-api/1.1/2ca09f0b36ca7d71b762e14ea2ff09d5eac57558/transaction-api-1.1.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/org.datanucleus/datanucleus-enhancer/3.1.1/b141c67d55cc19f14639f091b84e692e2198dc50/datanucleus-enhancer-3.1.1.jar:/Users/jem/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/4.0/659add6efc75a4715d738e73f07505246edf4d66/asm-4.0.jar org.datanucleus.enhancer.DataNucleusEnhancer -d testdir -v /Users/jem/Documents/internworkspace/GPEHelloWorldGAE/build/classes/java/main/com/example/april/full/SampleJdoClass.class
Apr 13, 2018 12:55:06 PM org.datanucleus.enhancer.DataNucleusEnhancer <init>
INFO: DataNucleus Enhancer for API "JDO"
Apr 13, 2018 12:55:06 PM org.datanucleus.enhancer.DataNucleusEnhancer main
INFO: DataNucleus Enhancer (version 3.1.1) : Enhancement of classes
DataNucleus Enhancer (version 3.1.1) : Enhancement of classes
Exception in thread "main" java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.datanucleus.enhancer.asm.ASMClassEnhancer.getClassNameForFileName(ASMClassEnhancer.java:272)
at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:727)
at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:525)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1258)
Here is the contents of my ant build file:
<project name="ant-enhancer-wrapper" default="" basedir=".">
<description>
</description>
<!-- set global properties for this build -->
<property environment="env" />
<property name="gradle.lib" location="${user.home}/.gradle/caches/modules-2/files-2.1" />
<property name="enhancer.classpath" location="${gradle.lib}" />
<property name="jdo.file.dir" location="/Users/jem/.gradle/caches/modules-2/files-2.1/org.datanucleus/datanucleus-enhancer/3.1.1/b141c67d55cc19f14639f091b84e692e2198dc50" />
<property name="module.classes.dir" location="${basedir}/build/classes/*" />
<path id="module.lib.classpath">
<pathelement path="${gradle.lib}/"/>
</path>
<path id="enhancer.classpath">
<!-- <pathelement location="${module.classes.dir}"/> -->
<!-- <fileset dir="${gradle.lib}" includes="datanucleus-enhancer-3.1.1.jar" /> -->
<fileset dir="${gradle.lib}">
<include name="**/datanucleus-core-3.1.1.jar" />
<include name="**/datanucleus-enhancer-3.1.1.jar" />
</fileset>
<!-- <path refid="module.lib.classpath"/> -->
</path>
<path id="classpath">
<fileset dir="${gradle.lib}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${build}" />
</path>
<!-- <target name="datanucleusenhance" depends=""
description="Performs enhancement on compiled data classes.">
<enhance_war war="src/main/webapp">
<args>
<arg value="-enhancerVersion"/>
<arg value="v2"/>
</args>
</enhance_war>
</target> -->
<target name="datanucleusenhance" description="DataNucleus enhancement">
<echo>$${enhancer.classpath}=${enhancer.classpath}</echo>
<echo>$${classpath}=${classpath}</echo>
<echo>$${module.lib.classpath}=${module.lib.classpath}</echo>
<taskdef name="datanucleusenhancer" classpathref="enhancer.classpath" classname="org.datanucleus.enhancer.tools.EnhancerTask" />
<datanucleusenhancer classpathref="enhancer.classpath" failonerror="true" verbose="true">
<jvmarg line="-Dlog4j.configuration=${log4j.config.file}"/>
</datanucleusenhancer>
</target>
</project>
Since this is a Gradle project, the classfiles are in build/classes/**
, and of course, all of the project's JAR files are in ~/.gradle/caches/**
Here is the contents of the classpath in the project:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.google.cloud.tools.eclipse.appengine.standard.runtimeClasspathProvider/App Engine Standard Runtime" exported="true">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container" exported="true"/>
<classpathentry output="bin/main" kind="src" path="src/main/java">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin/default"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/org.apache.taglibs/taglibs-standard-impl/1.2.5/ff7d164b8b09beeb2676661a5ecdfea47e9325b8/taglibs-standard-impl-1.2.5-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/org.apache.taglibs/taglibs-standard-impl/1.2.5/9b9783ccb2a323383e6e20e36d368f8997b71967/taglibs-standard-impl-1.2.5.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/org.jsoup/jsoup/1.8.3/17b6b6cb133d73e13e2e1f3550f90d4e23451b10/jsoup-1.8.3-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/org.jsoup/jsoup/1.8.3/65fd012581ded67bc20945d85c32b4598c3a9cf1/jsoup-1.8.3.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-collections4/4.0/f8262a0e305c01bb4e8cb4053374315a8bc08e21/commons-collections4-4.0-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-collections4/4.0/da217367fd25e88df52ba79e47658d4cf928b0d1/commons-collections4-4.0.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.appengine.orm/datanucleus-appengine/2.1.2/cff3ed955bc57fea6762019509369c10fedd947f/datanucleus-appengine-2.1.2-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.appengine.orm/datanucleus-appengine/2.1.2/c94b27586d50c55ab7dd54ee2174282e6a1e96a6/datanucleus-appengine-2.1.2.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/javax.jdo/jdo-api/3.1/b6c42ed0d2c2a796edcd002dfa35486c4b1207be/jdo-api-3.1-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/javax.jdo/jdo-api/3.1/f6a3c20cb994b8cea14e7da9e52f780bddc89d47/jdo-api-3.1.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/org.datanucleus/datanucleus-api-jdo/3.1.3/5e9f664ee5a15b59d0c39237298a4ea1742f6dd3/datanucleus-api-jdo-3.1.3-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/org.datanucleus/datanucleus-api-jdo/3.1.3/2b516725909217520c9c55b591b5e48ab3a0dc64/datanucleus-api-jdo-3.1.3.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/javax.inject/javax.inject/1/a00123f261762a7c5e0ec916a2c7c8298d29c400/javax.inject-1-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/javax.inject/javax.inject/1/6975da39a7040257bd51d21a231b76c915872d38/javax.inject-1.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/javax.persistence/persistence-api/1.0/2773a7910e8f0c7d59749dc4fcef2a4b94fcf85a/persistence-api-1.0-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/javax.persistence/persistence-api/1.0/5725f57873e05e068803e2bf9d5a8ea3740ffec5/persistence-api-1.0.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/org.datanucleus/datanucleus-core/3.1.3/bf9b480345e4ea514c6920732f4e935a202fd444/datanucleus-core-3.1.3-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/org.datanucleus/datanucleus-core/3.1.3/7d242e12ee2171a092b6ba1da6a03f8872f422d7/datanucleus-core-3.1.3.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.appengine/appengine-api-1.0-sdk/1.9.63/1078044e7123f81e54d13014b53126590e7ad1ae/appengine-api-1.0-sdk-1.9.63.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/jstl/jstl/1.2/74aca283cd4f4b4f3e425f5820cda58f44409547/jstl-1.2.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/javax.servlet/javax.servlet-api/3.1.0/ab3976d4574c48d22dc1abf6a9e8bd0fdf928223/javax.servlet-api-3.1.0-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/javax.servlet/javax.servlet-api/3.1.0/3cd63d075497751784b2fa84be59432f4905bf7c/javax.servlet-api-3.1.0.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/javax.transaction/transaction-api/1.1/d5dad66d06246bd2e1e369cebff27faa9beb065a/transaction-api-1.1-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/javax.transaction/transaction-api/1.1/2ca09f0b36ca7d71b762e14ea2ff09d5eac57558/transaction-api-1.1.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/org.datanucleus/datanucleus-enhancer/3.1.1/e212a2f7001d9a28c91b39427ed010cb696ad3e/datanucleus-enhancer-3.1.1-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/org.datanucleus/datanucleus-enhancer/3.1.1/b141c67d55cc19f14639f091b84e692e2198dc50/datanucleus-enhancer-3.1.1.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/4.0/4a33d6206d6d442446a8edbd2b0798ecfaebc229/asm-4.0-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/4.0/659add6efc75a4715d738e73f07505246edf4d66/asm-4.0.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.truth/truth/0.33/385d8511e34942bd61861a0a66117270383ac0fa/truth-0.33-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.truth/truth/0.33/66c978542e1c4c0b72508c5e3bd7d36481090171/truth-0.33.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/a6c32b40bf3d76eca54e3c601e5d1470c86fcdfa/junit-4.12-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/org.mockito/mockito-all/1.10.19/8269667b73d9616600359a9b0ba1b1c7d0cf7a97/mockito-all-1.10.19-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/org.mockito/mockito-all/1.10.19/539df70269cc254a58cccc5d8e43286b4a73bf30/mockito-all-1.10.19.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.appengine/appengine-testing/1.9.63/4ba411d8c319bf47f63793f83b0b29b68fa6f1a/appengine-testing-1.9.63.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.appengine/appengine-api-stubs/1.9.63/2ef26c68c6b6ef3f99e8025aac8129764136ddc3/appengine-api-stubs-1.9.63.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.appengine/appengine-tools-sdk/1.9.63/5513748079aacbbb21baae51dd5206e5a22c8921/appengine-tools-sdk-1.9.63.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/1dc37250fbc78e23a65a67fbbaf71d2e9cbc3c0b/hamcrest-core-1.3-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/20.0/9c8493c7991464839b612d7547d6c263adf08f75/guava-20.0-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/20.0/89507701249388e1ed5ddcf8c41f4ce1be7831ef/guava-20.0.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.0.12/90cff054bd2754d6597cbd7f0e4ac1ab3e381f20/error_prone_annotations-2.0.12-sources.jar" kind="lib" path="/Users/jem/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.0.12/8530d22d4ae8419e799d5a5234e0d2c0dcf15d4b/error_prone_annotations-2.0.12.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
</classpath>
I'm not sure if it's helpful, but here is the build.gradle file I'm using. The enhancer task I created is showing the same exception as running manually.
buildscript { // Configuration for building
repositories {
jcenter() // Bintray's repository - a fast Maven Central mirror & more
mavenCentral()
}
dependencies {
classpath 'com.google.cloud.tools:appengine-gradle-plugin:+' // latest App Engine Gradle tasks
}
}
plugins {
id "com.dorongold.task-tree" version "1.3"
}
repositories { // repositories for Jar's you access in your code
/*maven {
url 'https://oss.sonatype.org/content/repositories/snapshots' // SNAPSHOT repository (if needed)
}*/
mavenCentral()
jcenter()
}
apply plugin: 'java' // standard Java tasks
apply plugin: 'war' // standard Web Archive plugin
apply plugin: 'com.google.cloud.tools.appengine' // App Engine tasks
apply plugin: 'eclipse'
ext {
jdoVersion = "3.1"
dataNucleusVersion = "3.1.3"
}
logging.captureStandardOutput LogLevel.INFO
dependencies {
// https://mvnrepository.com/artifact/org.apache.taglibs/taglibs-standard-impl
compile group: 'org.apache.taglibs', name: 'taglibs-standard-impl', version: '1.2.5'
// https://mvnrepository.com/artifact/org.jsoup/jsoup
compile group: 'org.jsoup', name: 'jsoup', version: '1.8.3'
// https://mvnrepository.com/artifact/org.apache.commons/commons-collections4
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.0'
// https://mvnrepository.com/artifact/javax.jdo/jdo-api
compile group: 'javax.jdo', name: 'jdo-api', version: '3.1'
// https://mvnrepository.com/artifact/org.datanucleus/datanucleus-api-jdo
compile group: 'org.datanucleus', name: 'datanucleus-api-jdo', version: '3.1.3'
// https://mvnrepository.com/artifact/org.datanucleus/datanucleus-enhancer
compile group: 'org.datanucleus', name: 'datanucleus-enhancer', version: '3.1.1'
compile('javax.inject:javax.inject:1')
// https://mvnrepository.com/artifact/com.google.appengine.orm/datanucleus-appengine
compile group: 'com.google.appengine.orm', name: 'datanucleus-appengine', version: '2.1.2'
compile('javax.persistence:persistence-api:1.0')
//compile('org.datanucleus:javax.persistence:2.1.1')
compile('org.datanucleus:datanucleus-core:3.1.3')
//compile('org.datanucleus:datanucleus-api-jpa:5.0.2')
//compile('org.datanucleus:datanucleus-rdbms:5.0.2')
compile 'com.google.appengine:appengine-api-1.0-sdk:+' // Latest App Engine Api's
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
compile 'jstl:jstl:1.2'
// Add your dependencies here.
// compile 'com.google.cloud:google-cloud:+' // Latest Cloud API's http://googlecloudplatform.github.io/google-cloud-java
testCompile 'junit:junit:4.12'
testCompile 'com.google.truth:truth:0.33'
testCompile 'org.mockito:mockito-all:1.10.19'
testCompile 'com.google.appengine:appengine-testing:+'
testCompile 'com.google.appengine:appengine-api-stubs:+'
testCompile 'com.google.appengine:appengine-tools-sdk:+'
}
// Always run unit tests
appengineDeploy.dependsOn test
appengineStage.dependsOn test
appengine { // App Engine tasks configuration
deploy { // deploy configuration
}
run {
jvmFlags = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']
}
run {
jvmFlags = ["-Dappengine.fullscan.seconds=1"]
}
}
test {
useJUnit()
testLogging.showStandardStreams = true
beforeTest { descriptor ->
logger.lifecycle("test: " + descriptor + " Running")
}
onOutput { descriptor, event ->
logger.lifecycle("test: " + descriptor + ": " + event.message )
}
afterTest { descriptor, result ->
logger.lifecycle("test: " + descriptor + ": " + result )
}
}
task hello {
doLast {
println 'Hello, World!'
}
}
task intro(dependsOn: appengineRun) {
doLast {
println "I'm Gradle"
}
}
task datanucleusEnhance {
description "Enhance JPA model classes using DataNucleus Enhancer"
dependsOn compileJava
doLast {
// define the entity classes
def entityFiles = fileTree(sourceSets.main.output.classesDir).matching {
include 'com/example/april/full/SampleJdoClass.class'
}
ant.echo("James was here")
println "Enhancing with DataNucleus the following files"
entityFiles.getFiles().each {
println it
}
// define Ant task for DataNucleus Enhancer
ant.taskdef(
name : 'datanucleusenhancer',
classpath : sourceSets.main.runtimeClasspath.asPath,
// classname : 'org.datanucleus.enhancer.EnhancerTask'
// the below is for DataNucleus Enhancer 3.1.1
classname : 'org.datanucleus.enhancer.tools.EnhancerTask'
)
// run the DataNucleus Enhancer as an Ant task
/*ant.datanucleusenhancer(
classpath: sourceSets.main.runtimeClasspath.asPath,
verbose: true) {
entityFiles.addToAntBuilder(ant, 'fileset', FileCollection.AntType.FileSet)
}*/
ant.datanucleusenhancer( dir: sourceSets.main.output.classesDir.canonicalPath.toURI().toString(), verbose: 'true') {
classpath {
pathelement(location: sourceSets.main.output.classesDir.canonicalPath.toURI().toString())
//pathelement(path: configurations.jdo.asPath)
pathelement(path: sourceSets.main.runtimeClasspath.asPath)
}
fileset(dir: sourceSets.main.output.classesDir.canonicalPath.toURI().toString()) {
include(name: '**/*.class')
}
}
}
}
classes.dependsOn(datanucleusEnhance)
//build.dependsOn appengineRun
group = "com.example.appenginej8" // Generated output GroupId
version = "1.0-SNAPSHOT" // Version in generated output
sourceCompatibility = 1.8 // App Engine Flexible uses Java 8
targetCompatibility = 1.8 // App Engine Flexible uses Java 8