- 浏览: 545606 次
- 性别:
- 来自: 西安
文章分类
- 全部博客 (251)
- UML/RUP/软件工程 (0)
- DDD:领域驱动设计 (1)
- IaaS/Paas/SaaS (1)
- Hadoop/YARN (10)
- PBDP项目 (2)
- OSGi-基础 (7)
- OSGi-Aries (2)
- OSGi-SpringDM (32)
- Oracle/MySQL/SS (8)
- Felix/Equinox/Bnd (14)
- Virgo Server/Gemini (7)
- Weblogic/JBoss/Tomcat (10)
- ActiveMQ (14)
- Camel (1)
- Spring Roo/Eclipse (7)
- Java/JSP/JSF (10)
- Maven (19)
- ESB-Mule (1)
- ESB-ServiceMix (18)
- SOA/SCA/SDO (12)
- WebService/RESTful (17)
- JS/jQuery/ExtJS (4)
- Spring/JPA/MVC (15)
- SpringSecurity (5)
- BPM/jBPM (3)
- Hudson/SVN/CI (0)
- LinuxOS/虚拟化 (25)
- Office/OpenOffice (1)
- 项目管理 (5)
- POI/jFreeChart (1)
最新评论
-
panamera:
请问JMS Transport 发布的webservice 是 ...
CXF 提供的Service Transport-JMS Transpor -
jianyi296:
where is attachment.
CXF WebService Dynamic Client -
hj01kkk:
您好,我用jdbc-user-service为什么每次验证时都 ...
SpringSecurity笔记3-Authenticating Users:Authenticaton Strategy -
wufenglin1231:
你好,我在实现Mapping exceptions to re ...
RESTful 异常处理 -
xchd:
[echo] Project: common
[echo ...
Hive安装配置学习笔记
搭建私服的优点:
(1) 降低中央仓库负荷
(2) 节省外网带宽
(3) 加速Maven构建
(4) 自己部署构件
1. Nexus安装
(1) 下载:http://www.sonatype.org/nexus/,下载包:nexus-2.0.2.war
(2) 安装
A. WAR方式安装Nexus
将nexus-2.0.2.war拷贝至Tomcat的部署目录:C:\Apache-tomcat-7.0.26\webapps下,
启动Tomcat, 进入Tomcat管理首页即可;
浏览器访问地址:http://localhost:8080/nexus
B. Bundle方式安装Nexus
因为Bundle方式的Nexus默认集成了Jetty容器,因此不需要其他第三方Web容器,解压下载的Bundle
方式的Nexus文件,有下面的两个目录:
nexus-webapp-2.0.2:包含Nexus所需要的文件,如启动脚本,依赖JAR等。
sonatype-work:包含Nexus生成的配置文件、日志文件、仓库文件。
WinOS下,进入nexus-webapp-2.0.2/bin/jsw/windows-x86-32运行nexus.bat脚本启动服务。
浏览器访问地址:http://localhost:8081/nexus
备注:
更改访问端口:修改nexus-webapp-2.0.2/conf/plexus.properties
(3) 登录
Nexus默认的管理员及密码:admin/admin123
2. Nexus的仓库与仓库组
Nexus有四种仓库类型:group,hosted,proxy,virtual,仓库格式为:maven2或maven1,仓库属性Policy
为:Release或Snapshot.
3. 配置Maven从Nexus下载构件
(1) 在POM中配置Nexus仓库
<project>
...
<repositories>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/<url>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/<url>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</pluginRepository>
</pluginRepositories>
...
</project>
上述配置只对当前项目有效,若需让本机所有Maven项目均使用Mavne私服,应该在setting.xml中进行配置。
(2) 在setting.xml中配置Nexus仓库
<settings>
...
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/<url>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/<url>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfiles>
</activaProfiles>
...
</settings>
(3) 配置镜像让Maven只使用私服
<settings>
...
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*<?mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<name>http://central</name>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>http://central</name>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfiles>
</activaProfiles>
...
</settings>
说明:该配置中仓库及插件仓库的id均为central,即覆盖了超级POM中央仓库的配置,他们的ULR可以不做
配置,因为所有请求都会通过镜像访问私服地址。
4. 部署构件至Nexus
(1) 使用Maven部署构件至Nexus
<project>
...
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Releasse Repository</name>
<url>http://localhost:8081/nexus/content/repositories/release</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshots Repository</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
...
</project>
Nexus的仓库对于匿名用户时只读的,为了方便部署,需要在setting.xml配置认证信息:
<settings>
...
<servers>
<server>
<id>nexus-releases></id>
<username>admin</username>
<password>*****</password>
</server>
<server>
<id>nexus-snapshots></id>
<username>admin</username>
<password>*****</password>
</server>
</servers>
...
</settings>
(2) 手动部署第三方构件至Nexus
选择宿主仓库如:3rd Party,在Artifact Upload中上传。
5. 其他私服软件
Apache的Archive和JForg的Artifactory.
评论
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<mirror>
<id>ibiblio.org</id>
<name>ibiblio Mirror of http://repo1.maven.org/maven2/</name>
<url>http://mirrors.ibiblio.org/maven2/</url>
<mirrorOf>central</mirrorOf>
<!-- United States, North Carolina -->
</mirror>
<mirror>
<id>cica.es</id>
<url>http://ftp.cica.es/mirrors/maven2/</url>
<mirrorOf>central</mirrorOf>
<!-- Spain, Sevilla -->
</mirror>
</mirrors>
谢谢.
发表评论
-
M2Eclipse-:Maven dependencies as JAR's not projects
2013-01-24 19:07 1107Eclipse中Maven工程(采用M2Eclipse插件)依 ... -
解决联通网络环境下无法访问Maven中央仓库问题
2013-01-24 19:07 2840解决无法访问Maven中央仓库:http://repo1.ma ... -
Maven profile的几种激活方式
2013-01-24 18:47 1203转自:http://juvenshun.iteye.com ... -
Maven笔记11-Maven进行测试
2012-03-22 22:39 13431. maven-surefire-plugin 该 ... -
Maven笔记10-Maven生成项目站点
2012-03-19 22:30 22741. 生成简单的站点 (1) 配置 < ... -
Maven笔记9-与Hudson进行持续集成
2012-03-18 17:59 15261. 持续集成:Continuous Integration ... -
Maven笔记7-Maven聚合与继承
2012-03-18 10:45 11041. Maven聚合:方便快速构建项目 <mo ... -
Maven笔记6-Maven生命周期和插件
2012-03-18 10:44 16361. 生命周期-模板方法设计模式的典型运用 Mave ... -
Maven笔记5-Maven仓库
2012-03-18 10:43 2094Maven仓库布局方式:groupId/artifac ... -
Maven笔记4-Maven坐标和依赖
2011-12-07 20:20 1622Maven的坐标元素有 ... -
Maven常见插件使用-M2Eclipse
2011-12-07 19:51 1524Maven插件均配置在pom.xml中的<pro ... -
Mavne异常:OutOfMemoryError: Java heap space
2011-09-08 13:15 1843解决方法:调整java的堆内存大小。 1. Windows环 ... -
Maven下忽略或跳过单元测试配置
2011-08-15 20:27 16781. 忽略单元测试失败 ... < ... -
Pax Runner 编译、配置及使用
2011-08-08 11:08 16511. 编译: Download:https: // ... -
Pax Construct及Maven Pax Plugin插件使用
2011-08-05 10:02 36310. Pax-Construct安装 下载:http ... -
Maven笔记3-构建Maven项目
2011-06-26 14:06 11551. 使用Archatype生成项目骨架 mvn ... -
Maven笔记2-安装,配置,测试及安装最佳实践
2011-06-26 13:22 23531. Maven 安装 (1) W ... -
Maven笔记1-Maven核心概念及代理配置
2011-06-26 13:04 15271. Maven定义 Maven ...
相关推荐
apache-maven-3.8.6-bin.tar.tz--test apache-maven-3.8.6-bin.tar.tz--test apache-maven-3.8.6-bin.tar.tz--test apache-maven-3.8.6-bin.tar.tz--test apache-maven-3.8.6-bin.tar.tz--test apache-maven-3.8.6-...
maven资源 apache-maven-3.3.9-bin.zip
maven-bin-tar安装包-使用linuxmaven-bin-tar安装包-使用linuxmaven-bin-tar安装包-使用linuxmaven-bin-tar安装包-使用linuxmaven-bin-tar安装包-使用linuxmaven-bin-tar安装包-使用linuxmaven-bin-tar安装包-使用...
解决tomcat8-maven-plugin-3.0-r1655215.jar阿里云同有的问题。放到路径org\apache\tomcat\maven\tomcat8-maven-plugin\3.0-r1655215\就可以了
maven-deploy-plugin-2.8.2.jar
maven-jar-plugin-3.1.1.jar
maven-shared-utils-3.2.1.jar
maven是个项目管理工具,如果我们不告诉它我们的代码要使用什么样的jdk版本编译的话,它就会用maven-compiler-plugin默认的jdk版本来进行处理,这样就容易出现版本不匹配,以至于可能导致编译不通过的问题。...
maven-antrun-plugin-3.0.0.jar
linux-maven-maven私服nexus安装文档
maven-notice-plugin-1.0.1.jar
maven-javadoc-plugin 插件 解决中文乱码 和注解 时间问题, 包括eclipse.ini设置、pom.xml设置、maven build GBK设置、eclipse注释设置、eclipse注释模版(可导入)。
maven-install-plugin-2.4.jar
apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-...
maven-deploy-plugin-2.7.jar
maven-site-plugin-3.3.jar
maven-archetype-webapp-1.0.jar,下载,如果有需要的同志可以自己下载,。
apache-maven-3.9.6-bin
apache-maven-3.6.3-bin.zip maven3,6版本, 可用apache-maven-3.6.3-bin.zip maven3,6版本, 可用apache-maven-3.6.3-bin.zip maven3,6版本, 可用apache-maven-3.6.3-bin.zip maven3,6版本, 可用apache-maven-3.6.3-...
apache-maven-3.8.5-bin.zip