[
https://issues.apache.org/jira/browse/BEAM-5176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16662163#comment-16662163
]
Michael Luckey edited comment on BEAM-5176 at 10/24/18 11:45 AM:
-----------------------------------------------------------------
Let me first try to restate the problem. Not sure if I got that right.
Issue is, if I execute e.g
{noformat}
./gradlew :beam-sdks-java-core:compileJava{noformat}
or use the Gradle tool window
{noformat}
beam -> :beam-sdks-java-core -> Tasks -> other -> compileJava{noformat}
the build succeeds, whereas if I m using the idea menu
{noformat}
Build -> Build Module{noformat}
it fails complaining about
{noformat}
error: warnings found and -Werror specified
1 error
89 warnings
> Task :beam-sdks-java-core:compileJava FAILED
{noformat}
At least, that is, what I am observing.
If so, that seems to be caused by Intellij adding an additional Xlint parameter
to java command line, i.e.
{noformat}
-Xlint:deprecation -parameters -Xlint:all -Werror
-XepDisableWarningsInGeneratedCode
-XepExcludedPaths:(.*/)?(build/generated.*avro-java|build/generated)/.*
-Xep:MutableConstantField:OFF -Xlint:-options -Xlint:-cast -Xlint:-deprecation
-Xlint:-processing -Xlint:-rawtypes -Xlint:-serial -Xlint:-try
-Xlint:-unchecked -Xlint:-varargs {noformat}
versus
{noformat}
-parameters -Xlint:all -Werror -XepDisableWarningsInGeneratedCode
-XepExcludedPaths:(.*/)?(build/generated.*avro-java|build/generated)/.*
-Xep:MutableConstantField:OFF -Xlint:-options -Xlint:-cast -Xlint:-deprecation
-Xlint:-processing -Xlint:-rawtypes -Xlint:-serial -Xlint:-try
-Xlint:-unchecked -Xlint:-varargs {noformat}
which obviously clashes with -Werror here.
I think, that might be caused by IntelliJ hardcoding -Xlint:deprecation into
Gradle task runner [1], although I am not really sure, that's the code executed
when pushing this button.
Anyway, inspecting compilerArgs before modifying in BeamModulePlugin [2] shows
that option to be already set
{noformat}
[-Xlint:deprecation]
{noformat}
So we probably could workaround that by either changing that
{noformat}
options.compilerArgs += ([
{noformat}
to
{noformat}
options.compilerArgs = ([
{noformat}
or change the order and append existing options last.
[1]
[https://github.com/JetBrains/intellij-community/blob/182.4892/plugins/gradle/java/src/execution/build/GradleProjectTaskRunner.java#L135-L140]
[2]
[https://github.com/apache/beam/blob/master/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy#L557]
was (Author: michel):
Let me first try to restate the problem. Not sure if I got that right.
Issue is, if I execute e.g
{noformat}
./gradlew :beam-sdks-java-core:compileJava{noformat}
or use the Gradle tool window
{noformat}
beam -> :beam-sdks-java-core -> Tasks -> other -> compileJava{noformat}
the build succeeds, whereas if I m using the idea menu
{noformat}
Build -> Build Module{noformat}
it fails complaining about
{noformat}
error: warnings found and -Werror specified
1 error
89 warnings
> Task :beam-sdks-java-core:compileJava FAILED
{noformat}
At least, that is, what I am observing.
If so, that seems to be caused by Intellij adding an additional Xlint parameter
to java command line, i.e.
{noformat}
-Xlint:deprecation -parameters -Xlint:all -Werror
-XepDisableWarningsInGeneratedCode
-XepExcludedPaths:(.*/)?(build/generated.*avro-java|build/generated)/.*
-Xep:MutableConstantField:OFF -Xlint:-options -Xlint:-cast -Xlint:-deprecation
-Xlint:-processing -Xlint:-rawtypes -Xlint:-serial -Xlint:-try
-Xlint:-unchecked -Xlint:-varargs {noformat}
versus
{noformat}
-parameters -Xlint:all -Werror -XepDisableWarningsInGeneratedCode
-XepExcludedPaths:(.*/)?(build/generated.*avro-java|build/generated)/.*
-Xep:MutableConstantField:OFF -Xlint:-options -Xlint:-cast -Xlint:-deprecation
-Xlint:-processing -Xlint:-rawtypes -Xlint:-serial -Xlint:-try
-Xlint:-unchecked -Xlint:-varargs {noformat}
which obviously clashes with -Werror here.
I think, that might be caused by IntelliJ hardcoding -Xlint:deprecation into
Gradle task runner [1], also I am not really sure, that's the code executed
when pushing this button.
Anyway, inspecting compilerArgs before modifying in BeamModulePlugin [2] shows
that option to be already set
{noformat}
[-Xlint:deprecation]
{noformat}
So we probably could workaround that by either changing that
{noformat}
options.compilerArgs += ([
{noformat}
to
{noformat}
options.compilerArgs = ([
{noformat}
or change the order and append existing options last.
[1]
[https://github.com/JetBrains/intellij-community/blob/182.4892/plugins/gradle/java/src/execution/build/GradleProjectTaskRunner.java#L135-L140]
[2]
https://github.com/apache/beam/blob/master/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy#L557
> FailOnWarnings behave differently between CLI and Intellij build
> -----------------------------------------------------------------
>
> Key: BEAM-5176
> URL: https://issues.apache.org/jira/browse/BEAM-5176
> Project: Beam
> Issue Type: Sub-task
> Components: build-system
> Reporter: Etienne Chauchot
> Assignee: Kenneth Knowles
> Priority: Major
>
> In command line the build passes but fails on the IDE because of warnings.
> To make it pass I had to put false in failOnWarnings in ApplyJavaNature
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)