2011/09/09

Sending an email using maven-postman-plugin and smtp.gmail.com

I configured maven to send a notification after deploying successfully an artifact.

Because this is done from my home server I chose to use gmail as my smtp server:

<plugin>
    <groupId>ch.fortysix</groupId>
    <artifactId>maven-postman-plugin</artifactId>
    <version>0.1.6</version>
    <executions>
        <execution>
            <id>send_an_email</id>
            <phase>deploy</phase>
            <goals>
                <goal>send-mail</goal>
            </goals>
            <inherited>true</inherited>
            <configuration>
                <mailhost>smtp.gmail.com</mailhost>
                <mailport>465</mailport>
                <mailssl>true</mailssl>
                <mailAltConfig>true</mailAltConfig>

                <mailuser>your_gmail_emailer_account@gmail.com</mailuser>
                <mailpassword>your_gmail_emailer_password</mailpassword>

                <from>your_gmail_emailer_account@gmail.com</from>
                <receivers>
                    <receiver>some_receiver@mail.domain</receiver>
                    <receiver>some_another_receiver@gmail.com</receiver>
                </receivers>

                <subject>Important subject</subject>
                <failonerror>true</failonerror>
                <htmlMessage>

                    <![CDATA[
                    <p>Partner, we have a new deployment!</p>
                    <br>
                    <p>Have a nice day.</p>
                    ]]>
                </htmlMessage>
            </configuration>
        </execution>
    </executions>
</plugin>


Important:

a) Put the declaration after the deployment declaration, this way if something goes wrong the email will not be send.

b) The <inherited> mark is needed only if you put this declaration in some parent pom and another child module is the deployed one. To maintain the order you may have to put the main declaration of your deployment first in the parent pom. Remember that "The order of execution depends on the order in which the goal(s) and the build phase(s) are invoked".

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.6</version>
    <executions>
        <execution>
            <id>upload</id>
            <phase>deploy</phase>
        </execution>
    </executions>
</plugin>


<plugin>
    <groupId>ch.fortysix</groupId>
    <artifactId>maven-postman-plugin</artifactId>
    ...
    ...
    ...
</plugin> 

c) The plugin didn't work until I declared the <mailAltConfig> (check out this and this).

In my case I only send the email when "production" deployment is done (I love profiles!).

What about this?

mvn deploy -Pprod

Nice!

2011/09/01

BBC Radio Stream in Windows and Linux

You may listen to the BBC Radio Streams available from this webpage:

In Windows you may add the URLs to Winamp:















But a list of multiple URLs is added (?)... ok, I don't know why... I just played the first one and deleted the trash.



After playing, the URL just showed right.



And then you can save the playlist.



In Linux (I'm using Debian GNU/Linux Squeeze) you can use vlc:

sudo apt-get install vlc

You just copy the link location and then add it into vlc pressing [CTRL+N]:



















The playlist that you saved from Winamp may be play in vlc, nice!