maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Levinson <james.levin...@opower.com>
Subject Re: checkModificationExclude NOT ignoring modified files
Date Fri, 28 Oct 2011 00:57:14 GMT
Continuing my own thread here regarding maven-release-plugin release:branch,
I discovered that the comparison
in org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.execute()
strips the path and compares file names only. So, I changed my pom to ignore
application.properties instead of ${thewholepath}/applications properties.
Lo and behold, success.

However, what I thought would happen did not happen and it makes me question
my understanding of the intent of checkModificationExcludes. I thought I
could modify files, call branch and have them be committed to the branch in
their modified state. This does not happen. A branch gets created and the
pom gets checked in but the files I want on the branch do not. So, what was
the intention of checkModificationExcludes? Was it just for any versioned
file in the project root?

Further, regarding my use-case, can anyone recommend a better way to modify
files at branch time. Currently, we have a script we run after we branch,
but I was looking for something a bit more elegant, that could be part of
the pom.

Thanks, James



On Sun, Oct 23, 2011 at 10:56 AM, James Levinson
<james.levinson@opower.com>wrote:

> I am trying to do a simple replace in 2 files when I release:branch. I
> thought checkModificationExcludes looked like it would make it possible to
> modify the files and have them be on my branch, but it's not working for me.
>
> I added the following profile to my pom:
>
>         <profile>
>             <id>branch</id>
>             <activation>
>                 <property>
>                     <name>branch</name>
>                 </property>
>             </activation>
>             <build>
>                 <plugins>
>                     <plugin>
>                         <groupId>org.codehaus.mojo</groupId>
>                         <artifactId>build-helper-maven-plugin</artifactId>
>                         <version>1.7</version>
>                         <executions>
>                             <execution>
>                                 <phase>verify</phase>
>                                 <id>parse-version</id>
>                                 <goals>
>                                     <goal>parse-version</goal>
>                                 </goals>
>                             </execution>
>                         </executions>
>                     </plugin>
>                     <plugin>
>
> <groupId>com.google.code.maven-replacer-plugin</groupId>
>                         <artifactId>maven-replacer-plugin</artifactId>
>                         <version>1.3.9</version>
>                         <executions>
>                             <execution>
>                                 <phase>verify</phase>
>                                 <goals>
>                                     <goal>replace</goal>
>                                 </goals>
>                             </execution>
>                         </executions>
>                         <configuration>
>                             <!--if ${basedir} is prepended, the replace
> does not occur-->
>                             <includes>
>
> <include>src/test/resources/config/dev/hudson/application.properties</include>
>
> <include>src/test/resources/config/dev/jenkins/application.properties</include>
>                             </includes>
>                             <replacements>
>                                 <replacement>
>                                     <token>poseur_test</token>
>
> <value>poseur_test_${parsedVersion.majorVersion}_${parsedVersion.minorVersion}_branch</value>
>                                 </replacement>
>                             </replacements>
>                         </configuration>
>                     </plugin>
>                     <plugin>
>                         <groupId>org.apache.maven.plugins</groupId>
>                         <artifactId>maven-release-plugin</artifactId>
>                         <version>2.1</version>
>                         <configuration>
>                             <checkModificationExcludes>
>
> <checkModificationExclude>src/test/resources/config/dev/hudson/application.properties</checkModificationExclude>
>
> <checkModificationExclude>src/test/resources/config/dev/jenkins/application.properties</checkModificationExclude>
>
> <checkModificationExclude>pom.xml</checkModificationExclude><!--for dryRun
> testing-->
>                             </checkModificationExcludes>
>                         </configuration>
>                     </plugin>
>                 </plugins>
>             </build>
>         </profile>
>
> I run the following on my command line, the replace occurs:
>
>     mvn build-helper:parse-version replacer:replace release:branch -Pbranch
> -DdryRun=true -DbranchName=3.15.x -X -e
>
> I get the following output:
>
> [INFO] [release:branch {execution: default-cli}]
> [DEBUG] release.properties not found - using empty properties
> [INFO] Verifying that there are no local modifications...
> [INFO]   ignoring changes on: pom.xml.next, release.properties,
> pom.xml.releaseBackup,
> src/test/resources/config/dev/jenkins/application.properties,
> pom.xml.backup, pom.xml, pom.xml.branch,
> src/test/resources/config/dev/hudson/application.properties, pom.xml.tag
> [INFO] Executing: /bin/sh -c cd
> /Users/jameslevinson/workspace/main/rate/trunk && svn --non-interactive
> status
> [INFO] Working directory: /Users/jameslevinson/workspace/main/rate/trunk
> [DEBUG] ?       pom.xml.releaseBackup
> [DEBUG] M       src/test/resources/config/dev/hudson/application.properties
> [DEBUG] M
> src/test/resources/config/dev/jenkins/application.properties
> [DEBUG] M       pom.xml
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Cannot prepare the release because you have local modifications :
> [src/test/resources/config/dev/hudson/application.properties:modified]
> [src/test/resources/config/dev/jenkins/application.properties:modified]
>
> [INFO]
> ------------------------------------------------------------------------
> [DEBUG] Trace
> org.apache.maven.BuildFailureException: Cannot prepare the release because
> you have local modifications :
> [src/test/resources/config/dev/hudson/application.properties:modified]
> [src/test/resources/config/dev/jenkins/application.properties:modified]
>
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:715)
>  at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
>  at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
>  at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
>  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
>  at
> org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  at java.lang.reflect.Method.invoke(Method.java:597)
> at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>  at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>  at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoFailureException: Cannot prepare the
> release because you have local modifications :
> [src/test/resources/config/dev/hudson/application.properties:modified]
> [src/test/resources/config/dev/jenkins/application.properties:modified]
>
> at
> org.apache.maven.plugins.release.BranchReleaseMojo.execute(BranchReleaseMojo.java:243)
>  at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
>  ... 17 more
> Caused by: org.apache.maven.shared.release.ReleaseFailureException: Cannot
> prepare the release because you have local modifications :
> [src/test/resources/config/dev/hudson/application.properties:modified]
> [src/test/resources/config/dev/jenkins/application.properties:modified]
>
> at
> org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.execute(ScmCheckModificationsPhase.java:155)
>  at
> org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.simulate(ScmCheckModificationsPhase.java:168)
> at
> org.apache.maven.shared.release.DefaultReleaseManager.branch(DefaultReleaseManager.java:385)
>  at
> org.apache.maven.shared.release.DefaultReleaseManager.branch(DefaultReleaseManager.java:360)
> at
> org.apache.maven.plugins.release.BranchReleaseMojo.execute(BranchReleaseMojo.java:235)
>  ... 19 more
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 3 seconds
> [INFO] Finished at: Sat Oct 22 23:46:02 PDT 2011
> [INFO] Final Memory: 18M/81M
> [INFO]
> ------------------------------------------------------------------------
>
> Here is the debug output for the plugin:
>
> [DEBUG] Configuring mojo
> 'org.apache.maven.plugins:maven-release-plugin:2.1:branch' -->
> [DEBUG]   (f) addSchema = true
> [DEBUG]   (f) autoVersionSubmodules = false
> [DEBUG]   (s) basedir = /Users/jameslevinson/workspace/main/rate/trunk
> [DEBUG]   (f) branchName = 3.15.x
> [DEBUG]   (f) checkModificationExcludes =
> [src/test/resources/config/dev/hudson/application.properties,
> src/test/resources/config/dev/jenkins/application.properties, pom.xml]
> [DEBUG]   (f) dryRun = true
> [DEBUG]   (f) javaHome =
> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
> [DEBUG]   (f) localCheckout = false
> [DEBUG]   (f) mavenExecutorId = invoker
> [DEBUG]   (f) mavenHome = /Applications/apache-maven-2.2.1
> [DEBUG]   (f) project = MavenProject:
> com.positiveenergyusa:rate:3.15.0-SNAPSHOT @
> /Users/jameslevinson/workspace/main/rate/trunk/pom.xml
> [DEBUG]   (f) pushChanges = true
> [DEBUG]   (f) reactorProjects = [MavenProject:
> com.positiveenergyusa:rate:3.15.0-SNAPSHOT @
> /Users/jameslevinson/workspace/main/rate/trunk/pom.xml]
> [DEBUG]   (f) remoteTagging = true
> [DEBUG]   (f) scmCommentPrefix = [maven-release-plugin]
> [DEBUG]   (f) session = org.apache.maven.execution.MavenSession@59c83354
> [DEBUG]   (f) settings = org.apache.maven.settings.Settings@1520a48c
> [DEBUG]   (f) suppressCommitBeforeBranch = false
> [DEBUG]   (f) updateBranchVersions = false
> [DEBUG]   (f) updateDependencies = true
> [DEBUG]   (f) updateVersionsToSnapshot = true
> [DEBUG]   (f) updateWorkingCopyVersions = true
> [DEBUG]   (f) useEditMode = false
> [DEBUG] -- end configuration --
> [INFO] [release:branch {execution: default-cli}]
> [DEBUG] release.properties not found - using empty properties
> [INFO] Verifying that there are no local modifications...
> [INFO]   ignoring changes on: pom.xml.next, release.properties,
> pom.xml.releaseBackup,
> src/test/resources/config/dev/jenkins/application.properties,
> pom.xml.backup, pom.xml, pom.xml.branch,
> src/test/resources/config/dev/hudson/application.properties, pom.xml.tag
> [INFO] Executing: /bin/sh -c cd
> /Users/jameslevinson/workspace/main/rate/trunk && svn --non-interactive
> status
> [INFO] Working directory: /Users/jameslevinson/workspace/main/rate/trunk
> [DEBUG] ?       pom.xml.releaseBackup
> [DEBUG] M       src/test/resources/config/dev/hudson/application.properties
> [DEBUG] M
> src/test/resources/config/dev/jenkins/application.properties
> [DEBUG] M       pom.xml
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Cannot prepare the release because you have local modifications :
> [src/test/resources/config/dev/hudson/application.properties:modified]
> [src/test/resources/config/dev/jenkins/application.properties:modified]
>
> [INFO]
> ------------------------------------------------------------------------
> [DEBUG] Trace
> org.apache.maven.BuildFailureException: Cannot prepare the release because
> you have local modifications :
> [src/test/resources/config/dev/hudson/application.properties:modified]
> [src/test/resources/config/dev/jenkins/application.properties:modified]
>
> As you can see the exclusions are in the checkModificationExcludes array,
> but they are not being "ignored" when the svn status runs. Oddly, when I add
> pom.xml to the ignores, it gets ignored, but I have not been able to get the
> files to be ignored. How are the arrays being compared? I have tried every
> which way to run it, using the cmd line to pass
> in checkModificationExcludeList, pre-pending ${basedir}, re-ordering the
> plugins. I tried version 2.1 and 2.2.1. Same result. I have found
> http://jira.codehaus.org/browse/MRELEASE-554, which indicates the
> functionality is there, but again, I can't get it to work.
>
> Anybody ever try this with success ?
>
>
> --
>
> **
>
> *James Levinson*
>
> Senior Release Engineer
> *
>
> Opower
> * <http://www.opower.com/>
> *
>
>
> **
>
> We’re hiring! See jobs here <http://www.opower.com/careers>
> *
>
>
>


-- 

**

*James Levinson*

Senior Release Engineer
*

Opower
* <http://www.opower.com/>
*


**

We’re hiring! See jobs here <http://www.opower.com/careers>
*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message