Nexus
From KevinWiki
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.propertiesfile in the/etc/apache2directory. - Add a new
workerfor 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
JkMountin 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.xmlfile to set up a new tomcat virtual host for the nexus. - Add the virtual host info inside the
Engineelement.
<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>
- If the virtual host is for Nexus only (e.g. http://nexus.yourdomain.com),
- Remove all the files and directories in the
appBasedirectory which is, in the example above,/opt/tomcat_user_dir/nexus_webapps. - Copy
nexus-webapp-0.0.0.warfile to theappBasedirectory and changenexus-webapp-0.0.0.wartoROOT.war.
- Restart tomcat and apache.
$ /etc/init.d/tomcat stop $ /etc/init.d/tomcat start $ /etc/init.d/apache restart
- access https://nexus.yourdomain.com.
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