Nexus版本是2.14.2-01-bundle,支持jdk1.7 。
部署在ip为192.168.2.102的虚拟机上,目录路径在/apps/svr/Nexus/nexus-2.14.2-01/中。
访问路径是http://192.168.2.102:8081/nexus
管理账号:admin/admin123
所有发布到maven私库上的目录都可以通过http://192.168.2.102:8081/nexus/content/groups/public/ 访问得到,但是在Nexus上分了三个目录,分别存储不同的内容:
3rd party:第三方jar包存放目录。
Releases:发布版本的目录。
Snapshots:开发版本的目录。
登录Nexus首先要将目录的Deployment Policy属性设置为Allow Redoploy,这个设置是让项目可以重复部署。
Nexus还提供了用户管理的功能,可以在左侧菜单依次打开Security->Users,打开用户管理界面。
在maven目录conf中的setting.xml中设置添加元素
<servers>
<server>
<id>releasesid>
<username>salesonusername>
<password>******password>
server>
<server>
<id>snapshotsid>
<username>salesonusername>
<password>******password>
server>
<server>
<id>thirdpartyid>
<username>salesonusername>
<password>******password>
server>
servers>
在项目的pom.xml文件中配置:
<repositories>
<repository>
<id>publicid>
<name>Team Nexus Repositoryname>
<url>http://192.168.2.102:8081/nexus/content/groups/publicurl>
repository>
repositories>
<pluginRepositories>
<pluginRepository>
<id>publicid>
<name>Team Nexus Repositoryname>
<url>http://192.168.2.102:8081/nexus/content/groups/publicurl>
pluginRepository>
pluginRepositories>
<distributionManagement>
<repository>
<id>releasesid>
<url>http://192.168.2.102:8081/nexus/content/repositories/releases/url>
repository>
<snapshotRepository>
<id>snapshotsid>
<url>http://192.168.2.102:8081/nexus/content/repositories/snapshots/url>
snapshotRepository>
distributionManagement>
在项目根目录下运行mvn deploy -e就可以将jar包提交到Nexus服务器上了。
也可以在Eclipse 中配置一个maven build,Debug->Debug Configurations->Maven Build->New ,选择要提交的项目,在Goals那行输入:deploy -e,然后点击Debug,就可以将jar文件提交到Nexus服务器上了。
这两个目录是根据提交时,项目的version有关的,根据version后缀,如果是以-SNAPSHOT结尾的,会发布到Snaphots目录,否则发布到Releases目录。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0modelVersion>
<groupId>com.singlegroupId>
<artifactId>zzh-rootartifactId>
<version>0.0.1-SNAPSHOTversion>
<packaging>pompackaging>
project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0modelVersion>
<groupId>com.singlegroupId>
<artifactId>***-parentartifactId>
<version>0.0.1-SNAPSHOTversion>
<packaging>pompackaging>
<repositories>
<repository>
<id>publicid>
<name>Team Nexus Repositoryname>
<url>http://192.168.2.102:8081/nexus/content/groups/publicurl>
repository>
repositories>
<pluginRepositories>
<pluginRepository>
<id>publicid>
<name>Team Nexus Repositoryname>
<url>http://192.168.2.102:8081/nexus/content/groups/publicurl>
pluginRepository>
pluginRepositories>
<distributionManagement>
<repository>
<id>releasesid>
<url>http://192.168.2.102:8081/nexus/content/repositories/releases/url>
repository>
<snapshotRepository>
<id>snapshotsid>
<url>http://192.168.2.102:8081/nexus/content/repositories/snapshots/url>
snapshotRepository>
distributionManagement>
<properties>
<spring.version>3.2.13.RELEASEspring.version>
<aspectjweaver.version>1.8.9aspectjweaver.version>
<cglib-nodep.version>2.2.2cglib-nodep.version>
<cglib.version>2.2.2cglib.version>
<javax.persistence-api.version>1.0javax.persistence-api.version>
<druid.version>1.0.27druid.version>
<mysql-connector-java.version>6.0.5mysql-connector-java.version>
<mybatis.version>3.4.1mybatis.version>
<mybatis-spring.version>1.3.0mybatis-spring.version>
<tk.mapper.version>3.3.9tk.mapper.version>
<pagehelper.version>4.2.1pagehelper.version>
<quartz.version>2.2.3quartz.version>
<hibernate-validator.version>5.3.4.Finalhibernate-validator.version>
<dubbo.version>2.8.4dubbo.version>
<zookeeper.version>3.4.9zookeeper.version>
<spring-data-redis.version>1.7.5.RELEASEspring-data-redis.version>
<jedis.version>2.9.0jedis.version>
<fastjson.version>1.2.22fastjson.version>
<jackson.version>2.8.5jackson.version>
<jackson-mapper-asl.version>1.9.13jackson-mapper-asl.version>
<caucho.hessian.version>4.0.38caucho.hessian.version>
<httpclient.version>4.5.2httpclient.version>
<commons-lang3.version>3.5commons-lang3.version>
<commons-io.version>2.5commons-io.version>
<commons-collections.version>3.2.2commons-collections.version>
<commons-beanutils.version>1.9.3commons-beanutils.version>
<commons-codec.version>1.10commons-codec.version>
<commons-pool.version>1.6commons-pool.version>
<commons-math3.version>3.6.1commons-math3.version>
<commons-fileupload.version>1.3.2commons-fileupload.version>
<dozer.version>5.5.1dozer.version>
<guava.version>20.0guava.version>
<joda-time.version>2.9.6joda-time.version>
<prettytime.version>4.0.1.Finalprettytime.version>
<log4j.version>1.2.7log4j.version>
<slf4j.version>1.7.22slf4j.version>
<logback.version>1.1.8logback.version>
properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.servletgroupId>
<artifactId>javax.servlet-apiartifactId>
<version>3.1.0version>
<scope>providedscope>
dependency>
<dependency>
<groupId>javax.servletgroupId>
<artifactId>servlet-apiartifactId>
<version>2.5version>
<scope>providedscope>
dependency>
<dependency>
<groupId>javax.servletgroupId>
<artifactId>jstlartifactId>
<version>1.2version>
dependency>
<dependency>
<groupId>javax.servletgroupId>
<artifactId>jsp-apiartifactId>
<version>2.0version>
<exclusions>
<exclusion>
<groupId>javax.servletgroupId>
<artifactId>javax.servlet-apiartifactId>
exclusion>
exclusions>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-contextartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-coreartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-beansartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-webartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-webmvcartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-jdbcartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-txartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-context-supportartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-aopartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.aspectjgroupId>
<artifactId>aspectjweaverartifactId>
<version>${aspectjweaver.version}version>
dependency>
<dependency>
<groupId>cglibgroupId>
<artifactId>cglib-nodepartifactId>
<version>${cglib-nodep.version}version>
dependency>
<dependency>
<groupId>cglibgroupId>
<artifactId>cglibartifactId>
<version>${cglib.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-testartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>javax.persistencegroupId>
<artifactId>persistence-apiartifactId>
<version>${javax.persistence-api.version}version>
dependency>
<dependency>
<groupId>com.alibabagroupId>
<artifactId>druidartifactId>
<version>${druid.version}version>
dependency>
<dependency>
<groupId>mysqlgroupId>
<artifactId>mysql-connector-javaartifactId>
<version>${mysql-connector-java.version}version>
dependency>
<dependency>
<groupId>org.mybatisgroupId>
<artifactId>mybatisartifactId>
<version>${mybatis.version}version>
dependency>
<dependency>
<groupId>org.mybatisgroupId>
<artifactId>mybatis-springartifactId>
<version>${mybatis-spring.version}version>
dependency>
<dependency>
<groupId>tk.mybatisgroupId>
<artifactId>mapperartifactId>
<version>${tk.mapper.version}version>
dependency>
<dependency>
<groupId>com.github.pagehelpergroupId>
<artifactId>pagehelperartifactId>
<version>${pagehelper.version}version>
dependency>
<dependency>
<groupId>com.alibabagroupId>
<artifactId>fastjsonartifactId>
<version>${fastjson.version}version>
dependency>
<dependency>
<groupId>com.fasterxml.jackson.coregroupId>
<artifactId>jackson-databindartifactId>
<version>${jackson.version}version>
dependency>
<dependency>
<groupId>com.fasterxml.jackson.coregroupId>
<artifactId>jackson-coreartifactId>
<version>${jackson.version}version>
dependency>
<dependency>
<groupId>org.codehaus.jacksongroupId>
<artifactId>jackson-mapper-aslartifactId>
<version>${jackson-mapper-asl.version}version>
dependency>
<dependency>
<groupId>org.quartz-schedulergroupId>
<artifactId>quartzartifactId>
<version>${quartz.version}version>
dependency>
<dependency>
<groupId>org.hibernategroupId>
<artifactId>hibernate-validatorartifactId>
<version>${hibernate-validator.version}version>
dependency>
<dependency>
<groupId>com.alibabagroupId>
<artifactId>dubboartifactId>
<version>${dubbo.version}version>
<exclusions>
<exclusion>
<artifactId>springartifactId>
<groupId>org.springframeworkgroupId>
exclusion>
exclusions>
dependency>
<dependency>
<groupId>org.apache.zookeepergroupId>
<artifactId>zookeeperartifactId>
<version>${zookeeper.version}version>
dependency>
<dependency>
<groupId>com.github.sgroschupfgroupId>
<artifactId>zkclientartifactId>
<version>0.1version>
dependency>
<dependency>
<groupId>org.springframework.datagroupId>
<artifactId>spring-data-redisartifactId>
<version>${spring-data-redis.version}version>
dependency>
<dependency>
<groupId>redis.clientsgroupId>
<artifactId>jedisartifactId>
<version>${jedis.version}version>
dependency>
<dependency>
<groupId>com.cauchogroupId>
<artifactId>hessianartifactId>
<version>${caucho.hessian.version}version>
dependency>
<dependency>
<groupId>org.apache.httpcomponentsgroupId>
<artifactId>httpclientartifactId>
<version>${httpclient.version}version>
dependency>
<dependency>
<groupId>org.apache.httpcomponentsgroupId>
<artifactId>httpclient-cacheartifactId>
<version>${httpclient.version}version>
dependency>
<dependency>
<groupId>org.apache.httpcomponentsgroupId>
<artifactId>httpmimeartifactId>
<version>${httpclient.version}version>
dependency>
<dependency>
<groupId>org.apache.commonsgroupId>
<artifactId>commons-lang3artifactId>
<version>${commons-lang3.version}version>
dependency>
<dependency>
<groupId>commons-iogroupId>
<artifactId>commons-ioartifactId>
<version>${commons-io.version}version>
dependency>
<dependency>
<groupId>commons-collectionsgroupId>
<artifactId>commons-collectionsartifactId>
<version>${commons-collections.version}version>
dependency>
<dependency>
<groupId>commons-codecgroupId>
<artifactId>commons-codecartifactId>
<version>${commons-codec.version}version>
dependency>
<dependency>
<groupId>commons-beanutilsgroupId>
<artifactId>commons-beanutilsartifactId>
<version>${commons-beanutils.version}version>
<exclusions>
<exclusion>
<groupId>commons-logginggroupId>
<artifactId>commons-loggingartifactId>
exclusion>
exclusions>
dependency>
<dependency>
<groupId>commons-poolgroupId>
<artifactId>commons-poolartifactId>
<version>${commons-pool.version}version>
dependency>
<dependency>
<groupId>org.apache.commonsgroupId>
<artifactId>commons-math3artifactId>
<version>${commons-math3.version}version>
dependency>
<dependency>
<groupId>commons-fileuploadgroupId>
<artifactId>commons-fileuploadartifactId>
<version>${commons-fileupload.version}version>
dependency>
<dependency>
<groupId>net.sf.dozergroupId>
<artifactId>dozerartifactId>
<version>${dozer.version}version>
<exclusions>
<exclusion>
<groupId>org.slf4jgroupId>
<artifactId>slf4j-log4j12artifactId>
exclusion>
exclusions>
dependency>
<dependency>
<groupId>net.sf.dozergroupId>
<artifactId>dozer-springartifactId>
<version>${dozer.version}version>
dependency>
<dependency>
<groupId>com.google.guavagroupId>
<artifactId>guavaartifactId>
<version>${guava.version}version>
dependency>
<dependency>
<groupId>joda-timegroupId>
<artifactId>joda-timeartifactId>
<version>${joda-time.version}version>
dependency>
<dependency>
<groupId>org.ocpsoft.prettytimegroupId>
<artifactId>prettytimeartifactId>
<version>${prettytime.version}version>
dependency>
<dependency>
<groupId>log4jgroupId>
<artifactId>log4jartifactId>
<version>${log4j.version}version>
<scope>providedscope>
dependency>
<dependency>
<groupId>org.slf4jgroupId>
<artifactId>slf4j-apiartifactId>
<version>${slf4j.version}version>
dependency>
<dependency>
<groupId>ch.qos.logbackgroupId>
<artifactId>logback-classicartifactId>
<version>${logback.version}version>
dependency>
<dependency>
<groupId>ch.qos.logbackgroupId>
<artifactId>logback-coreartifactId>
<version>${logback.version}version>
<type>jartype>
dependency>
<dependency>
<groupId>org.logback-extensionsgroupId>
<artifactId>logback-ext-springartifactId>
<version>0.1.4version>
dependency>
<dependency>
<groupId>org.slf4jgroupId>
<artifactId>log4j-over-slf4jartifactId>
<version>${slf4j.version}version>
dependency>
<dependency>
<groupId>org.slf4jgroupId>
<artifactId>jcl-over-slf4jartifactId>
<version>${slf4j.version}version>
dependency>
<dependency>
<groupId>org.slf4jgroupId>
<artifactId>jul-to-slf4jartifactId>
<version>${slf4j.version}version>
dependency>
<dependency>
<groupId>com.googlecode.log4jdbcgroupId>
<artifactId>log4jdbcartifactId>
<version>1.2version>
<scope>runtimescope>
dependency>
<dependency>
<groupId>net.coobirdgroupId>
<artifactId>thumbnailatorartifactId>
<version>0.4.8version>
dependency>
dependencies>
dependencyManagement>
<profiles>
<profile>
<id>productionid>
<properties>
<profiles.active>productionprofiles.active>
properties>
profile>
<profile>
<id>prereleaseid>
<properties>
<profiles.active>prereleaseprofiles.active>
properties>
profile>
<profile>
<id>devid>
<properties>
<profiles.active>devprofiles.active>
properties>
<activation>
<activeByDefault>trueactiveByDefault>
activation>
profile>
<profile>
<id>testid>
<properties>
<profiles.active>testprofiles.active>
properties>
profile>
profiles>
project>