2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> maven-javadoc-generate.sh"
12 # Generates javadoc in a Maven project.
14 # Ensure we fail the job if any steps fail.
15 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
19 JAVADOC_DIR="$WORKSPACE/archives/javadoc"
20 mkdir -p "$WORKSPACE/archives"
24 # use absolute path as workaround for javadoc:aggregate
25 # silent failure on relative path, for example "-f ."
26 maven_dir_abs=$(readlink -f "$MAVEN_DIR")
28 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
29 # shellcheck disable=SC2086
30 # Use -x via subshell to show maven invocation details in the log
32 $MVN clean install javadoc:aggregate \
34 -e -Pq -Dmaven.javadoc.skip=false \
36 -Dcheckstyle.skip=true \
37 -Dfindbugs.skip=true \
38 --global-settings "$GLOBAL_SETTINGS_FILE" \
39 --settings "$SETTINGS_FILE" \
40 $MAVEN_OPTIONS $MAVEN_PARAMS
43 mv "$WORKSPACE/$MAVEN_DIR/target/site/apidocs" "$JAVADOC_DIR"
45 # TODO: Nexus unpack plugin throws a "504 gateway timeout" for jobs archiving
46 # large number of small files. Remove the workaround when we move away from
47 # using Nexus as the log server.
48 if [[ "$JOB_NAME" =~ "javadoc-verify" ]]; then
49 # Tarball the javadoc dir and rm the directory to avoid re-upload into logs
50 tarball="$WORKSPACE/archives/javadoc.tar.xz"
51 echo "INFO: archiving $JAVADOC_DIR as $tarball"