For the maven-toolchains plugin.
Questions tagged [maven-toolchains-plugin]
36 questions
298
votes
29 answers
How to set specific Java version to Maven?
On my machine I have two Java versions installed: (1.6 and 1.7 installed manually by me). I need both of them for different projects. But for Maven I need 1.7, but my Maven uses the 1.6 Java version.
How can I set Maven to use 1.7?

andPat
- 4,153
- 7
- 24
- 36
34
votes
3 answers
Compile Maven Module with Different Java Version
My maven project has a few modules: server, web, etc.
I would like to build all but my server module on Java 6. For the server module, I'd like to compile it with Java 7.
Here's my pom.xml below, but I think that if I modify it to 1.7, then all of…

Kevin Meredith
- 41,036
- 63
- 209
- 384
20
votes
1 answer
Maven build error after setting toolchain right
I have Java version 1.8.111 installed and the initial error message after running mvn3 install was as below.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain (default) on project myfile: Cannot find…

haeminish
- 988
- 5
- 15
- 29
9
votes
2 answers
maven with JDK11: javac: invalid flag: --release
I'm trying to set up a simple maven project with java 11. As I want to keep JAVA_HOME to be version 8, I'm using maven-toolchains-plugin to make maven use jdk11 for this project.
While maven successfully finds a matching toolchain for jdk-11.0.1, I…

Hengrui Jiang
- 861
- 1
- 10
- 23
8
votes
1 answer
How to configure toolchains plugin in m2e / Installed maven in Eclipse
Currently i am using maven(Apache Maven 3.3.9) & Java(Java version: 1.8.0_91) installed in my windows machine. I have a java application which was developed using Java Version 1.6.0_31.
Since Apache maven(3.3.9) is not directly compatible with the…

Aravind
- 1,145
- 6
- 18
- 44
7
votes
3 answers
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain
I am using m2e to build a java project. I need to use JAVA VERSION 1.6 . So i am trying to configure toolchains plugin to achieve it. by referring the below link.
https://maven.apache.org/guides/mini/guide-using-toolchains.html
But in eclipse it is…

Aravind
- 1,145
- 6
- 18
- 44
7
votes
3 answers
Maven project dependency against JDK version
I have projects that need to be build with a specific version of the JDK.
The problem isn't in the source and target parameters but in the jars of the runtime used during compilation.
In some cases I get a compilation error if I try to compile with…

Andrea Polci
- 1,011
- 13
- 27
6
votes
2 answers
JENKINS: ERROR when I try to use an older JDK for a specific maven project
I am using the Jenkins version 2.73-1.1 on a CentOS Linux release 7.3.1611 server.
There are 3 different versions of JDK on the server:
[root @ jenkins java] # ll
total 12
lrwxrwxrwx. 1 root root 16 27 Apr 16.25 default -> / usr / java /…
5
votes
1 answer
Maven toolchains.xml location under Jenkins
I'm finding it difficult to use Maven toolchains together with Jenkins. I need to specify that tests should be run with a 32-bit JVM, and doing this in by placing a suitable JDK definition in $HOME/.m2/toolchains.xml works when I am running locally…

JesperE
- 63,317
- 21
- 138
- 197
4
votes
0 answers
How do I compile multi module Maven project where modules have different Java versions? Possibly using Jenv?
Suppose I have a multi-module Maven project, with two modules:
foo; requires Java 1.8 to compile
bar; requires Java 11 to compile
I'd like to be able to build these by running mvn clean install from the parent directory and have them compile using…

Mark
- 4,970
- 5
- 42
- 66
4
votes
1 answer
Determine JDK home from Maven toolchain
I have a Maven build configured to use maven-toolchains-plugin, with ~/.m2/toolchains.xml simply configured for multiple JDKs:
jdk
…

stan
- 95
- 1
- 9
4
votes
1 answer
Maven antrun plugin run with JDK specified with toolchains plugin
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…

Bjarne Boström
- 227
- 1
- 4
- 14
3
votes
1 answer
Kotlin + Java 9 modules (Java 11 in use) + maven
I've created a simple project with Java and Kotlin code, and I'm trying to compile it as Java 9 module.
Here is my pom.xml:
3
votes
2 answers
Maven toolchain not getting triggered in build
I'm using the latest maven 3.3.9 which enforces java 8, and trying to compile a project in java 7 using a java 7 maven toolchain.
As per: The maven guide I've put in the maven toolchain plugin to try and tell it to use java 7 to compile the app. …

Pete
- 1,500
- 2
- 16
- 33
2
votes
1 answer
UnsupportedClassVersionError from maven-pmd-plugin for java 11 project
We are migrating our java 8 projects to java 11. JAVA_HOME still points to java 8 but the first project to be migrated compiles in java 11 and the unit tests run just fine.
The maven-compiler-plugin and the toolchain are defined as in this…

Ivana
- 643
- 10
- 27