Maven compile aspectj using different jvm

363 views Asked by At

I have a project using SwingUtilities2 which is available in Java 5 only. I'm trying to compile it using newer JDK (using Jenkins). When it comes to pure Java only I have no problems, I simply set the compile plugin like this:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <compilerVersion>${jdk.version}</compilerVersion>
                <executable>${jdk.path}/bin/javac</executable>
                <fork>true</fork>
            </configuration>
        </plugin>

Where ${jdk.path} points to Java 1.5 JDK.

When trying to add aspects, it always compiles using default jdk (1.8).

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <version>1.7</version>
            <configuration>
                <complianceLevel>${jdk.version}</complianceLevel>
            </configuration>
        </plugin>

I was trying as well setting compilerId + dependencies in maven-compiler-plugin (see: http://maven.apache.org/plugins/maven-compiler-plugin/non-javac-compilers.html), but didn't help either.

Any clues how to do it?

EDIT: Changed Jenkins job type from Maven to Free Style and invoke it using JDK 1.5. Now compiles with aspects.

0

There are 0 answers