Maven私库和本地Maven项目配置

来源:互联网 发布:linux socket编程实例 编辑:程序博客网 时间:2024/06/07 09:02
1、项目私库服务器配置

settting 文件里面的配置
  <profiles>
    <profile>
        <id>nexusProfiles</id>
        <repositories>
            <repository>
              <id>nexus</id>
              <name>nexus Repository</name>
              <url>http://192.168.45.25:8081/nexus/content/groups/public/</url>
              <release>
                <enabled>true</enabled> <!-- 是否可以下载release的包  true为空,false为不可以,默认为false-->
              </release>
              <snapshots>
                <enabled>true</enabled> <!-- 是否下载snapshots的包 -->
              </snapshots>
            </repository>
      </repositories>
    </profile>

  </profiles>
    <!-- 只有激活之后才会生效  -->
   <activeProfiles>
      <activeProfile>nexusProfiles</activeProfile>
   </activeProfiles>


2、maven的默认中央仓库配置


apache-maven-3.2.3\lib\maven-model-builder-3.2.3.jar  包里面的 pom-4.0.0.xml文件里,如图


3、maven中央工厂只能有私有仓库访问,需要配置镜像 mirror
 <!-- 工厂镜像,只要mirrorOf 的工厂要访问,都会自动来找镜像,
            如果镜像无法访问,就不会再去中央工厂访问
      -->
    <mirror>
      <id>nexusMirror</id>
      <mirrorOf>nexus,central</mirrorOf>  <!--  central  代表中央工厂    https://repo.maven.apache.org/maven2/    , * 表示所有的工厂-->
      <name>Human Readable Name for this Mirror.</name>
      <url>http://192.168.45.25:8081/nexus/content/groups/public/</url>
    </mirror>
   
    配置镜像之后,可以不使用  
    
<!-- 只有激活之后才会生效  -->
   <activeProfiles>
      <activeProfile>nexusProfiles</activeProfile>
   </activeProfiles>

0 0