gradle-aspectj-binary icon indicating copy to clipboard operation
gradle-aspectj-binary copied to clipboard

does the post-time compile solve problem of conflict with lombok problem?

Open JasonHuangHuster opened this issue 6 years ago • 10 comments

does the post-time compile solve problem of conflict with lombok problem?

JasonHuangHuster avatar Mar 03 '19 12:03 JasonHuangHuster

AFAIK lombok works during the compilation of sources and the plugin works with the compiled classes. So that means the plugin works after the lombok. It's just a theory, I haven't tried it yet.

sedovalx avatar Mar 04 '19 09:03 sedovalx

tks for you reply :) how to weave class with @Aspect inside jars ?

JasonHuangHuster avatar Mar 09 '19 04:03 JasonHuangHuster

i've tried the mix build of aspectJ & lombok , it worked ! your plugin is quite simple and clear than many other solution . the most common solution i googled came from this post , but it's complicated . your work should known by more people 👍

i got a new problems ,

when i build the project with my Aspect file it works ok . but when i add the project as a dependency to another project and setting all the aspect compile things up then build , my Aspect file won't take affect . i don't want to expose the Aspect file to the upper object . do you have any idea how to solve this ?

  1. i found binary compile takes much logger than spring aop . Spring AOP works fine most of the time . i have to chose binary compile just because one special aspect . so i only want this special aspect being compiled , and others goes the spring aop way . is this possible ?

JasonHuangHuster avatar Mar 09 '19 12:03 JasonHuangHuster

  1. Am I right that both aspect classes and annotated classes are in this dependency project? What happens if you invoke gradle classes directly on this dependency project? Are you sure that :your-dependency-project:classes task is run when you buld your main project?
  2. Seems, simple filtering of aspect classes may be implemented in the plugin. Please see the AjcTask#getClasspath method. You may provide the plugin with an explicit list of aspect class names of what aspect classes should end up in the classpath.

sedovalx avatar Mar 11 '19 11:03 sedovalx

1、actually my aspect class is inside a dependency . and those class contains method that need to be aop are in the main project . it works when i move my aspect class to the main project . but i'm would like to keep it inside the dependency . 2、by now seems your plugin only accept three params source 、 target 、writeToLog , and the aspectjtools's version needs to be upgraded , current 1.8.9 have problem when weave with java 1.8 classes . i tried to public a new version , it shows success publish in the command line , but i still can't find it in center repository . :(

JasonHuangHuster avatar Mar 11 '19 12:03 JasonHuangHuster

  1. As you may see in the example project, I use an external aspect com.jcabi.aspects.Quietly and it works fine. Should be the same for your aspect in the dependency project. Make sure you weave both of your projects - main (where the method is) and dependency (where the aspect lives).
  2. Are you trying to publish an artifact of a fork of this repo under the same group and artifact ids to the maven central repository? In case this is true, please don't. At least change the group id of the artifact. If you want to change something in the plugin I suggest you to make a pull request here.If everything looks good I merge the request and publish the new version on the bintray.

sedovalx avatar Mar 13 '19 10:03 sedovalx

1、tks for you reply , i've folked a new project and implement it with groovy , it worked "specify the Aspectj to weave event it's inside a jar" .
2、i'll try to make a pull request , lots of people searching for solutions of mix usage of aspectj & lombok . this may help . but i don't speak kotlin before ... maybe some help will needed :)

JasonHuangHuster avatar Mar 14 '19 11:03 JasonHuangHuster

Sorry, but I don't get what you mean in 1. As for the help with kotlin - no problem at all. Can you bullet here what you want from the plugin?

sedovalx avatar Mar 14 '19 11:03 sedovalx

1、upgrade the aspectjVersion to 1.9.2 because the version inside your plugin is 1.8.6 which can't weave some java 8 class file . 2、the Aspect file (let's call it Aspect_1) that i wish to be weave is inside a dependency(let's call it dependency Dependency_A ) , now i want only Aspect_1 to be weaved , not including other Aspects inside Dependency_A .

JasonHuangHuster avatar Mar 14 '19 17:03 JasonHuangHuster

Please see the updated examples project for reference

sedovalx avatar Jan 14 '20 16:01 sedovalx