Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle plugin: Instrumentation fails for third party annotations #485

Closed
jasoma opened this issue Apr 13, 2016 · 2 comments
Closed

Gradle plugin: Instrumentation fails for third party annotations #485

jasoma opened this issue Apr 13, 2016 · 2 comments

Comments

@jasoma
Copy link
Contributor

jasoma commented Apr 13, 2016

Instrumentation via the gradle plugin will fail if the Model subclass being instrumented has annotations from another (non-activejdbc) dependency.

Example: jasoma/activejdbc-gradle@b0be2e0

Here @JsonSerialize has been added to the Employee class with no other changes. The build will fail as follows:

$ gradle instrumentModels
:compileJava
:instrumentModels
**************************** START INSTRUMENTATION ****************************
Directory: /Users/jason/projects/activejdbc/gradle-example/build/classes/main
Instrumented class: /Users/jason/projects/activejdbc/gradle-example/build/classes/main/activejdbc/examples/simple/Employee.class
:instrumentModels FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':instrumentModels'.
> java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.annotation.JsonSerialize

Work around: jasoma/activejdbc-gradle@e41bc95

Adding jackson as a dependency of the buildscript resolves the issue. Since the error is ClassNotFoundException the plugin must not be setting up the classpath passed to the instrumentation correctly: it is using the build classpath and not the project classpath.


NOTE: The maven plugin does not suffer from the same issue: https://github.com/jasoma/simple-example/tree/jackson-test

@cschabl
Copy link
Contributor

cschabl commented Jan 2, 2020

@ipolevoy , I propose to close this issue since I'm not able to reproduce it with ActiveJDBC 2.3.1-j8 and the latest version of the activejdbc-gradle-plugin.

The mentioned example works because the jackson dependency is now a transitive dependency of activejdbc-2.3.1-j8 and therefore it is on the classpath of the grade-plugin. I tried to reference other 3rd party libraries (Apache commons-lang3, javax.validation API) in activejdbc model classes. But they didn't cause to break the model instrumentation by the gradle plugin.

@ipolevoy
Copy link
Member

ipolevoy commented Jan 2, 2020

@cschabl agree, closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants