Maven搭建本地倉庫


 大數據交流羣: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.zipnexus-2.9.0.war

 

2、加壓apache-tomact-7.0.63-windows-x86_64.zipnexus-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使用win7maven本地倉庫服務器

---------------------------------------------------

1.編輯/soft/maven/conf/settings.xml

進入C:\downloads\myprograms\apache-maven-3.3.9\confsettings.xml文件全部覆蓋複製給ubuntu裏的settings.xml/soft/maven/conf/settings.xml-----ubuntu裏的路徑)

同上!


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章