Using maven-buildnumer-plugin to stop builds if changes are not committed
I am using maven-buildnumer-plugin
to add my SVN revision numer and build date to my web pages footer in Spring MVC project. All good... I thought.
I have no errors, but:
- My plugin configuration seems to be wrong. It does not really retreive the absolutly latest revision number for my project. I verified with 2 different IDEs chacnging and checking in files
- I would liek to FAIL my tomcat deployment to PROD (controlled by profiles) if I have any local changes that are not committed to SVN and/or if there are changes in SVN which I did not first check-out and include. So to make sure, the PROD is always the absolutely latest version and the revision can be reproduced.
My config looks like
<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>
This generates console output li开发者_Go百科ke:
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)
Any ideas on how I can
- Get the really latest revision number that is checked in in SVN
- Make sure local changes stop the
PROD
build
THANKS
精彩评论