Lucas Lucas - 3 years ago 144
Java Question

Execute maven goal without a project

I have some automation that uses

to download artifacts to a local filesystem so they can be used outside of maven. Basically, I do something like this:

mvn dependency:get \
-DgroupId="" \
-DartifactId="$1" \
-Dversion="$2" \
-Dpackaging="war" \

The problem (and its not really a problem) is that I get the following output:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building some-other-project 1.2.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------

If I happen to run this from a sub folder of
. This is confusing to the person running this script as the
execution does not actually build the project. Short of capturing and processing the output to strip that info, is there a simple way to tell
that it is just running a goal without an associated project?

Answer Source

You can suppress all INFO output by passing --quiet flag (or -q).

If you'd like to have some INFO's while dropping the rest, you can identify all the components you'd like to silence by doing searches against Maven github and configure the logging properties to exclude those.

E.g. you can add the following flag: for that Scanning for projects... message.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download