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
d-man
  • 57,473
  • 85
  • 212
  • 296

2 Answers2

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>
adarshr
  • 61,315
  • 23
  • 138
  • 167
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.

Asa
  • 1,624
  • 15
  • 19