colleagues.
I connect aspects, native ajc compiler. Idea used: Intelleje IDEA
Technologies on the project:
Maven
Spring boot
Lombok
Problem: Trying to run aspectj for java 16 with integrated stack of the above technologies. + framework for automating the assembly of projects to build in jar with working aspects
I tried:
1. plugin for automated project building "org.codehaus.mojo" works only with Java 1.8, I cannot use later versions. As I understand it, the plugin is outdated.
2. Including aspectjrt in project dependencies and assigning aspectjtools and aspectjweawer to the project facet
3. Various manipulations with installing the Java version in ide
Results:
1. Works but target is not achieved (java before 8)
2. Does not work
3. Does not work
Spent time studying the material: 2-3 weeks, shoveled a bunch of articles and Internet resources. Also read the book casually AspectJ in action
I am attaching a pom file with a working plugin:
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>MyAopWithoutSpring</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- <parent>-->
<!-- <groupId>com.baeldung</groupId>-->
<!-- <artifactId>parent-boot-2</artifactId>-->
<!-- <version>0.0.1-SNAPSHOT</version>-->
<!-- <relativePath>../parent-boot-2</relativePath>-->
<!-- </parent>-->
<!-- <parent>-->
<!-- -->
<!-- </parent>-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
</parent>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${aspectj-plugin.version}</version>
<configuration>
<complianceLevel>${java.version}</complianceLevel>
<source>${java.version}</source>
<target>${java.version}</target>
<showWeaveInfo>true</showWeaveInfo>
<verbose>true</verbose>
<Xlint>ignore</Xlint>
<encoding>UTF-8</encoding>
<excludes>
<exclude>**/pointcutadvice/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<aspectj-plugin.version>1.11</aspectj-plugin.version>
<java.version>1.8</java.version>
</properties>
</project> ```
To be honest, I am already ready to despair, I do not understand the sequence of actions at all in order for it to somehow work on the technology stack that is necessary. I will be glad to any advice and tips from more experienced colleagues