8 Replies Latest reply on Oct 9, 2012 5:04 PM by David Ward

    Maven mojo proposal: setVersion

    David Ward Master

      Hey there kids!

       

      In experimenting with approaches to solve SWITCHYARD-733, I came up with a fairly simple solution.  Basically, create a new goal to our switchyard maven plugin, called "setVersion".  (The other one we have now is called "configure".)

       

      It would be invoked like this:

       

      mvn switchyard:setVersion -DoldVersion=0.6.0-SNAPSHOT -DnewVersion=0.6.0.Final
      

       

      Then the pom.xml for that project, and any of it's aggregated children, would have the following xml paths' values updated to 0.6.0.Final:

       

      project/version
      project/parent/version
      project/properties/switchyard.version
      

       

      I actually have most of it coded already, but now it just dumps the output to the console vs. overwriting the file.

       

      The mojo has an @phase of "validate" and @requiresDirectInvocation of "true", so that a project doesn't need to be built first for this to run, and you have to call it explicity (it would never be called during a normal build).

       

      Technically, I don't need the user to specify the oldVersion property, but figured it wouldn't be a bad idea just so they really know what they are doing.

       

      It's actually a pretty short and sweet approach.

       

      Thoughts?