Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail Maven build on warnings #2335

Merged

Conversation

Marcono1234
Copy link
Collaborator

Purpose

Changes the pom.xml to fail when compilation and Javadoc warnings are reported, see also #2320 (comment).

Description

Also moved the optional Error Prone Annotations dependency to the parent pom.xml to avoid compiler warnings for the other modules depending on the gson module, see #2320 (comment).

If you want I can revert the change to also fail on warnings for Javadoc.

Checklist

  • New code follows the Google Java Style Guide
  • If necessary, new public API validates arguments, for example rejects null
  • New public API has Javadoc
    • Javadoc uses @since $next-version$
      ($next-version$ is a special placeholder which is automatically replaced during release)
  • If necessary, new unit tests have been added
    • Assertions in unit tests use Truth, see existing tests
    • No JUnit 3 features are used (such as extending class TestCase)
    • If this pull request fixes a bug, a new test was added for a situation which failed previously and is now fixed
  • mvn clean verify javadoc:jar passes without errors

For the Javadoc plugin it is "warnings" (plural) instead of "warning"
Copy link
Member

@eamonnmcmanus eamonnmcmanus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change taught me a couple of slightly upsetting things.

@@ -173,6 +186,7 @@
<detectOfflineLinks>false</detectOfflineLinks>
<!-- Only show warnings and errors -->
<quiet>true</quiet>
<failOnWarnings>true</failOnWarnings>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this is failOnWarning for maven-compiler-plugin and failOnWarnings for maven-javadoc-plugin. Yay Maven.

<dependencies>
<!-- Error Prone Annotations is only directly used by gson module, but since this is an optional
dependency and other modules depend on gson module they also need the dependency to avoid
compiler warnings, see comments on https://bugs.openjdk.org/browse/JDK-6331821 -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So apparently this bug from 2005 is still open. ☹️

Copy link
Collaborator Author

@Marcono1234 Marcono1234 Mar 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my fault I copied the wrong URL while browsing the bug reports... 🤦
Will create a follow-up pull request to fix that (#2338).

I meant to refer to the same JDK bug report mentioned in #2320 (comment). It looks like both reports might describe the same bug and JDK-6331821 was never closed. But I haven't tested it.

I mainly wanted to refer to that JDK bug report because its fix introduced the compiler warnings.

@eamonnmcmanus eamonnmcmanus merged commit 0adcdc8 into google:master Mar 6, 2023
@Marcono1234 Marcono1234 deleted the marcono1234/fail-on-warnings branch March 6, 2023 19:59
eamonnmcmanus pushed a commit that referenced this pull request May 31, 2023
* Fail Maven build on warnings

* Fix configuration parameter name

For the Javadoc plugin it is "warnings" (plural) instead of "warning"
tibor-universe pushed a commit to getuniverse/gson that referenced this pull request Sep 14, 2024
* Fail Maven build on warnings

* Fix configuration parameter name

For the Javadoc plugin it is "warnings" (plural) instead of "warning"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants