持续集成篇_04_Nexus配置

来源:互联网 发布:2017剑灵画面设置优化 编辑:程序博客网 时间:2024/06/07 11:43

Nexus配置(登录后)

1.菜单Administration/Server配置邮箱服务地址(如果忘记密码,可以通过改邮箱找回密码)



给用户配置邮箱地址,方便忘记密码时找回


用用户修改密码



2.仓库类型


group 仓库组:Nexus通过仓库组的概念统一管理多个仓库,这样我们在项目中直接请求仓库组即可请求到仓库组管理的多个仓库

hosted 宿主仓库:主要用于发布内部项目构件或第三方的项目构件(如购买商业的构件)以及无法从公共仓库获取构件的构件(如oracle的JDBC驱动)

proxy 代理仓库:代理公共的远程仓库

virtual 虚拟仓库:用于甜酸  Maven 1

一般用到的仓库种类是hosted,proxy

Hosted仓库常用类型说明:

releases 内部的模块中release模块的发布仓库

snapshots 发布内部的SNAPSHOT模块的仓库

3rd party 第三方依赖仓库,这个数据通常是由内部人员自动下载之后发布上去的

如果构建的Maven项目本地仓库没有对应的依赖包,那么就会去Nexus私服去下载,如果Nexus私服也没有依赖包,就回去远程中央仓库下载依赖,这些中央仓库就是proxy。

Nexus私服下载成功后再下载至本地Maven库供项目引用。

 3.设置proxy代理仓库(Apache Snapshots/Central/Codehaus Snapshots)准许远程下载

如:


4.Maven本地库的setting.conf文件配置(在maven安装目录conf目录下的或者用户文档.m2目录下)

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>E:/apache-maven-3.0.5/repo</localRepository>
<interactiveMode>true</interactiveMode>
<offline>false</offline>
<pluginGroups>
<pluginGroup>org.mortbay.jetty</pluginGroup>
<pluginGroup>org.jenkins-ci.tools</pluginGroup>
</pluginGroups>


<!--配置权限,使用默认用户 -->
<servers>
<server>
<id>
nexus-releases</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>
nexus-snapshots</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>



<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://192.168.1.51:8081/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>edu</id>
<activation>
<activeByDefault>false</activeByDefault>
<jdk>1.6</jdk>
</activation>
<repositories>
<!-- 私有库地址 -->
<repository>
<id>nexus</id>
<url>http://192.168.1.51:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>

</repository>
</repositories>
<pluginRepositories>
<!--插件库地址 -->
<pluginRepository>
<id>nexus</id>
<url>http://192.168.1.51:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>

</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<!--激活profile -->
<activeProfiles>
<activeProfile>edu</activeProfile>
</activeProfiles>
</settings>

5.eclipse安装maven






项目pom.xml配置

<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://192.168.1.51:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://192.168.1.51:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>

Maven操作

mvn install 安装jar

mvn package 打包

mvn clean 清理

mvn deploy 发布

mvn install


查看安装成功jar


mvn deploy 


查看发布成功的jar


0 0