maven icon indicating copy to clipboard operation
maven copied to clipboard

`xargs -0` not available on AIX, FreeBSD, etc.

Open bmarwell opened this issue 1 month ago • 2 comments

Affected version

4.0.0-rc-5

Bug description

Commit https://github.com/apache/maven/commit/aeff353bd4c97a2e75de3d86d0259e161f4acf83 introduced xargs -0, which is sadly only available on Linux and some other OSes, but not a posix default.

Offending line: https://github.com/apache/maven/blame/master/apache-maven/src/assembly/maven/bin/mvn#L178

For example, AIX will print:

./mvnw <options>

xargs: The -0 flag is not valid.
Usage: xargs [-ptx] [-e[EndOfFileString]] [-E EndOfFileString]
        [-i[ReplacementString]] [-I ReplacementString | -L Number |-n Number ]
       [-l[Number]] [-s Size] [Command [Argument ...]]
Usage: java [options] <mainclass> [args...]
           (to execute a class)
   or  java [options] -jar <jarfile> [args...]
           (to execute a jar file)
   or  java [options] -m <module>[/<mainclass>] [args...]
       java [options] --module <module>[/<mainclass>] [args...]
           (to execute the main class in a module)
   or  java [options] <sourcefile> [args]
           (to execute a single source-file program)

bmarwell avatar Nov 24 '25 12:11 bmarwell

It seems FreeBSD does have -0: https://man.freebsd.org/cgi/man.cgi?xargs AIX does not: https://www.ibm.com/docs/en/aix/7.1.0?topic=x-xargs-command

We could require /opt/freeware/bin/xargs from the AIX Open Source Toolbox which has xargs -0.

bmarwell avatar Nov 24 '25 13:11 bmarwell

I opened: https://ibm-power-systems.ideas.ibm.com/ideas/AIX-I-828

bmarwell avatar Nov 25 '25 11:11 bmarwell