有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (1) 个答案

  1. # 1 楼答案

    Maven send mail goal允许您在构建过程中发送邮件,也可以添加附件。你可以在pom中添加以下目标。xml。在include标记中,您必须给出必须发送的文件的相对路径

    <plugin>
            <groupId>ch.fortysix</groupId>
            <artifactId>maven-postman-plugin</artifactId>
            <executions>
                    <execution>
                            <id>send a mail</id>
                            <phase>package</phase>
                            <goals>
                                    <goal>send-mail</goal>
                            </goals>
                            <inherited>false</inherited>
                            <configuration>
                                    <from>builder@myhost.com</from>
                                    <subject>a subject</subject>
                                    <failonerror>true</failonerror>
                                    <mailhost>mail.dummy.ch</mailhost>
                                    <mailuser>XXXXX</mailuser>
                                    <mailpassword>XXXXX</mailpassword>
                                    <htmlMessageFile>src/main/MailContent.html</htmlMessageFile>
                                    <receivers>
                                            <receiver>dani</receiver>
                                            <receiver>sam@any-company.com</receiver>
                                    </receivers>
                                    <fileSets>
                                            <fileSet>
                                                    <directory>${basedir}/src/main</directory>
                                                    <includes>
                                                            <include>**/*.pdf</include>
                                                    </includes>
                                            </fileSet>
                                    </fileSets>
                            </configuration>
                    </execution>
            </executions>
    </plugin>