Register Models without configuration and instrument

78 views
Skip to first unread message

Hendra Gunawan

unread,
Mar 2, 2015, 11:38:22 PM3/2/15
to activejd...@googlegroups.com
Hi all,

I have searched in this group and github, but seems there is no answer. Using gradle and avoiding properties configuration, is there any way to register the model classes by code? Is it okay to use ModelFinder to register class directly?

Thanks.

Igor Polevoy

unread,
Mar 3, 2015, 1:50:05 AM3/3/15
to activejd...@googlegroups.com
there is no need to register models with properties, and no way to avoid instrumentation. 
Please, see this working Gradle example here: 
Consider ModelFinder as an internal API. 

Running instrumentation will instrument byte code and will also produce a properties file 

Thanks

Hendra Gunawan

unread,
Mar 3, 2015, 2:09:06 AM3/3/15
to activejd...@googlegroups.com
I have followed activejdbc-gradle example and it still doesn't work. I followed everything from the build.gradle minus the run task, because my project is a library without main entrance.

Igor Polevoy

unread,
Mar 3, 2015, 11:27:34 AM3/3/15
to activejd...@googlegroups.com
here is my output:


gradle clean build 
:clean
:compileJava
Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "projectMainClassesDir" on "task ':compileJava'", value: "/home/igor/projects/ja...".
Deprecated dynamic property: "rootLoader" on "task ':compileJava'", value: "null".
**************************** START INSTRUMENTATION ****************************
Directory: /home/igor/projects/javalite/activejdbc-gradle/build/classes/main
Found model: activejdbc.examples.simple.Employee
Instrumented class: activejdbc.examples.simple.Employee in directory: /home/igor/projects/javalite/activejdbc-gradle/build/classes/main/
**************************** END INSTRUMENTATION ****************************
:processResources UP-TO-DATE
:classes
:jar
:assemble
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test
:check
:build

BUILD SUCCESSFUL


you do not need to execute "run". However, during the build a test is executed that uses the model: https://github.com/javalite/activejdbc-gradle/blob/master/src/test/java/activejdbc/examples/simple/EmployeeSpec.java

This test works, as you can see and entire build completes successfully. 
Pull the sources, get it to run as above, then modify to fit your project 

tx

Igor Polevoy

unread,
Mar 3, 2015, 11:28:17 AM3/3/15
to activejd...@googlegroups.com
Here is my Gradle version:

 gradle -v

------------------------------------------------------------
Gradle 1.12
------------------------------------------------------------

Build time:   2014-04-29 09:24:31 UTC
Build number: none
Revision:     a831fa866d46cbee94e61a09af15f9dd95987421

Groovy:       1.8.6
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
Ivy:          2.2.0
JVM:          1.8.0_20 (Oracle Corporation 25.20-b23)
OS:           Linux 3.13.0-46-generic amd64

Hendra Gunawan

unread,
Mar 3, 2015, 9:29:00 PM3/3/15
to activejd...@googlegroups.com
It's not working

No such property: projectMainClassesDir for class: org.gradle.api.tasks.compile.JavaCompile_Decorated

I ran gradle clean build on that project. My gradle is 2.2.

Hendra Gunawan

unread,
Mar 4, 2015, 9:43:31 AM3/4/15
to activejd...@googlegroups.com
Sorry I missed that. I just need to fix the groovy task.
Reply all
Reply to author
Forward
0 new messages