0

Hi I have recently started using maven. I came across errors that were caused by different java version specified in different parts of my projects. So far I am aware that I can specify the compiler version in project-properties Java compiler, project-properties project facets and in pom.xml Why do I have to mention the java version I am using in these different places? enter image description here enter image description here

<plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
sepp2k
  • 363,768
  • 54
  • 674
  • 675
kaka
  • 597
  • 3
  • 5
  • 16

1 Answers1

0

Maven’s paradigm is a “standard” set of global configurations, which you override with your configurations in your pom.xml.

The default version specified in this global configuration is 1.5/1.6 (depending on Maven version). Looking at an (optional) project configuration would break this paradigm. How could you look at someone else’s pom and confidently state the Java version?

The project configuration you are referring to is domain specific and is not required for Maven to build.

More info on Maven Java versions - https://stackoverflow.com/a/38883073

Jakg
  • 922
  • 12
  • 39