I know there are some related topics but still I can't understand how to do it.
I'm learning maven and currently in process of creating build profiles. I want maven to auto detect the currently installed java version on my machine. Let's say I'm working in our office which uses (jdk7) or home (jdk8)
, I want the <source>
and <target>
elements in maven-compiler-plugin
pom.xml to auto detect the java -version
regardless of environment (office / home). I've read about activation
but can't perfectly understand the purpose.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
</plugins>
</build>