如果未提交更改,则使用maven-buildnumer-plugin停止构建

时间:2011-01-20 10:41:29

标签: svn maven

我正在使用maven-buildnumer-plugin添加我的SVN修订版本和构建日期到Spring MVC项目中的网页页脚。一切都很好...我想。

我没有错误,但是:

  • 我的插件配置似乎有误。它并没有真正检索我的项目的绝对最新版本号。我使用2个不同的IDE来验证和检查文件
  • 如果我有任何未提交给SVN的本地更改和/或SVN中的更改(我没有先检出并包含),我会谎言将我的tomcat部署失败到PROD(由配置文件控制)。因此,为确保PROD始终是最新版本,可以复制修订版。

我的配置看起来像

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0-beta-4</version>
<executions>
 <execution>
  <phase>validate</phase>
  <goals>
   <goal>create</goal>
  </goals>
 </execution>
</executions>
<configuration>
 <!-- Username/password stored in personal settings.xml -->
 <username>${plott.scm.username}</username>
 <password>${plott.scm.password}</password>
 <revisionOnScmFailure>0</revisionOnScmFailure>
 <buildNumberPropertyName>buildRevision</buildNumberPropertyName>
 <timestampPropertyName>buildDateTime</timestampPropertyName>
 <timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat>
 <doCheck>true</doCheck>
 <doUpdate>false</doUpdate>
 <getRevisionOnlyOnce>false</getRevisionOnlyOnce>
 <useLastCommittedRevision>false</useLastCommittedRevision>
</configuration>

这会生成控制台输出,如:

    macbookpro:com.platt.myproject john$ mvn clean tomcat:redeploy
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Mereko
[INFO]    task-segment: [clean, tomcat:redeploy]    
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory /Users/john/Documents/Workspace/Eclipse/3.6_Helios/com.platt.myproject/target
[INFO] Preparing tomcat:redeploy
[INFO] [buildnumber:create {execution: default}]
[INFO] Verifying there are no local modifications ...
[INFO] Executing: /bin/sh -c cd /Users/john/Documents/Workspace/Eclipse/3.6_Helios/com.platt.myproject && svn --username doe.john --password '*****' --non-interactive status
[INFO] Working directory: /Users/john/Documents/Workspace/Eclipse/3.6_Helios/com.platt.myproject
[INFO] Updating project files from SCM: skipped.
[INFO] Executing: /bin/sh -c cd /Users/john/Documents/Workspace/Eclipse/3.6_Helios/com.platt.myproject && svn --username doe.john --password '*****' --non-interactive info
[INFO] Working directory: /Users/john/Documents/Workspace/Eclipse/3.6_Helios/com.platt.myproject
[INFO] Storing buildNumber: 56 at timestamp: 2011-01-20 11:35:48
[INFO] Executing: /bin/sh -c cd /Users/john/Documents/Workspace/Eclipse/3.6_Helios/com.platt.myproject && svn --username doe.john --password '*****' --non-interactive info
[INFO] Working directory: /Users/john/Documents/Workspace/Eclipse/3.6_Helios/com.platt.myproject
[INFO] Storing buildScmBranch: trunk
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources

(...Continueing and finishing build and deployment)

关于我如何

的任何想法
  • 获取SVN中签入的最新版本号
  • 确保本地更改停止PROD版本

感谢

0 个答案:

没有答案