maven 构建中的 Aspectj 错误版本号警告

Aspectj bad version number warning in maven build

我在 Maven 构建过程中收到警告,我想修复它。

maven 构建过程中产生的警告:

[INFO] --- aspectj-maven-plugin:1.4:compile (default) @ core --- [WARNING] bad version number found in C:\Users\DR25687.m2\repository\org\aspectj\aspectjrt.7.1\aspectjrt-1.7.1.jar expected 1.6.11 found 1.7.1


pom 文件

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.4</version>
    <configuration>
        <showWeaveInfo>true</showWeaveInfo>
        <source>1.7</source>
        <target>1.7</target>
        <verbose>true</verbose>
        <Xlint>ignore</Xlint>
        <complianceLevel>1.7</complianceLevel>

父 POM

<org.aspectj.version>1.7.1</org.aspectj.version>

<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjrt</artifactId>
    <version>${org.aspectj.version}</version>
    <scope>runtime</scope>
</dependency>

您的 POM 中有 1.7.1。但是您的本地 Maven 存储库有一个旧版本。试试 mvn clean install

它将下载 1.7.1 版本的 jar。

在插件配置中设置aspectjrt版本

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <version>${version-plugin-aspectj}</version>
            <configuration>
                <source>${targetJdk}</source>
                <target>${targetJdk}</target>
                <verbose>true</verbose>
                <aspectLibraries>
                    <aspectLibrary>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-aspects</artifactId>
                    </aspectLibrary>
                </aspectLibraries>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test-compile</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <!-- Ensure aspectj tools version used by compiler is the same version used as dependency. Avoids warning
                -->
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjtools</artifactId>
                    <version>1.6.12</version>
                </dependency>
            </dependencies>
        </plugin>

https://bugs.eclipse.org/bugs/show_bug.cgi?id=368190