Aspectj bad version number warning in maven build
Asked Answered
C

2

13

I am getting a warning during a maven build, that I would like to fix.

The warning generated during a maven build:

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


The pom file

<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>

Parent 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>
Chally answered 30/11, 2016 at 9:26 Comment(0)
C
8

Set up aspectjrt version in plugin configuration

        <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>

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

Creigh answered 20/9, 2017 at 11:14 Comment(0)
T
1

you have 1.7.1 in POM. but your local maven repository is having an older version. Try a mvn clean install.

it will download the 1.7.1 version jar.

To answered 30/11, 2016 at 9:39 Comment(7)
I use the following to do a build : mvn clean install -UChally
also try removing the <scope>runtime</scope>To
I also removed all instances from repository and same errorChally
The only version in the repository is 1.7.1 - same error still.Chally
can you check the effective pom and see what is the version there for aspectjrtTo
Yes the version in aspectjrt-1.7.1.pom is <version>1.7.1</version>Chally
@Chally you need to replace 1.7.1 with 1.6.11 from parent pomWolcott

© 2022 - 2024 — McMap. All rights reserved.