大数据交流群:494721467
Maven搭建本地仓库:
1、下载所需软件:
Nexus-2 .9.0.war
JDK1 1.6
apache-tomcat-9.0.0.M1.tar.gz
2、安装tomcat :tar -xzvf tar -xzvf apache-tomcat-9.0.0.M1.tar.后将它移到/soft/的目录下
3、移动nexus.war到${tomact_home}/webapps/即执行:mv nexus.war /soft/tomcat/webapps
4、启动tomcat在~的目录下启动:ubuntu@s1:~$ /soft/tomcat/bin/startup.sh
5、进入web页面查看它有没有成功即登录s1:8080
在宿主机上安装maven本地仓库服务器:
1、下载所需要软件:jdk.6 、apache-tomact-7.0.63-windows-x86_64.zip、nexus-2.9.0.war
2、加压apache-tomact-7.0.63-windows-x86_64.zip、nexus-2.9.0.war
到:/myproram/(我建的目录),接下来把nexus.war拷贝到C:\downloads\myprograms\apache-tomcat-7.0.63\webapps(我的myproram目录)。然后到C:\downloads\myprograms\apache-tomcat-7.0.63\bin目录下打开startup.bat
8、建一个本地仓库文件目录 maveh-repo
9、修改默认的仓库目录进入:C:\downloads\myprograms\apache-tomcat-7.0.63\webapps\nexus\WEB-INF\classes修改:nexus.properties文件,下面是我修改的路径。
# WAR specific configuration requirements
#nexus-work=${user.home}/sonatype-work/nexus
nexus-work=e:/maven-repo/nexus//修改
runtime=${bundleBasedir}
nexus-app=${runtime}
10、配置maven使用本地仓库服务器。进入到maven所在的目录下,(我的是在/soft/)即:/soft/maven/conf修改settings.xml配置文件如下:
1、<mirrors>
<mirror>
<id>nexus-osc</id>
<mirrorOf>central</mirrorOf>
<name>Nexus osc</name>
<url>http://192.168.92.1:8080/content/groups/public/</url>
</mirror>
<mirror>
<id>nexus-osc-thirdparty</id>
<mirrorOf>thirdparty</mirrorOf>
<name>Nexus osc thirdparty</name>
<url>http://192.168.92.1:8080/content/repositories/thirdparty/</url>
</mirror>
</mirrors>
2、 <profile>
<id>env-dev</id>
<activation>
<property>
<name>target-env</name>
<value>dev</value>
</property>
</activation>
<properties>
<tomcatPath>/path/to/tomcat/instance</tomcatPath>
</properties>
</profile>
-->
<profile>
<id>jdk-1.4</id>
<activation>
<jdk>1.4</jdk>
</activation>
<repositories>
<repository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://192.168.92.1:8080/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://192.168.92.1:8080/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
(192.168.92.1是我本机的ip地址)
11、
启动本地仓库服务器
$>c:/myprograms/apache-tomcat-xxx/bin/startup.sh
12、登录web管理界面
http://192.168.92.1:8080/nexus/
13、配置ubuntu下的maven使用win7的maven本地仓库服务器
---------------------------------------------------
1.编辑/soft/maven/conf/settings.xml
进入C:\downloads\myprograms\apache-maven-3.3.9\conf把settings.xml文件全部覆盖复制给ubuntu里的settings.xml(/soft/maven/conf/settings.xml-----》ubuntu里的路径)
同上!
本文出自 “11009607” 博客,请务必保留此出处http://11019607.blog.51cto.com/11009607/1837396