I would like to send specific slack messages to a channel/user on a build phase. I know I can create a maven plugin, perhaps there is one already?
1 Answer
Did it myself: https://github.com/moacyrricardo/maven-slack
With this plugin all you have to do as add a webhook to slack and use the url to post messages.
To use it, add the 's3 wagon extension' to your pom.xml:
<build>
<extensions>
<extension>
<groupId>org.springframework.build.aws</groupId>
<artifactId>org.springframework.build.aws.maven</artifactId>
<version>3.0.0.RELEASE</version>
</extension>
</extensions>
</build>
Then the plugin repo:
<pluginRepository>
<id>s3-moarepo</id>
<url>s3://moarepo/release</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>s3-moarepo-snapshot</id>
<url>s3://moarepo/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
And finally you can use it
<plugin>
<groupId>br.com.kibutx</groupId>
<artifactId>slack-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<executions>
<execution>
<id>MSG inicio deploy</id>
<phase>validate</phase>
<goals>
<goal>slackmessage</goal>
</goals>
<configuration>
<apiHash>hash1/hash2/hash3</apiHash>
<channel>@devmate</channel>
<message>Short message</message>
<fields>
<field>
<value>Field 1 value</value>
</field>
</fields>
</configuration>
</execution>
</executions>
</plugin>