Class SendEmailMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.nuiton.plugin.AbstractPlugin
org.nuiton.helper.plugin.SendEmailMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.nuiton.plugin.Plugin, org.nuiton.plugin.PluginWithEncoding

@Mojo(name="send-email", requiresOnline=true, requiresProject=true) public class SendEmailMojo extends org.nuiton.plugin.AbstractPlugin implements org.nuiton.plugin.PluginWithEncoding
Send a email.
Since:
1.0.3
Author:
Tony Chemit - chemit@codelutin.com
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.nuiton.plugin.Plugin

    org.nuiton.plugin.Plugin.InitState, org.nuiton.plugin.Plugin.Packaging
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    A flag to test plugin but send nothing to redmine.
    protected File
    The Velocity template used to format the email announcement.
    protected String
    The title of the email to send.
    protected String
    The encoding used to read and write files.
    protected List<org.apache.maven.model.Developer>
    Possible senders.
    protected String
    The id of the developer sending the announcement mail.
    protected String
    Mail content type to use.
    protected MailSender
    Defines the sender of the announcement if the list of developer is empty or if the sender is not a member of the development team.
    protected String
    The password used to send the email.
    protected org.apache.maven.project.MavenProject
    Dependance du projet.
    protected boolean
    A flag to restirct only one run in a build (for multi-module context).
    protected boolean
    A flag to restrict only to run on root module.
    protected boolean
    A flag to skip the goal.
    protected String
    Smtp Server.
    protected int
    Port.
    protected boolean
    If the email should be sent in SSL mode.
    protected List<String>
    Recipient email address.
    protected String
    The username used to send the email.
    protected boolean
    Un flag pour activer le mode verbeux.

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
     
     
    protected org.codehaus.plexus.mailsender.MailMessage
    createMessage(String newsContent, MailSender mailSender)
     
    protected void
     
     
    org.apache.maven.project.MavenProject
     
    protected void
     
    protected boolean
     
    protected boolean
     
    boolean
     
    void
    setEncoding(String encoding)
     
    void
    setFrom(List<org.apache.maven.model.Developer> from)
     
    void
     
    void
    setProject(org.apache.maven.project.MavenProject project)
     
    void
    setToAddresses(List<String> toAddresses)
     
    void
    setVerbose(boolean verbose)
     

    Methods inherited from class org.nuiton.plugin.AbstractPlugin

    acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addUrlToUrlsList, afterExecute, backupFile, checkEncoding, checkPackaging, checkResource, checkRunOnceDone, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, execute, getBackupFile, getFileFromBasedir, getFilesToTreate, getFilesToTreateForRoots, getRootProject, getTemplate, hasClassPath, initClassLoader, isFileNewerThanPomFile, needInvoke, needInvoke, rejectPackaging, removeCompileSourceRoots, removeTestCompileSourceRoots, renameFile, writeFile

    Methods inherited from class org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.maven.plugin.Mojo

    execute, getLog, setLog
  • Field Details

    • project

      @Parameter(defaultValue="${project}", required=true, readonly=true) protected org.apache.maven.project.MavenProject project
      Dependance du projet.
      Since:
      1.0.3
    • verbose

      @Parameter(property="helper.verbose", defaultValue="${maven.verbose}") protected boolean verbose
      Un flag pour activer le mode verbeux.
      Since:
      1.0.3
    • emailContentFile

      @Parameter(property="helper.emailContentFile", required=true) protected File emailContentFile
      The Velocity template used to format the email announcement.
      Since:
      1.0.3
    • emailTitle

      @Parameter(property="helper.emailTitle", required=true) protected String emailTitle
      The title of the email to send.
      Since:
      1.0.3
    • smtpHost

      @Parameter(property="helper.smtpHost", required=true) protected String smtpHost
      Smtp Server.
      Since:
      1.0.3
    • smtpPort

      @Parameter(property="helper.smtpPort", defaultValue="25", required=true) protected int smtpPort
      Port.
      Since:
      1.0.3
    • username

      @Parameter(property="helper.username") protected String username
      The username used to send the email.
      Since:
      1.0.3
    • password

      @Parameter(property="helper.password") protected String password
      The password used to send the email.
      Since:
      1.0.3
    • sslMode

      @Parameter(property="helper.sslMode", defaultValue="false") protected boolean sslMode
      If the email should be sent in SSL mode.
      Since:
      1.0.3
    • fromDeveloperId

      @Parameter(property="helper.fromDeveloperId") protected String fromDeveloperId
      The id of the developer sending the announcement mail. Only used if the mailSender attribute is not set. In this case, this should match the id of one of the developers in the pom. If a matching developer is not found, then the first developer in the pom will be used.
      Since:
      1.0.3
    • mailSender

      @Parameter(property="helper.mailSender") protected MailSender mailSender
      Defines the sender of the announcement if the list of developer is empty or if the sender is not a member of the development team.
      Since:
      1.0.3
    • toAddresses

      @Parameter(required=true) protected List<String> toAddresses
      Recipient email address.
      Since:
      1.0.3
    • from

      @Parameter(property="project.developers", required=true, readonly=true) protected List<org.apache.maven.model.Developer> from
      Possible senders.
      Since:
      1.0.3
    • mailContentType

      @Parameter(defaultValue="text/plain", required=true) protected String mailContentType
      Mail content type to use.
      Since:
      1.0.3
    • encoding

      @Parameter(property="helper.encoding", defaultValue="${project.build.sourceEncoding}") protected String encoding
      The encoding used to read and write files.
      Since:
      1.0.3
    • skipSendEmail

      @Parameter(property="helper.skipSendEmail", defaultValue="false") protected boolean skipSendEmail
      A flag to skip the goal.
      Since:
      1.0.3
    • dryRun

      @Parameter(property="dryRun", defaultValue="false") protected boolean dryRun
      A flag to test plugin but send nothing to redmine.
      Since:
      1.0.3
    • runOnce

      @Parameter(property="helper.runOnce", defaultValue="true") protected boolean runOnce
      A flag to restirct only one run in a build (for multi-module context).
      Since:
      1.0.3
    • runOnlyOnRoot

      @Parameter(property="helper.runOnlyOnRoot", defaultValue="true") protected boolean runOnlyOnRoot
      A flag to restrict only to run on root module.
      Since:
      2.1
  • Constructor Details

    • SendEmailMojo

      public SendEmailMojo()
  • Method Details

    • getProject

      public org.apache.maven.project.MavenProject getProject()
      Specified by:
      getProject in interface org.nuiton.plugin.Plugin
    • setProject

      public void setProject(org.apache.maven.project.MavenProject project)
      Specified by:
      setProject in interface org.nuiton.plugin.Plugin
    • isVerbose

      public boolean isVerbose()
      Specified by:
      isVerbose in interface org.nuiton.plugin.Plugin
    • setVerbose

      public void setVerbose(boolean verbose)
      Specified by:
      setVerbose in interface org.nuiton.plugin.Plugin
    • init

      protected void init() throws Exception
      Specified by:
      init in class org.nuiton.plugin.AbstractPlugin
      Throws:
      Exception
    • checkSkip

      protected boolean checkSkip()
      Overrides:
      checkSkip in class org.nuiton.plugin.AbstractPlugin
    • doAction

      protected void doAction() throws Exception
      Specified by:
      doAction in class org.nuiton.plugin.AbstractPlugin
      Throws:
      Exception
    • isGoalSkip

      protected boolean isGoalSkip()
    • createMessage

      protected org.codehaus.plexus.mailsender.MailMessage createMessage(String newsContent, MailSender mailSender) throws org.codehaus.plexus.mailsender.MailSenderException
      Throws:
      org.codehaus.plexus.mailsender.MailSenderException
    • createMailer

      protected ProjectJavamailMailSender createMailer()
    • setMailSender

      public void setMailSender(MailSender mailSender)
    • setFrom

      public void setFrom(List<org.apache.maven.model.Developer> from)
    • setToAddresses

      public void setToAddresses(List<String> toAddresses)
    • isExecutionRoot

      protected boolean isExecutionRoot()
      Overrides:
      isExecutionRoot in class org.nuiton.plugin.AbstractPlugin
    • getEncoding

      public String getEncoding()
      Specified by:
      getEncoding in interface org.nuiton.plugin.PluginWithEncoding
    • setEncoding

      public void setEncoding(String encoding)
      Specified by:
      setEncoding in interface org.nuiton.plugin.PluginWithEncoding