Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aspectj bad version number warning in maven build

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>
like image 760
NottmTony Avatar asked Nov 30 '16 09:11

NottmTony


2 Answers

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

like image 140
kingoleg Avatar answered Oct 15 '22 04:10

kingoleg


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.

like image 1
Jobin Avatar answered Oct 15 '22 05:10

Jobin