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

Intellij is constantly changing language level of sub projects back to 1.6

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4.0, 1.3.2
    • Component/s: Build System
    • Labels:
      None

      Description

      Every time I do maven reimport projects, Intellij is switching back to 1.6 language level. I tracked down this issue to misconfiguration in our pom.xml file. It correctly configure maven-compiler-plugin:

      
      			<plugin>
      				<!-- just define the Java version to be used for compiling and plugins -->
      				<groupId>org.apache.maven.plugins</groupId>
      				<artifactId>maven-compiler-plugin</artifactId>
      				<version>3.1</version><!--$NO-MVN-MAN-VER$-->
      				<configuration>
      					<source>${java.version}</source>
      					<target>${java.version}</target>
      					<!-- The output of Xlint is not shown by default, but we activate it for the QA bot
      					to be able to get more warnings -->
      					<compilerArgument>-Xlint:all</compilerArgument>
      				</configuration>
      			</plugin>
      

      where $

      {java.version}

      is set to 1.7 in the properties, but it forgets to overwrite the following properties from apache-18.pom:

        <properties>
          <maven.compiler.source>1.6</maven.compiler.source>
          <maven.compiler.target>1.6</maven.compiler.target>
        </properties>
      

      It seems like compiling from console using maven ignores those values, but they are confusing Intellij.

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user pnowojski opened a pull request:

          https://github.com/apache/flink/pull/4213

          FLINK-7032 Overwrite inherited properties from parent pom

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/pnowojski/flink java17

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/flink/pull/4213.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #4213


          commit 257fc92a98dc1d28014bccc9bb3171e9a38062ab
          Author: Piotr Nowojski <piotr.nowojski@gmail.com>
          Date: 2017-06-28T18:30:08Z

          FLINK-7032 Overwrite inherited properties from parent pom

          Default values for compiler version are 1.6 and were causing Intellij to
          constantly switch language level to 1.6, which in turn was causing
          compilation errors. It worked fine for compiling from console using
          maven, because those values are separetly set in maven-compiler-plugin
          configuration.


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user pnowojski opened a pull request: https://github.com/apache/flink/pull/4213 FLINK-7032 Overwrite inherited properties from parent pom You can merge this pull request into a Git repository by running: $ git pull https://github.com/pnowojski/flink java17 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/4213.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #4213 commit 257fc92a98dc1d28014bccc9bb3171e9a38062ab Author: Piotr Nowojski <piotr.nowojski@gmail.com> Date: 2017-06-28T18:30:08Z FLINK-7032 Overwrite inherited properties from parent pom Default values for compiler version are 1.6 and were causing Intellij to constantly switch language level to 1.6, which in turn was causing compilation errors. It worked fine for compiling from console using maven, because those values are separetly set in maven-compiler-plugin configuration.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user greghogan commented on the issue:

          https://github.com/apache/flink/pull/4213

          Are you using the Maven bundled with IntelliJ?

          Show
          githubbot ASF GitHub Bot added a comment - Github user greghogan commented on the issue: https://github.com/apache/flink/pull/4213 Are you using the Maven bundled with IntelliJ?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user pnowojski commented on the issue:

          https://github.com/apache/flink/pull/4213

          Yes. Should I not do this?

          Show
          githubbot ASF GitHub Bot added a comment - Github user pnowojski commented on the issue: https://github.com/apache/flink/pull/4213 Yes. Should I not do this?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user greghogan commented on the issue:

          https://github.com/apache/flink/pull/4213

          No, that's what I and I assume many other have configured. I'm just surprised that this has not been previously reported and I have not been able to replicate the issue in IntelliJ.

          Show
          githubbot ASF GitHub Bot added a comment - Github user greghogan commented on the issue: https://github.com/apache/flink/pull/4213 No, that's what I and I assume many other have configured. I'm just surprised that this has not been previously reported and I have not been able to replicate the issue in IntelliJ.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user pnowojski commented on the issue:

          https://github.com/apache/flink/pull/4213

          I have the latest version of the Intellij (build in June), and it uses bundled Maven 3.5.9, while my local maven is 3.5.0. For me it replicates 100% times. Touch the pom.xml of some module (by some rebase for example) and Intellij on auto import will switch it back to 1.6. Same happens if I manually click to reimport the maven module.

          I know that at least @StefanRRichter had experienced the same symptoms, modules/projects randomly switching back to Java 1.6 and he didn't know why. Hopefully this fix would solve his issue.

          Show
          githubbot ASF GitHub Bot added a comment - Github user pnowojski commented on the issue: https://github.com/apache/flink/pull/4213 I have the latest version of the Intellij (build in June), and it uses bundled Maven 3.5.9, while my local maven is 3.5.0. For me it replicates 100% times. Touch the pom.xml of some module (by some rebase for example) and Intellij on auto import will switch it back to 1.6. Same happens if I manually click to reimport the maven module. I know that at least @StefanRRichter had experienced the same symptoms, modules/projects randomly switching back to Java 1.6 and he didn't know why. Hopefully this fix would solve his issue.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user greghogan commented on the issue:

          https://github.com/apache/flink/pull/4213

          Okay, I am using the latest stable release (2017.1.4) and the bundled version is 3.3.9. Perhaps different versions are shipped for different OS.

          Show
          githubbot ASF GitHub Bot added a comment - Github user greghogan commented on the issue: https://github.com/apache/flink/pull/4213 Okay, I am using the latest stable release (2017.1.4) and the bundled version is 3.3.9. Perhaps different versions are shipped for different OS.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user pnowojski commented on the issue:

          https://github.com/apache/flink/pull/4213

          Ops, sorry. I also have bundled 3.3.9 maven version with 2017.1.4 Intellij.

          Show
          githubbot ASF GitHub Bot added a comment - Github user pnowojski commented on the issue: https://github.com/apache/flink/pull/4213 Ops, sorry. I also have bundled 3.3.9 maven version with 2017.1.4 Intellij.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user StefanRRichter commented on the issue:

          https://github.com/apache/flink/pull/4213

          I observed similar problems as @pnowojski and the fix helped for me, so +1 from my side.

          Show
          githubbot ASF GitHub Bot added a comment - Github user StefanRRichter commented on the issue: https://github.com/apache/flink/pull/4213 I observed similar problems as @pnowojski and the fix helped for me, so +1 from my side.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user aljoscha commented on the issue:

          https://github.com/apache/flink/pull/4213

          I also observed this after I did a fresh import on Flink in the most recent IntelliJ.

          Show
          githubbot ASF GitHub Bot added a comment - Github user aljoscha commented on the issue: https://github.com/apache/flink/pull/4213 I also observed this after I did a fresh import on Flink in the most recent IntelliJ.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user aljoscha commented on the issue:

          https://github.com/apache/flink/pull/4213

          So +1 to merging this. @greghogan what do you think?

          Show
          githubbot ASF GitHub Bot added a comment - Github user aljoscha commented on the issue: https://github.com/apache/flink/pull/4213 So +1 to merging this. @greghogan what do you think?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user zentol commented on the issue:

          https://github.com/apache/flink/pull/4213

          let's improve the commit message and comment in the pom as to what we're actually doing (overwriting compiler version properties) and why (IntelliJ switching back).

          Show
          githubbot ASF GitHub Bot added a comment - Github user zentol commented on the issue: https://github.com/apache/flink/pull/4213 let's improve the commit message and comment in the pom as to what we're actually doing (overwriting compiler version properties) and why (IntelliJ switching back).
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user pnowojski commented on the issue:

          https://github.com/apache/flink/pull/4213

          I have added one more sentence to the comment inside the pom. @zentol commit message is already quite verbose, but I have improved commit title.

          Show
          githubbot ASF GitHub Bot added a comment - Github user pnowojski commented on the issue: https://github.com/apache/flink/pull/4213 I have added one more sentence to the comment inside the pom. @zentol commit message is already quite verbose, but I have improved commit title.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user greghogan commented on the issue:

          https://github.com/apache/flink/pull/4213

          LGTM thanks for the PR @pnowojski and for confirming the issue @StefanRRichter and @aljoscha

          Show
          githubbot ASF GitHub Bot added a comment - Github user greghogan commented on the issue: https://github.com/apache/flink/pull/4213 LGTM thanks for the PR @pnowojski and for confirming the issue @StefanRRichter and @aljoscha
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user aljoscha commented on the issue:

          https://github.com/apache/flink/pull/4213

          Ok, now we have to many committers on this. 😅

          How will merge?

          Show
          githubbot ASF GitHub Bot added a comment - Github user aljoscha commented on the issue: https://github.com/apache/flink/pull/4213 Ok, now we have to many committers on this. 😅 How will merge?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user zentol commented on the issue:

          https://github.com/apache/flink/pull/4213

          @aljoscha you merge since you asked first.

          Show
          githubbot ASF GitHub Bot added a comment - Github user zentol commented on the issue: https://github.com/apache/flink/pull/4213 @aljoscha you merge since you asked first.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user uce commented on the issue:

          https://github.com/apache/flink/pull/4213

          Just ran into this as well. This was so annoying. Thank you very much for the fix... I spent an hour assuming it was a problem on my side. Merging now...

          Show
          githubbot ASF GitHub Bot added a comment - Github user uce commented on the issue: https://github.com/apache/flink/pull/4213 Just ran into this as well. This was so annoying. Thank you very much for the fix... I spent an hour assuming it was a problem on my side. Merging now...
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/flink/pull/4213

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/flink/pull/4213
          Hide
          uce Ufuk Celebi added a comment -

          Fixed in 5f4296e (release-1.3), d17a4b9 (master).

          Piotr Nowojski I've applied the commit to the release-1.3 branch as well.

          Show
          uce Ufuk Celebi added a comment - Fixed in 5f4296e (release-1.3), d17a4b9 (master). Piotr Nowojski I've applied the commit to the release-1.3 branch as well.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user pnowojski commented on the issue:

          https://github.com/apache/flink/pull/4213

          Thanks!

          Show
          githubbot ASF GitHub Bot added a comment - Github user pnowojski commented on the issue: https://github.com/apache/flink/pull/4213 Thanks!

            People

            • Assignee:
              pnowojski Piotr Nowojski
              Reporter:
              pnowojski Piotr Nowojski
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development