maven icon indicating copy to clipboard operation
maven copied to clipboard

Change maven cli defaults based on `CI` env variable

Open laeubi opened this issue 3 months ago • 1 comments

New feature, improvement proposal

CI servers usually define a CI env variable:

For reference:

it would be great if maven could detect that and change some of the default settings then, for example:

  1. show transfer progress is currently ON by default it should be OFF by default on CI servers
  2. batch mode is OFF by default and should be ON by default on CI servers
  3. ... maybe more ...

reason is that these options are usually tweaked for the CI and it always adds some boilerplate to these scripts. It would be great if maven can use convention-over-configuration here and switch the defaults depending on where it runs. If anyone absolutely want other values they can still explicitly configure them.

laeubi avatar Sep 03 '25 07:09 laeubi

We do have the needed infrastructure and we do look for the CI env variable. For example, it's used here: https://github.com/apache/maven/blob/335baf58fb499ee4e14cd1fe0c3cc2c1c9ed4ffe/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java#L724

We actually do disable transfer logging in CI jobs: https://github.com/apache/maven/blob/9a1c04b619b834b67495f8f9925aedc683924553/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvn/MavenInvoker.java#L360-L361

So yes, we may be missing batch mode here, not sure about others atm.

gnodet avatar Sep 03 '25 15:09 gnodet