Can I override Nexus configuration properties with environment variables?

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

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

Caution: In older versions of Nexus 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 version. You can grep the Nexus OSS source code for 'NEXUS_' and 'PLEXUS_' to find the locations if the following links no longer work.

Nexus 2.11.x: EnvironmentVariables.java

Nexus 2.x latest: EnvironmentVariables.java

Have more questions? Submit a request

0 Comments

Article is closed for comments.