X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fmaven-javadoc-generate.sh;h=1d0682b918182a43857ff70d61b6769cf7b361a0;hb=5beb45586451cb772982de881cd09fd97360be87;hp=aa485c0c3191c9ddc4f26064758adb4907a9bfd1;hpb=e399aea1a5da089f150fa847478ea53354945e00;p=releng%2Fglobal-jjb.git diff --git a/shell/maven-javadoc-generate.sh b/shell/maven-javadoc-generate.sh index aa485c0c..1d0682b9 100644 --- a/shell/maven-javadoc-generate.sh +++ b/shell/maven-javadoc-generate.sh @@ -8,11 +8,11 @@ # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################## - +echo "---> maven-javadoc-generate.sh" # Generates javadoc in a Maven project. -# DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound. # Ensure we fail the job if any steps fail. +# DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound. set -e -o pipefail set +u @@ -21,11 +21,36 @@ mkdir -p "$WORKSPACE/archives" export MAVEN_OPTS +# use absolute path as workaround for javadoc:aggregate +# silent failure on relative path, for example "-f ." +maven_dir_abs=$(readlink -f "$MAVEN_DIR") + # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters. # shellcheck disable=SC2086 -$MVN clean javadoc:aggregate \ - --global-settings "$GLOBAL_SETTINGS_FILE" \ - --settings "$SETTINGS_FILE" \ - $MAVEN_PARAMS $MAVEN_OPTIONS +# Use -x via subshell to show maven invocation details in the log +(set -x + $MVN clean install javadoc:aggregate \ + -f "$maven_dir_abs" \ + -e -Pq -Dmaven.javadoc.skip=false \ + -DskipTests=true \ + -Dcheckstyle.skip=true \ + -Dfindbugs.skip=true \ + --global-settings "$GLOBAL_SETTINGS_FILE" \ + --settings "$SETTINGS_FILE" \ + $MAVEN_OPTIONS $MAVEN_PARAMS +) + +mv "$WORKSPACE/$MAVEN_DIR/target/site/apidocs" "$JAVADOC_DIR" -mv "$WORKSPACE/target/site/apidocs" "$JAVADOC_DIR" +# TODO: Nexus unpack plugin throws a "504 gateway timeout" for jobs archiving +# large number of small files. Remove the workaround when we move away from +# using Nexus as the log server. +if [[ "$JOB_NAME" =~ "javadoc-verify" ]]; then + # Tarball the javadoc dir and rm the directory to avoid re-upload into logs + tarball="$WORKSPACE/archives/javadoc.tar.xz" + echo "INFO: archiving $JAVADOC_DIR as $tarball" + pushd "$JAVADOC_DIR" + tar cvJf "$tarball" . + popd + rm -rf "$JAVADOC_DIR" +fi