I have some projects compiled and deployed with Maven and Jenkins and they have worked fine until now that I have changed the java version from 6 to 7.

In order to do this I executed the command *sudo update-alternatives --config javac* and changed the values of JAVA\_HOME and PATH in the */etc/profile* file. I have also modified the pom file so it uses jdk 1.7:

```
<properties>
    ...
    <jdk.version>1.7</jdk.version>
</properties>

<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
        ...
        <configuration>
            <source>${jdk.version}</source>
            <target>${jdk.version}</target>
        </configuration>
</plugin>

```

When I execute them on the console they compile fine and the displayed version is correct:

```
javac -version
javac 1.7.0_55

mvn install -debug
Apache Maven 2.2.1 (rdebian-8)
Java version: 1.7.0_55
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre

```

However, when I do the same in a jenkins job, Maven uses the 1.6 version instead of 1.7:

```
javac -version
javac 1.7.0_55

mvn install -debug
Apache Maven 2.2.1 (rdebian-8)
Java version: 1.6.0_31
Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre

```

I have also modified the maven configuration file that I use to indicate the new version, and in the Jenkins administration panel I have changed the JDK version. However, Maven is still using the 1.6 jdk.

Do you know how can I change it?