Search code examples
gitlab-cimaven-javadoc-plugin

Maven Javadoc warnings become errors in GitLab CI


When I run mvn javadoc:javadoc locally, it gives me a bunch of warnings—empty @return tags, unknown tags etc.—but eventually builds the Javadoc tree.

On GitLab CI, I have the following in .gitlab-ci-yml:

    variables:
      MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
    
    # [...]
    
    deploy:jdk8:
      stage: deploy
      script:
        - if [ ! -f ci_settings.xml ];
            then echo "CI settings missing\! If deploying to GitLab Maven Repository, please see https://docs.gitlab.com/ee/user/project/packages/maven_repository.html#creating-maven-packages-with-gitlab-cicd for instructions.";
          fi
        - 'mvn $MAVEN_CLI_OPTS deploy -s ci_settings.xml'
        - 'mvn javadoc:javadoc'
        - 'cp -r target/site/apidocs public/javadoc/dev'
      artifacts:
        paths:
        - public
      only:
        - master
        - dev

Here, Javadoc generation fails, with the previously mentioned warnings being reported as errors.

I am ultimately going to fix these things, but in the meantime, I would like Javadoc on CI to behave like its local counterpart. Where is the setting to accomplish that?


Solution

  • Changing the mvn javadoc:javadoc line as follows did the trick for me:

        - 'mvn javadoc:javadoc -DadditionalJOption=-Xdoclint:none'
    

    Still not sure why this sems to be the default behavior on my local Maven installation but not on GitLab, but at least this solves my issue for now.