source 1.3 (use -source 5 or higher to enable generics)
Asked Answered
H

2

9

I am using Maven 2.x, Atlassian Bamboo with maven plugin my build jdk configuration is set to 1.6 and i don't have any jdk version enforced setting in pom.xml file.

When i compile project in my IDE it works fine but when i compile in bamboo it gives me following error.

I have already check my configured jdk version in task is 1.6 and i also tried to enforced jdk version from maven plugin in pom but didn't work as well. someone of you guys may have idea whats going on here ?

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

in -source 1.3
(use -source 5 or higher to enable generics)
        List<String> matchedList = findMatchPhrase(keyword, expression);


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
Husbandry answered 5/2, 2013 at 16:37 Comment(0)
D
15

Add the below properties to your pom.xml.

<properties>
    <maven.compiler.target>1.6</maven.compiler.target>
    <maven.compiler.source>1.6</maven.compiler.source>
</properties>
Documentation answered 5/2, 2013 at 16:40 Comment(1)
Funny you asked this question when I faced exactly the same problem last week :)Documentation
S
1

Another way that doesn't involve modifying the pom is to specify the source and target in the command line:

mvn install -Dmaven.compiler.source=1.6 -Dmaven.compiler.target=1.6

Note that this should be avoided generally as the build cannot be guaranteed to be repeatable this way.

Selfdenial answered 20/1, 2015 at 3:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.