I'm migrating a old lib to java 8 (and after 11 and 17) and I'm getting a error saying I'm of java 1.4 on our build server (local build is working fine):
17:53:21 [INFO] --- xmlbeans-maven-plugin:2.3.3:xmlbeans (default) @ edoc-deeplink-intact-xml ---
17:53:29 warning: [options] bootstrap class path not set in conjunction with -source 1.4
17:53:29 error: Source option 1.4 is no longer supported. Use 6 or later.
17:53:29 error: Target option 1.4 is no longer supported. Use 1.6 or later.
However my effective pom seem to be on java 1.8 so I don't understand why I'm getting this error. Here the effective pom:
<!-- ====================================================================== -->
<!-- -->
<!-- Effective POM for project -->
<!-- -->
<!-- ====================================================================== -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>parent-poms</groupId>
<artifactId>parent-pom</artifactId>
<version>1.0.0</version>
</parent>
<groupId>common</groupId>
<artifactId>my-xml-lib</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<jdependMavenPluginVersion>2.0-beta-2</jdependMavenPluginVersion>
<jdk>1.8</jdk>
<jdk.arch>64</jdk.arch>
<jdk.vendor>redhat</jdk.vendor>
<jdk.version>1.8</jdk.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<mavenAntrunPluginVersion>1.7</mavenAntrunPluginVersion>
<mavenCheckstylePluginVersion>2.10</mavenCheckstylePluginVersion>
<mavenDeployPluginVersion>2.7</mavenDeployPluginVersion>
<mavenEnforcerPluginVersion>1.2</mavenEnforcerPluginVersion>
<mavenJavadocPluginVersion>2.9</mavenJavadocPluginVersion>
<mavenJxrPluginVersion>2.3</mavenJxrPluginVersion>
<mavenPluginPluginVersion>3.2</mavenPluginPluginVersion>
<mavenPmdPluginVersion>3.0.1</mavenPmdPluginVersion>
<mavenProjectInfoReportsPluginVersion>2.6</mavenProjectInfoReportsPluginVersion>
<mavenSourcePluginVersion>2.2.1</mavenSourcePluginVersion>
<mavenSurefirePluginVersion>2.15</mavenSurefirePluginVersion>
<mavenSurefireReportPluginVersion>2.14.1</mavenSurefireReportPluginVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<taglistMavenPluginVersion>2.4</taglistMavenPluginVersion>
<timestamp>2023-05-29T21:46:36Z</timestamp>
<versionsMavenPluginVersion>2.1</versionsMavenPluginVersion>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>3.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central</id>
<url>http://central</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central</id>
<url>http://central</url>
</pluginRepository>
</pluginRepositories>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>2.3</version>
</extension>
</extensions>
<resources>
<resource>
<filtering>true</filtering>
<directory>C:\Data\my-xml-lib\src\main\resources</directory>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<pushChanges>true</pushChanges>
<useEditMode>false</useEditMode>
<useReleaseProfile>true</useReleaseProfile>
</configuration>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
</plugin>
<plugin>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.0.1</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>ISO-8859-1</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.8</version>
<configuration>
<version>6</version>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jdepend-maven-plugin</artifactId>
<version>2.0-beta-2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>taglist-maven-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<versionRange>[2.3.3,)</versionRange>
<goals>
<goal>xmlbeans</goal>
<goal>xmlbeans-test</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
<inherited>true</inherited>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
<configuration>
<quiet>true</quiet>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<configuration>
<updateReleaseInfo>true</updateReleaseInfo>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.5</version>
</plugin>
<plugin>
<groupId>com.google.code.echo-maven-plugin</groupId>
<artifactId>echo-maven-plugin</artifactId>
<version>1.0.0</version>
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
</execution>
<execution>
<id>help-goal</id>
<goals>
<goal>helpmojo</goal>
</goals>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
</execution>
</executions>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>regex-property</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>shortGroupId</name>
<value>common</value>
<regex>^TOKEN\.(.+)</regex>
<replacement>$1</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
<inherited>true</inherited>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
<configuration>
<quiet>true</quiet>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
<configuration combine.self="override">
<releaseProfiles>release</releaseProfiles>
<workingDirectory>F:/Data/rel/${buildDefinitionId}/${buildLabel}</workingDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
<includes>
<include>about.html</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>jenkins-plugin</id>
<phase>validate</phase>
<goals>
<goal>toolchain</goal>
</goals>
<configuration>
<toolchains>
<jdk>
<version>1.8</version>
<vendor>redhat</vendor>
<arch>64</arch>
</jdk>
</toolchains>
</configuration>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>1.8</version>
<vendor>redhat</vendor>
<arch>64</arch>
</jdk>
</toolchains>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<version>2.3.3</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>xmlbeans</goal>
<goal>xmlbeans-test</goal>
</goals>
<configuration>
<schemaDirectory>//Path-to-schemaDirectory</schemaDirectory>
<source>1.8</source>
<target>1.8</target>
</configuration>
</execution>
</executions>
<configuration>
<schemaDirectory>//Path-to-schemaDirectory</schemaDirectory>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>default-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>default-testResources</id>
<phase>process-test-resources</phase>
<goals>
<goal>testResources</goal>
</goals>
</execution>
<execution>
<id>default-resources</id>
<phase>process-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>ISO-8859-1</encoding>
</configuration>
</execution>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>ISO-8859-1</encoding>
</configuration>
</execution>
</executions>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>ISO-8859-1</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>default-install</id>
<phase>install</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<updateReleaseInfo>true</updateReleaseInfo>
</configuration>
</execution>
</executions>
<configuration>
<updateReleaseInfo>true</updateReleaseInfo>
</configuration>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.2</version>
<executions>
<execution>
<id>default-site</id>
<phase>site</phase>
<goals>
<goal>site</goal>
</goals>
<configuration>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</execution>
<execution>
<id>default-deploy</id>
<phase>site-deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</execution>
</executions>
<configuration>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
</project>
After wasting the days trying multiple thing I found that the problem is dues to org.codehaus.mojo:xmlbeans-maven-plugin[:2.3.3]. This answer https://github.com/ethercis/openehr-java-libs/issues/1 seem to cover my case. If you have this error:
error: Source option 1.4 is no longer supported. Use 6 or later.
error: Target option 1.4 is no longer supported. Use 1.6 or later.
It seem to be the plugin trying to compile code in 1.4 when it should be using a more recent jdk. This can be overiden be setting the javaSource version for xmlbeans-maven-plugin and adding the noJavac tag to prevent it from using the jdk maven is using.
<javaSource>1.6</javaSource><!-- only "1.5+" is actually recognized, others values revert to "1.4" code -->
<noJavac>true</noJavac><!-- prevent XmlBeans from calling javac directly with "-source 1.6", which is unsupported on new Java versions -->
Hope this help anyone who have the same problem.
Note: ultimatly XMLBeans should be changed to a more recent version and use the new plugin provided with later version andnot xmlbeans-maven-plugin[:2.3.3]. In our case we needed this lib to be move to newer jenkin server.