Can I override Nexus Repository 2 configuration properties with environment variables?

Visit my.sonatype.com for documentation on Nexus Repository version 2.

A. Nexus Repository 2 will pull in some configuration data from environment variables. If these are defined they will override the values in "$NEXUS_HOME/conf/nexus.properties". For Nexus 2.x the following environment variables can be defined:

  • NEXUS_WORK
    • The location of the Nexus Repository 2 work directory, where Nexus Repository 2 stores all of its configurations and repository contents.
    • Defaults to $(basedir)/../sonatype-work/nexus
  • NEXUS_APPLICATION_HOST
    • The host/address(es) that the Nexus Repository 2 server will be listening on
    • Defaults to 0.0.0.0, which means that Nexus Repository 2 will listen on all network interfaces
  • NEXUS_APPLICATION_PORT
    • The port that Nexus Repository 2 will be listening on
    • Defaults to 8081
  • NEXUS_CONTEXT_PATH
    • The context path that the Nexus Repository 2 application will be served on
    • Defaults to /nexus

Caution: Generally we suggest avoiding using environment variables to configure Nexus Repository 2 if at all possible.

Caution: In older versions of Nexus Repository 2 these environment variables began with "PLEXUS" instead of "NEXUS".  Use of "PLEXUS" environment variables is deprecated, and support for these will be removed in a future release.


Where is the code which controls the environment variables?

The code location is different per Nexus Repository 2 version. You can grep the Nexus Repository 2 OSS source code for 'NEXUS_' and 'PLEXUS_' to find the locations if the following links no longer work.

Nexus Repository 2.11.x: EnvironmentVariables.java

Nexus Repository 2.x latest: EnvironmentVariables.java

Have more questions? Submit a request

0 Comments

Article is closed for comments.