Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.plugins.changes.announcement;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.List;
import org.apache.maven.model.Developer;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.changes.announcement.mailsender.ProjectJavamailMailSender;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger;
import org.codehaus.plexus.mailsender.MailMessage;
import org.codehaus.plexus.mailsender.MailSenderException;
import org.codehaus.plexus.util.IOUtil;
/**
* Goal which sends an announcement through email.
*
* @author [email protected]
* @version $Id$
* @since 2.0-beta-2
*/
@Mojo(name = "announcement-mail", threadSafe = true)
@Execute(goal = "announcement-generate")
public class AnnouncementMailMojo extends AbstractAnnouncementMojo {
// =========================================
// announcement-mail goal fields
// =========================================
/**
* Possible senders.
*/
@Parameter(property = "project.developers", required = true, readonly = true)
private List from;
/**
* The id of the developer sending the announcement mail. Only used if the {@code 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.
*/
@Parameter(property = "changes.fromDeveloperId")
private String fromDeveloperId;
/**
* Mail content type to use.
*
* @since 2.1
*/
@Parameter(defaultValue = "text/plain", required = true)
private String mailContentType;
/**
* Defines the sender of the announcement email. This takes precedence over the list of developers specified in the
* POM. if the sender is not a member of the development team. Note that since this is a bean type, you cannot
* specify it from command level with
*
*
* -D
*
*
* . Use
*
*
* -Dchanges.sender='Your Name <you@domain>'
*
*
* instead.
*/
@Parameter(property = "changes.mailSender")
private MailSender mailSender;
/**
* Defines the sender of the announcement. This takes precedence over both ${changes.mailSender} and the list of
* developers in the POM.
*
* This parameter parses an email address in standard RFC822 format, e.g.
*
*
* -Dchanges.sender='Your Name <you@domain>'
*
*
* .
*
* @since 2.7
*/
@Parameter(property = "changes.sender")
private String senderString;
/**
* The password used to send the email.
*/
@Parameter(property = "changes.password")
private String password;
/**
*/
@Parameter(defaultValue = "${project}", readonly = true, required = true)
private MavenProject project;
/**
* Smtp Server.
*/
@Parameter(property = "changes.smtpHost", required = true)
private String smtpHost;
/**
* Port.
*/
@Parameter(property = "changes.smtpPort", defaultValue = "25", required = true)
private int smtpPort;
/**
* If the email should be sent in SSL mode.
*/
@Parameter(property = "changes.sslMode", defaultValue = "false")
private boolean sslMode;
/**
* If the option startTls should be used.
*
* @since 2.10
*/
@Parameter(property = "changes.startTls", defaultValue = "false")
private boolean startTls;
/**
* Subject for the email.
*/
// CHECKSTYLE_OFF: LineLength
@Parameter(
property = "changes.subject",
defaultValue = "[ANNOUNCEMENT] - ${project.name} ${project.version} released",
required = true)
private String subject;
// CHECKSTYLE_ON: LineLength
/**
* The file that contains the generated announcement.
*
* @since 2.10
*/
@Parameter(property = "changes.announcementFile", defaultValue = "announcement.vm", required = true)
private String announcementFile;
/**
* Directory where the generated announcement file exists.
*
* @since 2.10
*/
@Parameter(defaultValue = "${project.build.directory}/announcement", required = true)
private File announcementDirectory;
/**
* The encoding used in the announcement template.
*
* @since 2.10
*/
@Parameter(property = "changes.templateEncoding", defaultValue = "${project.build.sourceEncoding}")
private String templateEncoding;
/**
* Recipient email address.
*/
@Parameter(required = true)
private List