1

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.

  • this answer might help you: http://stackoverflow.com/a/21549970/1570834 – DB5 Jun 18 '15 at 10:57
  • Unfortunately didn't help. `aspectj-maven-plugin` is still run using default JDK, which misses SwingUtilities2 . I was trying to add `${jdk.path}/lib/tools.jar` but then it doesn't see maven dependencies. – Pan Pinezka Jun 18 '15 at 11:38

0 Answers0