Nexus

From KevinWiki

Jump to: navigation, search


Contents

Nexus

Nexus is a Maven Repository Manager software developed by Sonatype, the maven company producing m2eclipse. There is also an open source version of it.

Installation

Download

Download the Nexus from http://nexus.sonatype.org/downloads/. To install it in Tomcat, download war file one (e.g. nexus-webapp-0.0.0.war).

Deployment (to Tomcat)

  • Install and enable mod_jk.
  • Open the workers.properties file in the /etc/apache2 directory.
  • Add a new worker for nexus.
workers.tomcat_home=/opt/tomcat
workers.java_home=/usr/lib/jvm/java-6-sun
ps=/
worker.list=worker1,nexus
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
worker.nexus.port=8009
worker.nexus.host=nexus.yourdomain.com
worker.nexus.type=ajp13
worker.nexus.lbfactor=1
  • Set up JkMount in the apache virtual host configuration.
<VirtualHost *:80>
    ServerAdmin master@yourdomain.com

    ServerName nexus.yourdomain.com

    JkMount / nexus
    JkMount /* nexus

</VirtualHost>
  • Open the $CATALINA_HOME/conf/server.xml file to set up a new tomcat virtual host for the nexus.
  • Add the virtual host info inside the Engine element.
    <Engine name="Catalina" defaultHost="localhost">
      ... Default Host Info ...
 
      <Host name="nexus.yourdomain.com" appBase="/opt/tomcat_user_dir/nexus_webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>
    </Engine>
  1. Remove all the files and directories in the appBase directory which is, in the example above, /opt/tomcat_user_dir/nexus_webapps.
  2. Copy nexus-webapp-0.0.0.war file to the appBase directory and change nexus-webapp-0.0.0.war to ROOT.war.
  • Restart tomcat and apache.
$ /etc/init.d/tomcat stop 
$ /etc/init.d/tomcat start 
$ /etc/init.d/apache restart 


Upload Artifact to Nexus Using Maven

mvn deploy:deploy-file \
    -Durl=REPO_URL \
    -DrepositoryId=REPO_ID \
    -DgroupId=org.groud.id \
    -DartifactId=artifact.id \
    -Dversion=1.0.0  \
    -Dpackaging=jar \
    -Dfile=artifact-file.jar

e.g.)

mvn deploy:deploy-file \
    -Durl=http://your.nexus.url/content/repositories/thirdparty \
    -DrepositoryId=thirdparty \
    -DgroupId=com.sun.media \
    -DartifactId=jai_imageio \
    -Dversion=1.2 \
    -Dpackaging=jar \
    -Dfile=jai_imageio-1.2.jar
Personal tools