Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] meta-data problem with aspectj-maven-plugin

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.
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>1.13.1</version>
        <dependencies>
          <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
            <version>${aspectj.version}</version>
          </dependency>
        <dependencies>
      </plugin>
      ...
    </plugins>
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:
 

<dependencies>
....
 
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.9.19</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.19</version>
</dependency>

</dependencies>
 
<build>
<plugins>
<plugin>
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.13.1</version>
<configuration>
<complianceLevel>17</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
<verbose>true</verbose>
<Xlint>ignore</Xlint>
<encoding>UTF-8 </encoding>
</configuration>
<executions>
<execution>
<goals>
<!-- use this goal to weave all your main classes -->
<goal>compile</goal>
<!-- use this goal to weave all your test classes -->
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
 
 
 
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
        <unknown source file>:<no line information>

[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
 
 

Back to the top