Accessing Maven Build Info about modules

Hi,

in the Maven Build Info, I can access the version of all the modules in the reactor build. In the list of parameters accessible across the UI, I only see the version of the parent pom, not the ones of the modules. Is there a way to access those?

Cheers,
Chris

4 comments
Comment actions Permalink

Chris,

Maven build info is collected during the build and uploaded to the TeamCity server at the end of the build. There is no way to refer to it's content in configuration UI except for limited set of data described as Provided parameters

Why do you need to access your modules versions in the TeamCity UI?

0
Comment actions Permalink

Hi Nikita,

we use TC for CI but also for deployments where a build configuration is used for deploying a Maven artifact. The artifact is the outcome of a module build in a multi-module Maven project. I'd like to use the version of this artifact as the build number so one can see at a glance which artifact version has been deployed last. Unfortunately, the version of the parent pom is not the same as the module version, therefore I have to access the module version. For this purpose, it doesn't matter much that the information would only be available after the build finished.

Is there any way a custom plugin could accomplish this?

Best regards,
Chris

0
Comment actions Permalink

Chris,

I am not aware of TeamCity plugins that can help, but I can suggest a workaround using maven plugin.

You can set TeamCity build number value from inside your Maven build using Ant plugin like this:

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <phase>generate-resources</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <tasks>
                    <echo>##teamcity[buildNumber '${pom.version}']</echo>
                </tasks>
            </configuration>
        </execution>
    </executions>
</plugin>


add this plugin section to pom.xml (or profile) of module you want to use.
Hope, it helps.

0
Comment actions Permalink

That's perfect, thank you!

Regards,
Chris

0

Please sign in to leave a comment.