Whenever I create a new project, fill out the Maven POM I also have to add the project to at least two information systems:
In this post I will show, how we can automate the process of creating a Bugzilla product based on the information provided in a POM.
Configuration in Maven POM
The automation is run with the Bugzilla Maven Plugin (please follow the link to check out the latest version and add this version to replace the ${bugzilla-maven-plugin.version}
in the example below!).
<pluginManagement>
<plugins>
<plugin>
<groupId>de.smartics.maven.plugin</groupId>
<artifactId>bugzilla-maven-plugin</artifactId>
<version>${bugzilla-maven-plugin.version}</version>
<configuration>
<classification>Unclassified</classification>
<initialOwner>me@example.com</initialOwner>
</configuration>
</plugin>
</plugins>
</pluginManagement>
The configuration property classification
allows to assign the product to the given classification. The initialOwner
property will determine the default owner of an issue if none is provided.
Also provide the URL to your Bugzilla server:
<issueManagement>
<system>bugzilla</system>
<url>http://....</url>
</issueManagement>
That's it for the project! All other information will be read from the POM:
- The classification is set by the property provided in the plugin's configuration.
- The name of the product:
name
- Version and Milestone is derived from the
version
- The project description is copied from
description
- The default milestone is set to the current version (without
-SNAPSHOT
. - Components are per default for a single project
@Product
(this is configurable, please consult the documentation of the plugin for details), the sub modules for a multi project.
Configure Maven Environment
Provide your password to login to your Bugzilla server in your settings.xml
:
<server>
<id>bugzilla</id>
<username>username</username>
<password>password</password>
</server>
Please consider to add the password encrypted!
<server>
<id>bugzilla</id>
<username>username</username>
<password>{COQLCE6DU6GtcS5P=}</password>
</server>
For detailed information on how to do the encryptions, please refer to Password Encryption.
Run: Create Product
Simply run
mvn bugzilla:init
If you use the Alias Maven Plugin with our alias configuration config-smartics-alias, simply type
bi
So this is the output on the console, telling you that the product has been successfully synchronized:
D:\alias-maven-plugin>bi
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building alias-maven-plugin 0.1.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- bugzilla-maven-plugin:0.5.0:init (default-cli) @ alias-maven-plugin
--
[INFO] Successful login to Bugzilla.
[INFO] Successfully added product 'alias-maven-plugin'.
[INFO] Component '@Product' has been created.
[INFO] Version '0.1.4-SNAPSHOT' already existed.
[INFO] Milestone '0.1.4' already existed.
[INFO] Milestone '0.2.0' has been created.
[INFO] Milestone '1.0.0' has been created.
[INFO] Successful logout from Bugzilla.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.463s
[INFO] Finished at: Tue Sep 11 19:51:05 CEST 2012
[INFO] Final Memory: 14M/490M
[INFO] ------------------------------------------------------------------------
D:\alias-maven-plugin>
Run: Sync after a Release
If you have access to a Nexus server, then simply run
mvn bugzilla:sync
Again, if you use the Alias Maven Plugin with our alias configuration config-smartics-alias, simply type
b
If you do not have access to the Nexus server, the current version number is not determined automatically and therefore you are requested to provide it on the command line:
b -DreleasedVersion=2.0.0
[INFO] Successful login to Bugzilla.
[INFO] Version '2.0.0' has been created.
[INFO] Milestone '2.0.0' has been created.
[INFO] Milestone '2.1.0' has been created.
[INFO] Milestone '3.0.0' has been created.
[INFO] Successful logout from Bugzilla.
Further Information
For further information please refer to the plugin's site, especially to Best Practices and notes on usage. On the home page you will find a short example for a multi project.
If you have the plugin installed on your system, you may also consult the help from the command line. Type
mvn bugzilla:help
for a simple help and
mvn bugzilla:help -Ddetail
for more detailed help.
For more information on our versioning scheme, please refer to our post Versioning.