Skip to content

Commit 06357e1

Browse files
committed
Serially copy JARs when flattening libdir
For some applications, multiple copies of JARs may exist in JAVA_LIB_DIR. If >1 of those filenames end up collated into the same `cp` invocation, the result will fail ("cp: will not overwrite just-created...) The solution is to serially invoke cp, one per library. This will cause duplicate filenames to overwrite, which is fine if they are the same library, but might mask a different problem if they aren't. Signed-off-by: Jonathan Dowland <[email protected]>
1 parent 1d5399e commit 06357e1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ function generate_deps() {
88
mkdir dependencies
99

1010
if [[ -v JAVA_LIB_DIR ]]; then
11-
# copy dependencies found in libs to dependencies
12-
find $JAVA_LIB_DIR -type f -name '*.jar' -print0 | xargs -r0 cp -vt dependencies
11+
# Serially copy all library JARsinto a flat directory. Serially as we may
12+
# have multiple libs with the same name; in which case, we clobber all but
13+
# one rather than fail the script
14+
find $JAVA_LIB_DIR -type f -name '*.jar' -exec cp -vt dependencies {} \;
15+
1316
echo "Working with: "
1417
echo $JAVA_APP_JAR
1518
echo $JAVA_LIB_DIR
@@ -26,4 +29,4 @@ function generate_deps() {
2629
> deps.txt
2730
cat deps.txt
2831
fi
29-
}
32+
}

0 commit comments

Comments
 (0)