My favorites | Sign in
Project Home Issues Source
Project Information
Members
Featured
Downloads
Links

Tweet your builds

Introduction

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.

Configuration

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.

<settings>
 <profiles>
  <profile>
   <id>default</id>
   <activation>
    <activeByDefault>true</activeByDefault>
   </activation>
   <properties>
    <twitterUsername>your twitter username</twitterUsername>
    <twitterPassword>your twitter password</twitterPassword>
   </properties>
  </profile>
 </profiles>
</settings>

Usage

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

Define the plugin as shown in example below.

It will send one Twitter status update per <execution> block defined. The <execution> block contains the twitterStatus and will be executed in the phase specified by the <phase> sub-element.

<execution>
 <phase>...</phase>
 <configuration>
   <twitterStatus>...</twitterStatus>
 </configuration>
</execution>

You can define as many blocks as you want.

Example

<plugin>
 <groupId>com.vineetmanohar</groupId>
  <artifactId>maven-twitter-plugin</artifactId>
  <version>0.1</version>

  <executions>
   <!-- phase: test -->
   <execution>
    <id>test-passed</id>
    <configuration>
     <!-- anything you want, upto 140 chars -->
     <twitterStatus>My first tweet from using #maven twitter plugin</twitterStatus>
    </configuration>
    <phase>test</phase>
    <goals>
     <goal>tweet</goal>
    </goals>
   </execution>

   <!-- phase: deploy -->
   <execution>
    <configuration>
     <!-- Tell your users that the project is deployed -->
     <twitterStatus>Version ${project.version} of XYZ deployed</twitterStatus>
    </configuration>
    <id>deploy</id>
    <phase>deploy</phase>
    <goals>
     <goal>tweet</goal>
    </goals>
   </execution>
  </executions>
</plugin>

FAQ

What can I put under the <twitterStatus> element

  • You can put static text under your twitter status.
  • You can be creative and put variables related to your project. ${project} maps to the Maven Project Model.
  • You can put hash tags by simply putting # before a word
  • You can put @usernames directing the message to a specific account
  • You final twitter message, after resolving any ${vars}, should be max 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?

Not yet.

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

Powered by Google Project Hosting