Re: [aspectj-users] meta-data problem with aspectj-maven-plugin

2023-08-10 Thread Alexander Kriegisch via aspectj-users
Hi Eric.
I prefer Xander to Alex. 😉
Concerning AspectJ Maven: I recommend to use a default directory layout, then you should be fine without needing to specify directories, in-/excludes etc.
Regarding AspectJ & Lombok: I remember your discussion with Andy back in 2014. For others, the basic info is here on Stack Overflow, also linking to the mailing list thread from back then. There are also solid workarounds for the problem, e.g.

using a delombok step before applying AspectJ compilation on the delomboked sources,
compiling with Maven Compiler & Lombok, then applying AspectJ binary weaving, either in a single module (not recommended) or in a separate module (my recommendation).

Some of my Stack Overflow answers:

https://stackoverflow.com/a/56999300/1082681 comes with a link to a GitHub repository showing a some alternatives.
https://stackoverflow.com/a/56999300/1082681 also describes how to get a specific approach working in IntelliJ IDEA.

-- Alexander Kriegischhttps://scrum-master.de
 
Eric B via aspectj-users schrieb am 11.08.2023 02:37 (GMT +07:00):

Thanks Alex,
 
My code was actually cut & paste; I'm not sure what happened with the email client
 
Your message helped me reapproach it, and I got it to work.  I'm not sure what the plugin is doing, but I needed to identify the sources better than I was doing.  By specifying exact sources that I was targeting to compile, the plugin works and is able to weave.  Of course, I am once again running into my problems that I tried to work out with Andy 10yrs ago with Lombok, but that's a whole different topic to figure out.
 
In the meantime, I've managed to cobble together the necessary pieces for the team to work with.
 
Thanks!
Eric
 



On Wed, Aug 9, 2023 at 8:44 PM Alexander Kriegisch via aspectj-users  wrote:



Sorry, I sent half an answer. What I wrote before relates to
[WARNING] bad version number found in /Users/eric/dev/.m2/repository/org/aspectj/aspectjrt/1.9.19/aspectjrt-1.9.19.jar expected 1.9.8.RC1 found 1.9.19:
As for your compilation error, I really need a reproducer to get to the bottom of that. I cannot debug plain prose in that case.
--Alexander Kriegischhttps://scrum-master.de
 
Alexander Kriegisch via aspectj-users schrieb am 10.08.2023 07:27 (GMT +07:00):

Welcome back to the AspectJ world, Eric.
Next time, please post your code as formatted text, links to repositories or attachments, rather than as a screenshot. Please also note that this question is about AspectJ Maven Plugin rather than AspectJ itself, which would make it better suited to Stack Overflow. But I can answer here, too. 🙂
 
As you can see e.g. at https://mvnrepository.com/artifact/dev.aspectj/aspectj-maven-plugin/1.13.1, that plugin version depends on AspectJ 1.9.8.RC1, which can be updated to 1.9.19, the latter one being the version your own module depends on:
 

 
You are experiencing the situation that you have defined dependencies on AspectJ for your module, but did not synchronise the plugin's dependency. How to do that is described in https://dev-aspectj.github.io/aspectj-maven-plugin/usage.html#Upgrading_or_downgrading_AspectJ: Simply define a plugin dependency to the aspectjtools version in sync with what your module uses. This also enables you to compile up to the Java source/target level represented by that AspectJ version, in this case Java 19.


  
org.codehaus.mojo
aspectj-maven-plugin
1.13.1

  
org.aspectj
aspectjtools
${aspectj.version}
  

  
  ...



Besides, your module does not need aspectjweaver for CTW, only for LTW. So you can eliminate that from your dependency list and just keep aspectjrt.
 
Cheers
--Alexander Kriegischhttps://scrum-master.de
 
Eric B via aspectj-users schrieb am 09.08.2023 18:55 (GMT +07:00):

I've been away from AJ for a while, but needed to add it to my Java 17 project recently.  This i my first time trying to use AJ with Java 11+.
I tried adding the aspectjrt and weaver dependencies to my POM and enabling CTW using the aspectj-maven-plugin as follows:
 




 
 org.aspectj aspectjrt 1.9.19   org.aspectj aspectjweaver 1.9.19 

 

   dev.aspectj aspectj-maven-plugin 1.13.1  17 true true ignore UTF-8   compile  test-compile
 


 
 
Yet when I try to compile anything, I get the following error which stumps me:
 
[INFO] --- aspectj:1.13.1:compile (default) @ poc-oauth-snowflake ---[INFO] Showing AJC message detail for messages of types: [error, warning, fail][WARNING] bad version number found in /Users/eric/dev/.m2/repository/org/aspectj/aspectjrt/1.9.19/aspectjrt-1.9.19.jar expected 1.9.8.RC1 found 1.9.19        :[ERROR] Internal compiler error: java.lang.Exception: java.lang.IllegalStateException: Error processing configuration meta-data on public org.springframework.boot.autoconfigure.jdbc.DataSourceProperties dataSourceProperties()  at org.aspectj.org.eclipse.jdt.inte

Re: [aspectj-users] meta-data problem with aspectj-maven-plugin

2023-08-10 Thread Eric B via aspectj-users
Thanks Alex,

My code was actually cut & paste; I'm not sure what happened with the email
client

Your message helped me reapproach it, and I got it to work.  I'm not sure
what the plugin is doing, but I needed to identify the sources better than
I was doing.  By specifying exact sources that I was targeting to compile,
the plugin works and is able to weave.  Of course, I am once again running
into my problems that I tried to work out with Andy 10yrs ago with Lombok,
but that's a whole different topic to figure out.

In the meantime, I've managed to cobble together the necessary pieces for
the team to work with.

Thanks!

Eric


On Wed, Aug 9, 2023 at 8:44 PM Alexander Kriegisch via aspectj-users <
aspectj-users@eclipse.org> wrote:

> Sorry, I sent half an answer. What I wrote before relates to
>
> [WARNING] bad version number found in 
> /Users/eric/dev/.m2/repository/org/aspectj/aspectjrt/1.9.19/aspectjrt-1.9.19.jar
>  expected 1.9.8.RC1 found 1.9.19
> :
>
> As for your compilation error, I really need a reproducer to get to the
> bottom of that. I cannot debug plain prose in that case.
> --
> Alexander Kriegisch
> https://scrum-master.de
>
>
> Alexander Kriegisch via aspectj-users schrieb am 10.08.2023 07:27 (GMT
> +07:00):
>
> Welcome back to the AspectJ world, Eric.
> Next time, please post your code as formatted text, links to repositories
> or attachments, rather than as a screenshot. Please also note that this
> question is about AspectJ Maven Plugin rather than AspectJ itself, which
> would make it better suited to Stack Overflow. But I can answer here, too.
> 🙂
>
> As you can see e.g. at
> https://mvnrepository.com/artifact/dev.aspectj/aspectj-maven-plugin/1.13.1,
> that plugin version depends on AspectJ 1.9.8.RC1, which can be updated to
> 1.9.19, the latter one being the version your own module depends on:
>
>
> You are experiencing the situation that you have defined dependencies on
> AspectJ for your module, but did not synchronise the plugin's dependency.
> How to do that is described in
> https://dev-aspectj.github.io/aspectj-maven-plugin/usage.html#Upgrading_or_downgrading_AspectJ:
> Simply define a plugin dependency to the aspectjtools version in sync with
> what your module uses. This also enables you to compile up to the Java
> source/target level represented by that AspectJ version, in this case Java
> 19.
>
> 
>   
> org.codehaus.mojo
> aspectj-maven-plugin
> 1.13.1
> 
>   
> org.aspectj
> aspectjtools
> ${aspectj.version}
>   
> 
>   
>   ...
> 
>
> Besides, your module does not need aspectjweaver for CTW, only for LTW. So
> you can eliminate that from your dependency list and just keep aspectjrt.
>
> Cheers
> --
> Alexander Kriegisch
> https://scrum-master.de
>
>
>
> Eric B via aspectj-users schrieb am 09.08.2023 18:55 (GMT +07:00):
>
> I've been away from AJ for a while, but needed to add it to my Java 17
> project recently.  This i my first time trying to use AJ with Java 11+.
>
> I tried adding the aspectjrt and weaver dependencies to my POM and
> enabling CTW using the aspectj-maven-plugin as follows:
>
>
> 
> 
>
> 
> org.aspectj
> aspectjrt
> 1.9.19
> 
> 
> org.aspectj
> aspectjweaver
> 1.9.19
> 
>
> 
>
> 
> 
> 
> dev.aspectj
> aspectj-maven-plugin
> 1.13.1
> 
> 17
> true
> true
> ignore
> UTF-8 
> 
> 
> 
> 
> 
> compile
> 
> test-compile
> 
> 
> 
> 
>
>
>
> Yet when I try to compile anything, I get the following error which stumps
> me:
>
> [INFO] --- aspectj:1.13.1:compile (default) @ poc-oauth-snowflake ---
> [INFO] Showing AJC message detail for messages of types: [error, warning,
> fail]
> [WARNING] bad version number found in
> /Users/eric/dev/.m2/repository/org/aspectj/aspectjrt/1.9.19/aspectjrt-1.9.19.jar
> expected 1.9.8.RC1 found 1.9.19
> :
>
> [ERROR] Internal compiler error: java.lang.Exception:
> java.lang.IllegalStateException: Error processing configuration meta-data
> on public org.springframework.boot.autoconfigure.jdbc.DataSourceProperties
> dataSourceProperties()  at
> org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:172)
>
> /Users/eric/dev/giis-finance/poc-oauth/src/main/java/poc/liquibase/oauth/service/AccessTokenService.java:0
> (no source information available)
>
>
> Removing AJC, and java compiles fine.
>
>
> Does anyone know what configuration meta-data AJC might be complaining
> about, or what I might have missed in my config?
>
> I'm running with :
> openjdk version "17.0.7" 2023-04-18
> OpenJDK Runtime Environment Homebrew (build 17.0.7+0)
> OpenJDK 64-Bit Server VM Homebrew (build 17.0.7+0, mixed mode, sharing)
>
>
> Thanks!
>
> Eric
>
>
>
>
> ___
> aspectj-users mailing list
> aspectj-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/aspectj-users
>
__