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/". For Nexus 2.x the following environment variables can be defined:

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

Nexus 2.x latest:

Have more questions? Submit a request


Article is closed for comments.