You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Ran Tao (Jira)" <ji...@apache.org> on 2022/05/09 05:12:00 UTC

[jira] [Updated] (FLINK-27547) Hardcode of pom aboout java11 & java17 target java version may cause hidden error

     [ https://issues.apache.org/jira/browse/FLINK-27547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ran Tao updated FLINK-27547:
----------------------------
    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).  And I think we should use property target.java.version the one way to control the java version like `release` profile.


{code:java}
<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>
{code}

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.

[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


  was:
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.  And I think we should use property target.java.version the one way to control the java version like `release` profile.


{code:java}
<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>
{code}

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.

[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



> Hardcode of pom aboout java11 & java17 target java version may cause hidden error
> ---------------------------------------------------------------------------------
>
>                 Key: FLINK-27547
>                 URL: https://issues.apache.org/jira/browse/FLINK-27547
>             Project: Flink
>          Issue Type: Bug
>          Components: API / Scala
>    Affects Versions: 1.15.0, 1.14.4
>            Reporter: Ran Tao
>            Priority: Major
>
> 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).  And I think we should use property target.java.version the one way to control the java version like `release` profile.
> {code:java}
> <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>
> {code}
> 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.
> [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



--
This message was sent by Atlassian Jira
(v8.20.7#820007)