You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.2 KiB
Bash
58 lines
1.2 KiB
Bash
8 years ago
|
#!/usr/bin/env bash
|
||
5 years ago
|
# shellcheck disable=SC2230
|
||
8 years ago
|
# vim:ts=4:sts=4:sw=4:et
|
||
|
#
|
||
|
# Author: Hari Sekhon
|
||
|
# Date: 2016-06-30 14:46:43 +0100 (Thu, 30 Jun 2016)
|
||
|
#
|
||
2 years ago
|
# https://github.com/HariSekhon/DevOps-Bash-tools
|
||
8 years ago
|
#
|
||
|
# License: see accompanying Hari Sekhon LICENSE file
|
||
|
#
|
||
|
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
|
||
|
#
|
||
2 years ago
|
# https://www.linkedin.com/in/HariSekhon
|
||
8 years ago
|
#
|
||
|
|
||
|
set -eu #o pipefail
|
||
|
[ -n "${DEBUG:-}" ] && set -x
|
||
3 years ago
|
srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
7 years ago
|
|
||
5 years ago
|
# shellcheck source=lib/utils.sh
|
||
5 years ago
|
. "$srcdir/lib/utils.sh"
|
||
8 years ago
|
|
||
5 years ago
|
poms="$(find "${1:-.}" -name "pom.xml")"
|
||
5 years ago
|
|
||
5 years ago
|
if [ -z "$poms" ]; then
|
||
8 years ago
|
return 0 &>/dev/null || :
|
||
8 years ago
|
exit 0
|
||
|
fi
|
||
|
|
||
7 years ago
|
section "M a v e n"
|
||
|
|
||
7 years ago
|
start_time="$(start_timer)"
|
||
8 years ago
|
|
||
2 years ago
|
opts=()
|
||
|
|
||
|
if is_CI; then
|
||
|
opts+=(-B)
|
||
|
fi
|
||
|
|
||
5 years ago
|
if type -P mvn &>/dev/null; then
|
||
3 years ago
|
type -P mvn
|
||
|
mvn --version
|
||
|
echo
|
||
5 years ago
|
grep -v '/target/' <<< "$poms" |
|
||
5 years ago
|
while read -r pom; do
|
||
8 years ago
|
echo "Validating $pom"
|
||
2 years ago
|
mvn validate ${opts:+"${opts[@]}"} -f "$pom" || exit $?
|
||
8 years ago
|
echo
|
||
8 years ago
|
done
|
||
|
else
|
||
|
echo "Maven not found in \$PATH, skipping maven pom checks"
|
||
|
fi
|
||
|
|
||
7 years ago
|
time_taken "$start_time"
|
||
7 years ago
|
section2 "Maven pom checks passed"
|
||
8 years ago
|
echo
|