Tweet your builds with Maven Twitter Plugin


Maven Twitter Plugin lets you send Twitter status updates from Maven, without writing any Java code. It increases communication between Project owners and Project users by automatically tweeting build and release status via Twitter.


1. Add Plugin repository to your <build> <plugins> section in pom.xml

You need to add this to your list of existing plugin repositories.

 <name>Vineet Manohar Release Repo</name>

2. Add your twitter username, password to your ~/.m2/settings.xml file

For security reasons, it is recommended that you put your twitter username and password in your local settings file.

    <twitterUsername>your twitter username</twitterUsername>
    <twitterPassword>your twitter password</twitterPassword>


Add the Twitter plugin to your <build> <plugins> section in pom.xml

Define the plugin as shown in example below.


Now add one <execution> block to the above, for every Tweet you want to send per build. The <twitterStatus> config element defines your Twitter message and will be executed in the phase specified by the <phase> subelement.


You can define as many blocks as you want.


This example send 2 tweets: one in the “test” phase and the other in the “deploy” phase.

   <!-- phase: test -->
     <!-- anything you want, upto 140 chars -->
     <twitterStatus>My first tweet from using #maven twitter plugin</twitterStatus>

   <!-- phase: deploy -->
     <!-- Tell your users that the project is deployed -->
     <twitterStatus>Version ${project.versionId} of XYZ deployed</twitterStatus>


What can I put under the <twitterStatus> element

  • static text
  • You can be creative and put variables related to your project. ${project} maps to the Maven Project Model. Examples are ${project.groupId}, ${project.artifactId}, etc
  • You can put hash tags by simply putting # before a word
  • You can put @usernames directing the message to a specific twitter account
  • You resolved twitter message, after resolving any ${vars}, should be maximum 140 chars

What happens if I send multiple message with the same text

  • Twitter seems to ignore status updates if there is not status change from your.

What happens if my <twitterStatus> is more than 140 characters

The current version does not check for length and will send your message to Twitter. Twitter will respond with an error.

Does this plugin support URL shortening?

Version 0.1 does not support URL shortening.

Does maven execution stop if the Twitter Plugin fails

No. All errors are logged, but no Exception is thrown.

Is there a limit to how many messages I can send?

Yes. Twitter has a rate limit of 150 message per hour. See details.

What are all the different Maven phases

Here’s Maven’s documentation on Phases


Related posts:

  1. The plugin ‘org.codehaus.mojo:selenium-maven-plugin’ does not exist or no valid version could be found
  2. How to automate project versioning and release with Maven
  3. How to auto-generate Maven plugin documentation
  4. 3 ways to run Java main from Maven
  5. Maven Cargo JBoss

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wordpress themes