zoukankan      html  css  js  c++  java
  • maven发布jar包到私服

    1.setting.xml配置

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    
    <!-- 配置本地仓库 -->
    <localRepository>e:/mvn_repo/repository</localRepository>
    
    <pluginGroups>
      </pluginGroups>
    <proxies>
      </proxies>
    
    <servers>
        <!-- 配置服务器 -->
        <server>
     <!-- 注意这里的id,以后再MyEclipse项目中的pom.xml文件里的发布管理器id要一样-->
          <id>releases</id>  <!-- 配置nexus私服中releases仓库 -->
          <username>admin</username>
          <password>admin123</password>
        </server>
    
        <server>
     <!-- 注意这里的id,以后再MyEclipse项目中的pom.xml文件里的发布管理器id要一样-->
          <id>snapshots</id> <!-- 配置nexus私服中snapshots仓库 -->
          <username>admin</username>
          <password>admin123</password>
        </server>
        
         
      </servers>
    
    <mirrors>
     
         <mirror>
          <id>nexus</id>
          <mirrorOf>*</mirrorOf>
          <url>http://ip:8081/nexus/content/groups/public</url>
        </mirror>
        
      </mirrors>
    
    <profiles>
    <profile>
          <id>development</id>
          <activation>
          <jdk>1.8</jdk>
          <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
          <maven.compiler.source>1.8</maven.compiler.source>
          <maven.compiler.target>1.8</maven.compiler.target>
          <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
        </properties>
        
         <!-- 仓库。仓库是Maven用来填充构建系统本地仓库所使用的一组远程项目。而Maven是从本地仓库中使用其插件和依赖。
              不同的远程仓库可能含有不同的项目,而在某个激活的profile下,可能定义了一些仓库来搜索需要的发布版或快照版构件。有了Nexus,这些应该交由Nexus完成 -->
          <repositories>
            <repository>
              <id>central</id>
              <!-- 虚拟的URL形式,指向镜像的URL,因为所有的镜像都是用的是nexus,这里的central实际上指向的是http://repos.d.xxx.com/nexus/content/groups/public -->
              <url>http://central</url>
              <!-- 表示可以从这个仓库下载releases版本的构件-->
              <releases><enabled>true</enabled></releases>
              <!-- 表示可以从这个仓库下载snapshot版本的构件 -->
              <snapshots><enabled>true</enabled></snapshots>
            </repository>
          </repositories>
    
          <!-- 插件仓库。仓库是两种主要构件的家。第一种构件被用作其它构件的依赖。这是中央仓库中存储大部分构件类型。
             另外一种构件类型是插件。Maven插件是一种特殊类型的构件。由于这个原因,插件仓库独立于其它仓库。
            pluginRepositories元素的结构和repositories元素的结构类似。每个pluginRepository元素指定一个Maven可以用来寻找新插件的远程地址。 -->  
        
          <pluginRepositories>
            <pluginRepository>
              <id>central</id>
              <url>http://central</url>
              <releases><enabled>true</enabled></releases>
              <snapshots><enabled>true</enabled></snapshots>
            </pluginRepository>
          </pluginRepositories>
    
        </profile>
    </profiles>
    
    <activeProfiles>
        <activeProfile>development</activeProfile>
      </activeProfiles>
    </settings>
    setting.xml配置

    2.pom.xml配置

    <!-- 配置远程发布到私服,mvn deploy -->
        <distributionManagement>
            <repository>
                <id>releases</id>
                <name>Nexus Release Repository</name>
                <url>http://ip:8081/nexus/content/repositories/releases/</url>
            </repository>
            <snapshotRepository>
                <id>snapshots</id>
                <name>Nexus Snapshot Repository</name>
                <url>http://ip:8081/nexus/content/repositories/snapshots/</url>
            </snapshotRepository>
        </distributionManagement>
    
    <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.4</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    pom.xml配置

    3.eclipse执行deploy

  • 相关阅读:
    准确率99%!基于深度学习的二进制恶意样本检测——瀚思APT 沙箱恶意文件检测使用的是CNN,LSTM TODO
    借贷宝有多少人看得懂?借贷宝系统崩溃分析
    武汉Uber优步司机奖励政策
    杭州优步uber司机第三组奖励政策
    杭州优步uber司机第二组奖励政策
    杭州优步uber司机第一组奖励政策
    优步北京B组(8月10日-8月16日奖励规则)
    滴滴快车奖励政策,高峰奖励,翻倍奖励,按成交率,指派单数分级(8月4日)
    关于借贷宝“骗钱、推广是假的、传销、恶意盗取用户信息等”谣言的澄清
    借贷宝谣言制造者孟某承认造谣并公开致歉
  • 原文地址:https://www.cnblogs.com/liaozhenghan/p/9794757.html
Copyright © 2011-2022 走看看