Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 665
d-man Avatar asked Feb 05 '13 16:02

d-man


2 Answers

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>
like image 58
adarshr Avatar answered Nov 18 '22 18:11

adarshr


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.

like image 1
Asa Avatar answered Nov 18 '22 19:11

Asa