0

How compile a maven project using different jdk with profiles? I would like specify different profiles in my POM file, and run command mvn with profile name. Help me, I'm novice. A complete example would be ideal.

Thanks.

user1800752
  • 29
  • 1
  • 6

1 Answers1

0

You can use toolchains - see the Guide to Using Toolchains

Basically this is what you do:

  • prepare your JDKs in ${user.home}/.m2/toolchains.xml file
  • in the pom.xml, for each desired JDK, create a profile which invokes maven-toolchain-plugin from phase validate (goal toolchain)

That's it.

Note that toolchains work only with certain "toolchains-aware" plugins.

(unfortunately I have no complete example right now)

Petr Kozelka
  • 7,670
  • 2
  • 29
  • 44