You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL;DR: The post-compile-weaving plugin is not meant to compile *.aj sources directly, try io.freefair.aspectj
With your current setup, you are using both javac and ajc to compile your source files.
First, javac runs as it usually would with gradles "compileJava" task. But javac can only read *.java files, so it cannot find org.example.aspect.TestAspect. After removing the reference to org.example.aspect.TestAspect javac can compile the .java file just fine.
After this, an additional action added to the compileJava task executes ajc, which will successfully compile both source files.
Once the aspect has been compiled once by ajc, javac can now also see the .class file of the aspect.
So from then on, javac can compile the .java file with access to the aspect.
When dealing with .aj files, you should try the io.freefair.aspectj plugin instead, which adds an additional sourceDir src/main/aspectj where you can put .aj and .java files, which will then be compiled by ajc only.
How to reproduce:
build.gradle: https://gist.github.com/hohserg1/fa5cface77c0613ff2421bb3a9f31d27
gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
gradlew build
got compilation error: https://gist.github.com/hohserg1/26cd155afdca7e9dadba3d171fc2f04d
gradlew build
compilation successed
gradlew build
compilation successed
gradlew clean
gradlew build
got compilation error: https://gist.github.com/hohserg1/26cd155afdca7e9dadba3d171fc2f04d
Expected behavior:
Compilation must be successed from clean project
I'm not sure, if its really need to access to aspect's fields/methods, but kinda bug
Also reproducing at 6.5.1 plugin version
The text was updated successfully, but these errors were encountered: