如何将 maven 与 slack 集成?

How to integrate maven with slack?

我想在构建阶段向 channel/user 发送特定的松弛消息。我知道我可以创建一个 Maven 插件,也许已经有了?

自己做的:https://github.com/moacyrricardo/maven-slack

有了这个插件,您只需添加一个 webhook 到 slack 并使用 url 到 post 消息。

要使用它,请将 's3 wagon extension' 添加到您的 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>

然后是插件仓库:

<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>

终于可以使用了

<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>