Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-27547

Hardcode of pom aboout java11 & java17 target java version may cause hidden error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.14.4, 1.15.0
    • None
    • API / Scala
    • None

    Description

      Current flink parent pom property <target.java.version>1.8</target.java.version> by default. And many modules inherit this property. But java11-target & java17-target profile not update this property synchronously when enable it.

      Because the hardcode of profile java11-target (java17 with same problem). In a word, current flink build pom has various ways to control java version (it's a bad way).

      <profile>
      			<id>java11-target</id>
      			<build>
      				<plugins>
      					<plugin>
      						<groupId>org.apache.maven.plugins</groupId>
      						<artifactId>maven-compiler-plugin</artifactId>
      						<configuration>
      							<source>11</source>
      							<target>11</target>
                                                         ...
      						</configuration>
      					</plugin>
      				</plugins>
      			</build>
      		</profile>
      

      And I think we should use property target.java.version the one way to control the java version like `release` profile. it may like:

      <profile>
      			<id>java11-target</id>
                               <properties>
      				<target.java.version>11</scala.version>
      			</properties>
      			<build>
      				<plugins>
      					<plugin>
      						<groupId>org.apache.maven.plugins</groupId>
      						<artifactId>maven-compiler-plugin</artifactId>
      						<configuration>
      							<source>${target.java.version}</source>
      							<target>${target.java.version}</target>
                                                         ...
      						</configuration>
      					</plugin>
      				</plugins>
      			</build>
      		</profile>
      

      Otherwise, It will cause build error when we set target.java.version for 11. Because current scala-maven-plugin with scala-2.11 or 2.12 only support <=1.8 jvm version (this is an another deep issue with FLINK-27547 below).

      [ERROR] scalac error: 'jvm-11' is not a valid choice for '-target'
      [INFO] scalac -help gives more information
      [ERROR] scalac error: bad option: '-target:jvm-11'
      [INFO] scalac -help gives more information

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              taoran Ran Tao
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: