-
Notifications
You must be signed in to change notification settings - Fork 0
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
Support aspectj-maven-plugin using AspectJ idea plugin #7
Comments
An example of how this would work: simplescreenrecorder-2024-03-29_09.33.09.mp4 |
Preview available in 233.25.1 version from beta repo https://plugins.jetbrains.com/plugin/22370-gmaven/versions/beta |
Please note that What you need to do is resolve Please also note that, despite the fact that the AspectJ team endorses |
IDEAJust quickly tried the beta in a regular Maven project != AJDT. Like I thought, aspectjtools is not detected and Javac is selected as Java compiler, not Ajc. After manually switching to Ajc, it looks like this: When using IDEA's Maven integration, it looks like that: Furthermore, plugin options for the compiler are not imported, as it seems. I.e., plugin option |
Being the maintainer of both AspectJ and AspectJ.dev AJ Maven, feel free to connect with me, so I can explain all the plugin options to you. The AspectJ compiler is not just a drop-in replacement for Javac or ECJ, it has more options that need to be passed through from AJ Maven to aspectjtools when compiling from IDEA. |
Thanks for your feedback. For now this is just a preview to show what the aspect integration would look like through the AspectJ IDEA plugin on example ajdt project(which works thanks to the "intellij" profile). In the final version, it will be necessary to support the maven plugins configurations from both AspectJ and AspectJ.dev AJ Maven. |
Sure. I simply wanted to provide timely feedback while still being in the mental and technical context of this issue. Otherwise, I might have forgotten about it and next time might have needed to start over. Being an agile coach, I do believe in the power of short feedback cycles. 😉 |
Preview available in 233.25.2 version from beta repo https://plugins.jetbrains.com/plugin/22370-gmaven/versions/beta |
I just installed the plugin version and tried it on a simple AspectJ Maven project. It seems to have absolutely no effect. Neither is there any AspectJ facet in the imported project, nor is AspectJ compilation taking place in the IDE build. |
I found a potential problem. I don't resolve aspectj-maven-plugin dependencies. And if the required dependency is not in the local repository, then I will not find it and will not configure the compiler settings. I fixed this in version 233.25.3. |
It is still not working. Obviously, the import does not work correctly, if both Maven Compiler and AJ Maven are specified in the POM. That is a problem. If I uncomment Maven Compiler, the import works. But still, some options are imported incorrectly, e.g. One more issue is that after manual or automatic GMaven import, no re-build is issued even after the configuration has changed. I have to manually rebuild the project for the config changes to become effective. |
Thank you for helping to localize the problem
How to correctly pass parameters? Parameter Xlint and parameter encoding are of type string.
First I will need to figure out how this works in the bundled maven plugin. I think it's better to do this in another issue |
Most AJC parameters are from upstream ECJ. Therefore, the syntax is like in the Eclipse Java Compiler. I only have influence on the AJC-specific ones. Simply run For your convenience, there is also documentation here: |
I fixed compiler priority and string params at version 233.25.4. |
Thanks, @grisha9. Now it works. As for compiler preference, this is exactly the weakness in IDEA: The Java compiler can either be Ajc or Javac (or something else like GrEclipse), but not both, even if Maven defines multiple plugins and executions, Maven Compiler doing annotation processing only, AJ Maven Java and AspectJ compilation only or some mix. A perfect IDE build would be able to compile multiple times with multiple compilers (e.g. also test vs application code) in the same order as Maven. |
Thank you for the clarification. I think this is another potential problem with my implementation when I simply replace one compiler with another. Then you may need to take the annotation processor settings from maven-compiler-plugin. IDEA has separate settings for the annotation processor |
The annotation processor is just an example. You see, if you really want to cover all important cases in a Maven plugin, your initial goal to avoid adding logic from the plugins or from Maven to the plugin itself does not work. At the end of a day, that is exactly what you are going to do if you want it to work in more than just pareto-style 80-to-20 cases. Somehow, the Maven semantics need to be reflected in the plugin mapping those settings to IDEA configurations. But even that is limited by what IDEA offers. I do not envy you in this regard. But OTOH, I do think that given JetBrains' slow adoption rate of change requests and bug reports, there is room for your plugin, if it solves problems that the built-in one does not. This is the main reason I am testing (albeit with just very small time slices) and providing feedback. |
Thank you. Yes, my main goal is to import a project model from Maven into the IDE. There are nuances to assembling and launching a project from IDEA. I have plans to also delegate some of this to Maven - for example, running tests. |
fixed in 233.26 |
If module contain aspectj-maven-plugin and classpath has library org.aspectj:aspectjtools and AspectJ idea plugin installed then GMaven on import try to configure java compiler to use "ajc" compiler (File | Settings | Build, Execution, Deployment | Compiler | Java Compiler)
Link to AspectJ plugin - https://plugins.jetbrains.com/plugin/4679-aspectj
The text was updated successfully, but these errors were encountered: