maven nexus 搭建私服
2015-06-19 17:04
351 查看
Nexus 网站 http://www.sonatype.org/nexus/
nexus-2.11.2-06-bundle.tar.gz
解压下载的文件:
tar -zxvf nexus-2.11.2-06-bundle.tar.gz
解压后目录:
nexus-oss-webapp-1.8.0.1 包含了nexus的运行环境和应用程序
sonatype-work 包含了你自己的配置和数据
启动nexus
进入nexus-oss-webapp-1.8.1目录
./nexus start
访问:http://192.168.21.36:8081/nexus
用户名:admin 密码:admin123
配置Nexus
由于在新搭建的nexus环境中只是一个空的仓库,所以第一步就是要和远程的Maven中心仓库进行同步。
如果在Reindex之后,并没有同步到远程的仓库,可以检查每个仓库的设置。下面是Maven Central的设置:
download remote indexes 设置为true 在线下载索引
也可以自己拷贝索引 从网上下载
三、在项目中使用私服
在完成了上面的配置后,就可以将项目中默认的Repository切换为本地的私服了,只需要在pom.xml中增加repositories就可以了:
<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.0</modelVersion>
<groupId>com.mycom.test</groupId>
<artifactId>simple</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>simple</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>public</id>
<name>Public Repositories</name>
<url>http://192.168.1.7:8081/nexus/content/groups/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>Public Repositories</name>
<url>http://192.168.1.7:8081/nexus/content/groups/public//</url>
</pluginRepository>
</pluginRepositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
将pom.xml保存后,再回过头来了看去nexus管理界面看,就会发现junit已经被下载到本地的nexus服务器中了。
/article/5658226.html
/article/5019574.html
问题:启动maven私服nexus时报错
[root@localhost bin]# ./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.
解决方法:修改vi nexus 的 RUN_AS_USER=root
================================================================================
问题:无法启动。
解决方法:通 过 ./nexus start启动时,会自动退出。通过./nexus console查看,发现由于jdk版本造成的,原本是应该升级jdk6到jdk7,但因为服务器同时还有其他项目,怕受影响,所以降低了nexus版本,从nexus-2.6.4-02降到nexus-2.3.0-04,访问http://192.168.1.52:8081/nexus正常,问题解决
https://repo1.maven.org/maven2/
windows 起不来,如下原因是因为没有配java运行环境
wrapper.java.command=C:\Program Files (x86)\Java\jdk1.7.0_21\bin\java
nexus-2.11.2-06-bundle.tar.gz
解压下载的文件:
tar -zxvf nexus-2.11.2-06-bundle.tar.gz
解压后目录:
nexus-oss-webapp-1.8.0.1 包含了nexus的运行环境和应用程序
sonatype-work 包含了你自己的配置和数据
启动nexus
进入nexus-oss-webapp-1.8.1目录
./nexus start
访问:http://192.168.21.36:8081/nexus
用户名:admin 密码:admin123
配置Nexus
由于在新搭建的nexus环境中只是一个空的仓库,所以第一步就是要和远程的Maven中心仓库进行同步。
如果在Reindex之后,并没有同步到远程的仓库,可以检查每个仓库的设置。下面是Maven Central的设置:
download remote indexes 设置为true 在线下载索引
也可以自己拷贝索引 从网上下载
三、在项目中使用私服
在完成了上面的配置后,就可以将项目中默认的Repository切换为本地的私服了,只需要在pom.xml中增加repositories就可以了:
<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.0</modelVersion>
<groupId>com.mycom.test</groupId>
<artifactId>simple</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>simple</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>public</id>
<name>Public Repositories</name>
<url>http://192.168.1.7:8081/nexus/content/groups/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>Public Repositories</name>
<url>http://192.168.1.7:8081/nexus/content/groups/public//</url>
</pluginRepository>
</pluginRepositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
将pom.xml保存后,再回过头来了看去nexus管理界面看,就会发现junit已经被下载到本地的nexus服务器中了。
/article/5658226.html
/article/5019574.html
安装私服nexus遇到的问题
2013-11-02 08:07:33| 分类: maven|举报|字号 订阅问题:启动maven私服nexus时报错
[root@localhost bin]# ./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.
解决方法:修改vi nexus 的 RUN_AS_USER=root
================================================================================
问题:无法启动。
解决方法:通 过 ./nexus start启动时,会自动退出。通过./nexus console查看,发现由于jdk版本造成的,原本是应该升级jdk6到jdk7,但因为服务器同时还有其他项目,怕受影响,所以降低了nexus版本,从nexus-2.6.4-02降到nexus-2.3.0-04,访问http://192.168.1.52:8081/nexus正常,问题解决
https://repo1.maven.org/maven2/
windows 起不来,如下原因是因为没有配java运行环境
wrapper.java.command=C:\Program Files (x86)\Java\jdk1.7.0_21\bin\java
相关文章推荐
- SylixOS ARM BSP 第二篇【startup.S】
- Java equals()和hashCode()重写总结
- 简单灵活的 PHP页面跳转函数
- 基于一个公网ip实现多主机上网
- ubuntu14.04+CUDA7.0+cuDNN-v2+OPENCV3.0 caffe环境配置
- 224.Basic Calculator
- python 在excel文件中写入date日期数据,以及读取excel日期数据,如何在python中正确显示date日期。
- IOS Tabbed application
- 自己动手搭建Tomcat下的Servlet
- Java深入浅出系列(一)——浅析Java反射机制
- 对象的销毁与垃圾回收机制
- [ActionScript 3.0] flash中的颜色
- vim下使用YouCompleteMe实现代码提示、补全以及跳转设置
- android中fragment与activity之间通信原理以及例子
- 获取用户当前正在操作的Activity的类名
- 我的第一个Android程序-计算器
- Cordova新手上路
- Git 分布式版本控制系统(三)
- python爬虫torrentkitty的种子
- CentOS搭建SVN(CollabNet Subversion Edge)服务器