4

Is there any way to make maven run ant with a JDK that is defined using maven toolchains plugin?

Why? I'm testing if I can convert a legacy ant based project to maven based project. Seems parts of it are next to impossible to do with maven so I need to do those with ant. At one point I need to compile using JDK 6 (and it needs to be 6, see e.g. bootstrap class path not set ). Seems maven runs the antrun with the JDK version it is running and toolchains are not taken into consideration (which is ok because the https://maven.apache.org/guides/mini/guide-using-toolchains.html does not display antrun as compatible plugin).

cb4
  • 6,689
  • 7
  • 45
  • 57
Bjarne Boström
  • 227
  • 1
  • 4
  • 14

1 Answers1

0

I had maybe a related issue and and least for a subset of Java related Ant tasks the attribute jvm or executable and setting fork=true to set the used JVM might be helpful. I assume the problem in your case might be solved with javac and java. In my example I had to use Java 8 for an older Java program not running with Java 17:

<java classname="com.sun.javacard.converter.Main"
                                      failonerror="true" fork="true"
                                      jvm="${JAVA_8_HOME}/bin/java">
                                    <jvmarg value="-Djc.home=${jc.home}"/>
...
k_o_
  • 5,143
  • 1
  • 34
  • 43