Trouble relocating nexus folder?

I got a bit adventurous and decided to install the Nexus in our Dev server. We already have a working version in a virtual environment, but I’ve got my hands on a clean Linux machine and I thought to make best use of it.

I have found this blog post very helpful for a non-Linux native person.
It was very simple to get it started (after I have sorted out some environmental and user right issues).

Once I got it started at port 8081, I wanted to move the folders around. But I didn’t want to set the environment variables, just to make sure my folder structure works..

In order to do this the main file you want to edit is located here,

/[your system folder structure]/nexus-webapp-[version]/conf/wrapper.conf

the wrapper.conf looks like this – just out of the box..

#********************************************************************
# Wrapper Properties
#********************************************************************
# Java Application
wrapper.java.command=java

# Wait a bit longer than default before assuming jvm hasn’t started properly
wrapper.startup.timeout=90

#wrapper.debug=true
#This should be set to the base of your system, which is one folder below the container and nexus folders
#wrapper.working.dir=../../../../

# Java Main class.  This class must implement the WrapperListener interface
#  or guarantee that the WrapperManager class is initialized.  Helper
#  classes are provided to do this for you.  See the Integration section
#  of the documentation for details.
wrapper.java.mainclass=org.codehaus.plexus.classworlds.launcher.Launcher

# Java Classpath (include wrapper.jar)  Add class path elements as
#  needed starting from 1
#wrapper.java.classpath.1=../lib/wrapper.jar
#wrapper.java.classpath.2=../lib/my-app-1.0-SNAPSHOT.jar
wrapper.java.classpath.1=../../../lib/*.jar
wrapper.java.classpath.2=../../../conf/

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=./lib

# Java Additional Parameters
#wrapper.java.additional.1=-d64
#wrapper.java.additional.2=-Dcom.sun.management.jmxremote
#wrapper.java.additional.3=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true
wrapper.java.additional.1=-Dbasedir=../../..
wrapper.java.additional.2=-Djava.io.tmpdir=../../../runtime/tmp
wrapper.java.additional.3=-Dsun.net.inetaddr.ttl=3600
#wrapper.java.additional.4=-Xdebug
#wrapper.java.additional.5=-Xnoagent
#wrapper.java.additional.6=-Djava.compiler=NONE
#wrapper.java.additional.7=-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
#wrapper.java.additional.8=-XX:+HeapDumpOnOutOfMemoryError

# Initial Java Heap Size (in MB)
#wrapper.java.initmemory=3
#

# Maximum Java Heap Size (in MB)
#wrapper.java.maxmemory=64
#

# Application parameters.  Add parameters as needed starting from 1
#wrapper.app.parameter.1=com.mycompany.app.App
#

# Make wrapper reload configuration between app restarts (NEXUS-3032)
wrapper.restart.reload_configuration=TRUE
wrapper.on_exit.12=RESTART

#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console.  (See docs for formats)
wrapper.console.format=PM

# Log Level for console output.  (See docs for log levels)
wrapper.console.loglevel=INFO

# Log file to use for wrapper output logging.
wrapper.logfile=../../../logs/wrapper.log

# Format of output for the log file.  (See docs for formats)
wrapper.logfile.format=LPTM

…..

I didn’t like the idea of having relative paths and leaving all the standard stuff aside, I only wanted to make sure it has got the correct base directory to work with.

So all I did is introduce couple of variable like this at the top :

set.REPO.HOME=/usr/local/your-base-directory-for-nexus/
set.NEXUS.HOME=/usr/local/your-base-directory-for-nexus/nexus
set.NEXUS.PLATFORM=linux-x86-xx

and for all the relative path-ed variable, just update them like this:

….

wrapper.java.additional.1=-Dbasedir=%NEXUS.HOME%
wrapper.java.additional.2=-Djava.io.tmpdir=%NEXUS.HOME%/runtime/tmp

# Log file to use for wrapper output logging.
wrapper.logfile=%NEXUS.HOME%/logs/wrapper.log

If you want to change the folder location, all you need to do is just update your HOME variable to the new path and all will be well. Hope this helpful !

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s