Monday, January 7, 2013

Tycho build 9: Updating version numbers

When you start releasing your products you need to start dealing with version numbering of your plug-ins and features. It is generally a good idea to do this the eclipse way. When you use API Tooling and API baselines eclipse will automatically tell you when to increase your versions. The problem is: once you increase your plug-in version number you have to adapt your maven version too. Otherwise your build will fail.

Keeping version numbers consistent is a tedious task. But help is on the way: let tycho do this for you!

Tycho Tutorials

For a list of all tycho related tutorials see Tycho Tutorials Overview

Source code for this tutorial is available on github as a single zip archive, as a Team Project Set or you can browse the files online.

Step 1: Add tycho-versions plugin

Open your master pom file and add a new plugin section within the project/build/plugins node:
   <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-versions-plugin</artifactId>
    <version>${tycho.version}</version>
   </plugin>

Step 2: Execute new maven target

Go to the project com.codeandme.tycho.releng, right click and select Run As/Maven build.... Set tycho-versions:update-pom in Goals and execute maven. Now all your pom file version numbers will be updated according to the plug-in and feature version numbers.

5 comments:

  1. It'd be useful to have an overview of where version numbers are kept. What happens when you've got two plugins, for example? Seems like there are three version numbers; one for each plugin and one for the parent.

    ReplyDelete
  2. Hello all,

    Help! what's wrong?! The above sample only updates the first project, every other is skipped! It only updates the parent pom, which doesn't make sense really. Is there any special directive to update all child poms, please see:

    [INFO] Reactor Summary:
    [INFO]
    [INFO] com.example.tycho.releng .......................... SUCCESS [0.150s]
    [INFO] com.example.tycho.plugin2 ......................... SKIPPED
    [INFO] com.example.tycho.plugin .......................... SKIPPED
    [INFO] com.example.tycho.plugin.feature .................. SKIPPED

    Thank you,
    Tony

    ReplyDelete
  3. Hello all again,
    Sorry, I got confused by the info message, of course the child poms are not executed. Update version process is executed properly only by the releng project.
    bye, Tony

    ReplyDelete
  4. I want to export the product in an arbitrary version, like 1.2.0.MYCUSTOMER

    I tried the mvn goals: clean tycho-versions:set-version install
    with parameter newVersion=1.2.0.MYCUSTOMER

    For that I have to add to releng pom.xml


    org.eclipse.tycho
    tycho-packaging-plugin
    ${tycho.version}

    false



    The build is successfull, but at my local maven repository I only see all artifacts with version 1.0.0-SNAPSHOT .

    In the log I see, that at a certain point of time the product is installed in my preferred version, but where ??

    mvn log: http://static.klarblick.org/mvn_tycho_release.log

    ReplyDelete
  5. were your local pom files upgraded to the new version?

    ReplyDelete