Skip to content

Commit c603422

Browse files
committed
maven-helper: add 'is-deployed /path/to/pom.xml' command
This command determines whether a project wants to be deployed or not. If it does want to, the exit code is 1, otherwise 0. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent e350022 commit c603422

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

maven-helper.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,17 @@ install_jar () {
345345
done
346346
}
347347

348+
# Determine whether a local project (specified as pom.xml) needs to be deployed
349+
350+
is_deployed () {
351+
gav="$(gav_from_pom "$1")" &&
352+
commit="$(commit_from_gav "$gav")" &&
353+
test -n "$commit" &&
354+
dir="$(dirname "$gav")" &&
355+
(cd "$dir" &&
356+
git diff --quiet "$commit".. -- .)
357+
}
358+
348359
# The main part
349360

350361
case "$1" in
@@ -371,6 +382,9 @@ packaging-from-pom)
371382
install)
372383
install_jar "$2"
373384
;;
385+
is-deployed)
386+
is_deployed "$2"
387+
;;
374388
*)
375389
die "Usage: $0 [command] [argument...]"'
376390
@@ -402,6 +416,10 @@ install <groupId>:<artifactId>:<version>
402416
or dependency to install is an ImageJ 1.x plugin and the parent
403417
directory contains a subdirectory called "plugins", it will be
404418
installed there, otherwise into the current directory.
419+
420+
is-deployed <pom.xml>
421+
Tests whether the specified project is deployed alright. Fails
422+
with exit code 1 if not.
405423
'
406424
;;
407425
esac

0 commit comments

Comments
 (0)