Maven Perform a Release

执行发布

执行版本Release通常需要以下Release阶段:

  • 从具有可选tag的SCM URL中签出代码
  • 运行预定义的Maven目标以release项目(默认使用,deploy site-deploy

要执行Release,请执行以下命令:

mvn release:perform

这取决于以前的发行准备中存在的release.properties。如果不是这样,您需要给出目标URL和可选tag来执行release。例如:

mvn org.apache.maven.plugins:maven-release-plugin:2.5.3:perform 
-DconnectionUrl=scm:svn:https://svn.mycompany.com/repos/path/to/myproject/tags/myproject-1.2.3

release:perform将fork一个新的Maven实例来构建检出项目。这个新的Maven实例将使用与运行release:perform目标相同的系统配置和Maven配置文件。由于没有pom.xml,您应该使用目标的完全限定名称来确保使用正确版本的maven-release-plugin。

通过在releaseProfiles参数中设置逗号分隔的配置文件名称列表,可以强制某些配置文件在发布过程中启用(例如,以便在发布时才能启用耗时的任务)。然后可以在POM中配置发布项目所需的目标和配置文件:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.5.3</version>
    <configuration>
      <!--
        During release:perform, enable the "release" profile
       -->
      <releaseProfiles>release</releaseProfiles>
    </configuration>
  </plugin>

发布完成后,release.properties和其他发行文件将从签出中移除。


以下为实际操作输出样例:

/usr/lib/jvm/jdk1.8.0_45/bin/java -Dmaven.home=/opt/idea-IC-145.1617.8/plugins/maven/lib/maven3 -Dclassworlds.conf=/opt/idea-IC-145.1617.8/plugins/maven/lib/maven3/bin/m2.conf -Didea.launcher.port=7536 -Didea.launcher.bin.path=/opt/idea-IC-145.1617.8/bin -Dfile.encoding=UTF-8 -classpath /opt/idea-IC-145.1617.8/plugins/maven/lib/maven3/boot/plexus-classworlds-2.4.jar:/opt/idea-IC-145.1617.8/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=2016.1.3 org.apache.maven.plugins:maven-release-plugin:2.5.3:perform
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building auto-deployment 1.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-release-plugin:2.5.3:perform (default-cli) @ auto-deployment ---
[INFO] Checking out the project to perform the release ...
[INFO] Executing: /bin/sh -c cd /home/user/Workspace/git-study/auto-deployment/target && git clone --branch v1.0 git@github.com:****/git-study.git /home/user/Workspace/git-study/auto-deployment/target/checkout
[INFO] Working directory: /home/user/Workspace/git-study/auto-deployment/target
[INFO] Executing: /bin/sh -c cd /tmp && git ls-remote git@github.com:****/git-study.git
[INFO] Working directory: /tmp
[INFO] Executing: /bin/sh -c cd /home/user/Workspace/git-study/auto-deployment/target/checkout && git fetch git@github.com:****/git-study.git
[INFO] Working directory: /home/user/Workspace/git-study/auto-deployment/target/checkout
[INFO] Executing: /bin/sh -c cd /home/user/Workspace/git-study/auto-deployment/target/checkout && git checkout v1.0
[INFO] Working directory: /home/user/Workspace/git-study/auto-deployment/target/checkout
[INFO] Executing: /bin/sh -c cd /home/user/Workspace/git-study/auto-deployment/target/checkout && git ls-files
[INFO] Working directory: /home/user/Workspace/git-study/auto-deployment/target/checkout
[INFO] Invoking perform goals in directory /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment
[INFO] Executing goals 'deploy'...
[WARNING] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] [INFO] Scanning for projects...
[INFO] [WARNING] 
[INFO] [WARNING] Some problems were encountered while building the effective model for com.augmentum.study:auto-deployment:jar:1.0
[INFO] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing.
[INFO] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing.
[INFO] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-deploy-plugin is missing.
[INFO] [WARNING] 
[INFO] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[INFO] [WARNING] 
[INFO] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[INFO] [WARNING] 
[INFO] [INFO]                                                                         
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Building auto-deployment 1.0
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-source-plugin/maven-metadata.xml         
[INFO] Downloaded: http://127.0.0.1:8081/repository/maven-public/org/apache/maven/plugins/maven-source-plugin/maven-metadata.xml (833 B at 0.3 KB/sec) 
[INFO] Downloading: ......
[INFO] Downloaded: ......
[INFO] x/y KB               
[INFO] ......  
[INFO] [INFO] 
[INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ auto-deployment ---
[INFO] [debug] execute contextualize
[INFO] [INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] [INFO] skip non existing resourceDirectory /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/src/main/resources
[INFO] [INFO] 
[INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ auto-deployment ---
[INFO] [INFO] Compiling 1 source file to /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/classes
[INFO] [INFO] 
[INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ auto-deployment ---
[INFO] [debug] execute contextualize
[INFO] [INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] [INFO] skip non existing resourceDirectory /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/src/test/resources
[INFO] [INFO] 
[INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ auto-deployment ---
[INFO] [INFO] Compiling 1 source file to /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/test-classes
[INFO] [INFO] 
[INFO] [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ auto-deployment ---
[INFO] [INFO] Surefire report directory: /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/surefire-reports
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.augmentum.study.AppTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.007 sec
[INFO] 
[INFO] Results :
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] [INFO] 
[INFO] [INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ auto-deployment ---
[INFO] [INFO] Building jar: /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/auto-deployment-1.0.jar
[INFO] [INFO] 
[INFO] [INFO] >>> maven-source-plugin:3.0.1:jar (attach-sources) @ auto-deployment >>>
[INFO] [INFO] 
[INFO] [INFO] <<< maven-source-plugin:3.0.1:jar (attach-sources) @ auto-deployment <<<
[INFO] [INFO] 
[INFO] [INFO] --- maven-source-plugin:3.0.1:jar (attach-sources) @ auto-deployment ---
[INFO] Downloading: ......
[INFO] Downloaded: ......
[INFO] x/y KB               
[INFO] ......                           
[INFO] [INFO] Building jar: /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/auto-deployment-1.0-sources.jar
[INFO] [INFO] 
[INFO] [INFO] --- maven-javadoc-plugin:2.10.4:jar (attach-javadocs) @ auto-deployment ---             
[INFO] Loading source files for package com.augmentum.study...
[INFO] Constructing Javadoc information...
[INFO] Standard Doclet version 1.8.0_45
[INFO] Building tree for all the packages and classes...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/com/augmentum/study/App.html...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/com/augmentum/study/package-frame.html...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/com/augmentum/study/package-summary.html...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/com/augmentum/study/package-tree.html...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/constant-values.html...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/com/augmentum/study/class-use/App.html...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/com/augmentum/study/package-use.html...
[INFO] Building index for all the packages and classes...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/overview-tree.html...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/index-all.html...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/deprecated-list.html...
[INFO] Building index for all classes...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/allclasses-frame.html...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/allclasses-noframe.html...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/index.html...
[INFO] Generating /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/apidocs/help-doc.html...
[INFO] [INFO] Building jar: /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/auto-deployment-1.0-javadoc.jar
[INFO] [INFO] 
[INFO] [INFO] --- maven-install-plugin:2.3.1:install (default-install) @ auto-deployment ---
[INFO] [INFO] Installing /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/auto-deployment-1.0.jar to /home/user/.m2/repository/com/augmentum/study/auto-deployment/1.0/auto-deployment-1.0.jar
[INFO] [INFO] Installing /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/pom.xml to /home/user/.m2/repository/com/augmentum/study/auto-deployment/1.0/auto-deployment-1.0.pom
[INFO] [INFO] Installing /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/auto-deployment-1.0-sources.jar to /home/user/.m2/repository/com/augmentum/study/auto-deployment/1.0/auto-deployment-1.0-sources.jar
[INFO] [INFO] Installing /home/user/Workspace/git-study/auto-deployment/target/checkout/auto-deployment/target/auto-deployment-1.0-javadoc.jar to /home/user/.m2/repository/com/augmentum/study/auto-deployment/1.0/auto-deployment-1.0-javadoc.jar
[INFO] [INFO] 
[INFO] [INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ auto-deployment ---
[INFO] Uploading: http://127.0.0.1:8081/repository/maven-releases/com/augmentum/study/auto-deployment/1.0/auto-deployment-1.0.jar        
[INFO] Uploaded: http://127.0.0.1:8081/repository/maven-releases/com/augmentum/study/auto-deployment/1.0/auto-deployment-1.0.jar (3 KB at 7.1 KB/sec)
[INFO] Uploading: http://127.0.0.1:8081/repository/maven-releases/com/augmentum/study/auto-deployment/1.0/auto-deployment-1.0.pom         
[INFO] Uploaded: http://127.0.0.1:8081/repository/maven-releases/com/augmentum/study/auto-deployment/1.0/auto-deployment-1.0.pom (4 KB at 3.1 KB/sec)
[INFO] Downloading: http://127.0.0.1:8081/repository/maven-releases/com/augmentum/study/auto-deployment/maven-metadata.xml         
[INFO] Uploading: http://127.0.0.1:8081/repository/maven-releases/com/augmentum/study/auto-deployment/maven-metadata.xml          
[INFO] Uploaded: http://127.0.0.1:8081/repository/maven-releases/com/augmentum/study/auto-deployment/maven-metadata.xml (310 B at 1.0 KB/sec)
[INFO] Uploading: http://127.0.0.1:8081/repository/maven-releases/com/augmentum/study/auto-deployment/1.0/auto-deployment-1.0-sources.jar        
[INFO] Uploaded: http://127.0.0.1:8081/repository/maven-releases/com/augmentum/study/auto-deployment/1.0/auto-deployment-1.0-sources.jar (3 KB at 4.3 KB/sec)
[INFO] Uploading: http://127.0.0.1:8081/repository/maven-releases/com/augmentum/study/auto-deployment/1.0/auto-deployment-1.0-javadoc.jar
[INFO] Uploaded: http://127.0.0.1:8081/repository/maven-releases/com/augmentum/study/auto-deployment/1.0/auto-deployment-1.0-javadoc.jar (23 KB at 63.6 KB/sec)
[INFO] x/y KB               
[INFO] ......  
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 2:48.046s
[INFO] [INFO] Finished at: Fri May 26 15:36:34 CST 2017
[INFO] [INFO] Final Memory: 28M/182M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] Cleaning up after release...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:01.816s
[INFO] Finished at: Fri May 26 15:36:34 CST 2017
[INFO] Final Memory: 9M/150M
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

参考链接:Perform a Release

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值