@Override
  public int getMajorJavaVersion() {
    // Check properties for version
    if (project.getProperties().getProperty("maven.compiler.target") != null) {
      return getVersionFromString(project.getProperties().getProperty("maven.compiler.target"));
    }
    if (project.getProperties().getProperty("maven.compiler.release") != null) {
      return getVersionFromString(project.getProperties().getProperty("maven.compiler.release"));
    }

    // Check maven-compiler-plugin for version
    Plugin mavenCompilerPlugin =
        project.getPlugin("org.apache.maven.plugins:maven-compiler-plugin");
    if (mavenCompilerPlugin != null) {
      Xpp3Dom pluginConfiguration = (Xpp3Dom) mavenCompilerPlugin.getConfiguration();
      Optional<String> target = getChildValue(pluginConfiguration, "target");
      if (target.isPresent()) {
        return getVersionFromString(target.get());
      }
      Optional<String> release = getChildValue(pluginConfiguration, "release");
      if (release.isPresent()) {
        return getVersionFromString(release.get());
      }
    }
    return 6; // maven-compiler-plugin default is 1.6
  }
@Test
  public void testGetMajorJavaVersion_undefinedDefaultsTo6() {
    assertThat(mavenProjectProperties.getMajorJavaVersion()).isEqualTo(6);
  }