同事们。
我连接aspects,原生ajc编译器。使用的想法: Intelleje Idea
项目中的技术:
Maven
Spring boot
Lombok问题:尝试使用上述技术的集成堆栈运行aspectj for java16。+用于自动组装项目以在jar中构建工作方面的框架
我试过了:
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结果:
1. Works but target is not achieved (java before 8)
2. Does not work
3. Does not work花时间研究材料: 2-3周,收集了一堆文章和网络资源。我还可以读一读书“casually in action”
我附加了一个pom文件和一个工作插件:
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发布于 2021-10-14 08:37:30
aspectjtools中包含的编译器,如果需要特定版本,您可以升级或降级该编译器。在使用编译时编织时,您需要添加D10。因为运行支持AspectJ的程序需要一个小插件,所以runtime.
https://stackoverflow.com/questions/69221666
复制相似问题