Problem:
When I create a project maven
the project always had the version JDK 1.5
, if I change the JDK version in the IDE when doing a Maven > Project Update
it returns to JDK 1.5
.
Is the setting.xml
file the place where I define the version of all maven projects? If not where I do for all new projects always use the JDK 1.7
version for example.
Note: I found a way to solve the problem using the file pom.xml
.
Code:
<!-- CONFIGURAR VERSÃO DO JAVA PARA 1.7 -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
Advantage and Disadvantage
I understand that the advantage of this code is that each Maven project can work with a specified Java version. The disadvantage of this code is for every new project I have to change the pom.xml
.