在maven构建中Aspectj坏版本号警告

时间:2016-11-30 09:26:49

标签: java maven aspectj-maven-plugin

我在maven构建期间收到警告,我想修复。

maven构建期间生成的警告:

  

[INFO] --- aspectj-maven-plugin:1.4:编译(默认)@core ---   [警告]在C:\ Users \ DR25687.m2 \ repository \ org \ aspectj \ aspectjrt \ 1.7.1 \ aspectjrt-1.7.1.jar中找到错误的版本号预计1.6.11发现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>

2 个答案:

答案 0 :(得分:3)

在插件配置中设置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

答案 1 :(得分:0)

你在POM中有1.7.1。但是您的本地maven存储库具有旧版本。试试SelectionMode

它将下载1.7.1版本的jar。