Skip to content

Commit

Permalink
chore: use java.release=8 when building pgjdbc from the generated sou…
Browse files Browse the repository at this point in the history
…rce distribution

Previously, pom.xml used source=1.8, target=1.8 so it might produce invalid bytecode
when running on Java 1.8
Now pom.xml would use --release 8 to avoid such issues.

See #3014
  • Loading branch information
vlsi committed Nov 27, 2023
1 parent 4b799e0 commit 16c375f
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions pgjdbc/reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<properties>
<!-- Require JDK 1.8 or later -->
<javac.target>1.8</javac.target>
<java.target.release>8</java.target.release>
<encoding>UTF-8</encoding>
<project.build.sourceEncoding>${encoding}</project.build.sourceEncoding>
<project.reporting.outputEncoding>${encoding}</project.reporting.outputEncoding>
Expand Down Expand Up @@ -95,10 +96,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${javac.target}</source>
<target>${javac.target}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
Expand All @@ -124,6 +121,53 @@
</build>

<profiles>
<profile>
<id>jdk8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${javac.target}</source>
<target>${javac.target}</target>
<testExcludes>
<!-- The recent system-stubs test dependency does not support Java 1.8, so we exclude those tests -->
<testExclude>org/postgresql/test/jdbc2/DriverTest.java</testExclude>
<testExclude>org/postgresql/util/OSUtilTest.java</testExclude>
<testExclude>org/postgresql/util/StubEnvironmentAndProperties.java</testExclude>
<testExclude>org/postgresql/jdbcurlresolver/PgPassParserTest.java</testExclude>
<testExclude>org/postgresql/jdbcurlresolver/PgServiceConfParserTest.java</testExclude>
</testExcludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<id>jdkge11</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>${java.target.release}</release>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<!--
By default, source distribution does not build javadocs, however it can be activated with
-Pjavadoc
Expand Down

0 comments on commit 16c375f

Please sign in to comment.