Uncategorized

Specifying java source and target version in Maven 2

While converting from Ant to Maven2 i have came across following error while trying to compile the project

generics are not supported in -source 1.4
(try -source 1.5 to enable generics)
private Map  variables;

To fix the problem we need to add the pluggin configuration to our pom.xml

<project>
...
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
...
</project>

Thats it.

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *