Closed DavidIbrahim closed 2 years ago
Hey,
I'm not 100% sure what the issue is that you are encountering, but I don't see evidence (yet) that it is the AOP plugin.
The first reason why is that I don't see anything in the stacktrace that points to the plugin itself.
The second reason is that I was able to create a sample project that uses a module to hold the aspects, like you are trying to do. To do this, I cloned this AOP repo and introduced a new module (sample-module
). I then moved the aspect code from sample-kotlin
to sample-module
. And then I updated sample-kotlin
to depend on sample-module
. Everything seems to be working as I would expect.
You can see this example in my branch: https://github.com/Ibotta/gradle-aspectj-pipeline-plugin/tree/feature/es_aop_via_module
And it seems to work as expected at runtime:
I tried your commit, it's building correctly but this is not working as expected, I expected to see the messages sent from the KotlinAspect
file too, the same behaviour as the develop branch, correct me if I am wrong
.
You're right, my apologies. I rushed that example out too quickly. I have just updated the branch (https://github.com/Ibotta/gradle-aspectj-pipeline-plugin/tree/feature/es_aop_via_module) so that it is working correctly.
This actually took me a bit of time, as it wasn't working initially. The problem was related to our plugin's filter
option. The filter
concept was added after we were seeing our plugin pick up Aspects from arbitrary 3rd party libraries. For us, this was undesirable. We only want our own Aspects to be picked up and woven into our code.
Because of this ^, we introduced a filter
option which would let us specify a string used to filter items on the Aspect classpath. Our current example shows com/ibotta/gradle/aop
as the filter
value, but this was unexpectedly causing our Aspects in sample-module
to get filtered out. The reason why has to do with the classpath used to compile sample-kotlin
. The classes from sample-module
are in that classpath as /Users/eschlenz/Documents/gradle-aspectj-pipeline-plugin/sample-module/build/intermediates/compile_library_classes_jar/debug/classes.jar
, which does not contain com/ibotta/gradle/aop
and was therefore filtered out.
So I needed a more generic filter
option that would allow us to select only code within our project. The value of gradle-aspectj-pipeline-plugin
was changed (it's the root project folder name), which allowed me to filter the correct stuff and get this example working.
Sorry for the late response, and yes it's working both in the sample you gave and on the side project that had the issue at the beginning it is strange that it is building correctly now. Thanks @eschlenz
I added the plugin to the project as in the readme file but updated the plugin version to 1.3.1 and the aspectJ version to 1.9.9.1. I am trying to put the Aspect file in a module, and use it in another module following this example (https://github.com/Ibotta/gradle-aspectj-pipeline-plugin/issues/21#issuecomment-1129179218) but always face a build issue.
The issue:
Project build.gradle.kts
Module containing the Aspect file Gradle file
Module using Trigger annotation Gradle file