org.apache.maven.scm.plugin.AbstractScmMojo Maven / Gradle / Ivy
package org.apache.maven.scm.plugin;
/*
* 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.
*/
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.scm.ScmBranch;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmResult;
import org.apache.maven.scm.ScmRevision;
import org.apache.maven.scm.ScmTag;
import org.apache.maven.scm.ScmVersion;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.provider.ScmProviderRepository;
import org.apache.maven.scm.provider.ScmProviderRepositoryWithHost;
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.scm.repository.ScmRepositoryException;
import org.apache.maven.settings.Server;
import org.apache.maven.settings.Settings;
import org.apache.maven.shared.model.fileset.FileSet;
import org.apache.maven.shared.model.fileset.util.FileSetManager;
import org.codehaus.plexus.util.StringUtils;
import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException;
/**
* @author Emmanuel Venisse
* @author Olivier Lamy
*
*/
public abstract class AbstractScmMojo
extends AbstractMojo
{
/**
* The SCM connection URL.
*
* @parameter expression="${connectionUrl}" default-value="${project.scm.connection}"
*/
private String connectionUrl;
/**
* The SCM connection URL for developers.
*
* @parameter expression="${connectionUrl}" default-value="${project.scm.developerConnection}"
*/
private String developerConnectionUrl;
/**
* The type of connection to use (connection or developerConnection).
*
* @parameter expression="${connectionType}" default-value="connection"
*/
private String connectionType;
/**
* The working directory.
*
* @parameter expression="${workingDirectory}"
*/
private File workingDirectory;
/**
* The user name (used by svn, starteam and perforce protocol).
*
* @parameter expression="${username}"
*/
private String username;
/**
* The user password (used by svn, starteam and perforce protocol).
*
* @parameter expression="${password}"
*/
private String password;
/**
* The private key (used by java svn).
*
* @parameter expression="${privateKey}"
*/
private String privateKey;
/**
* The passphrase (used by java svn).
*
* @parameter expression="${passphrase}"
*/
private String passphrase;
/**
* The url of tags base directory (used by svn protocol). It is not
* necessary to set it if you use the standard svn layout
* (branches/tags/trunk).
*
* @parameter expression="${tagBase}"
*/
private String tagBase;
/**
* Comma separated list of includes file pattern.
*
* @parameter expression="${includes}"
*/
private String includes;
/**
* Comma separated list of excludes file pattern.
*
* @parameter expression="${excludes}"
*/
private String excludes;
/**
* @component
*/
private ScmManager manager;
/**
* When this plugin requires Maven 3.0 as minimum, this component can be removed and o.a.m.s.c.SettingsDecrypter be
* used instead.
*
* @component roleHint="mng-4384"
*/
private SecDispatcher secDispatcher;
/**
* The base directory.
*
* @parameter expression="${basedir}"
* @required
*/
private File basedir;
/**
* @parameter default-value="${settings}"
* @required
* @readonly
*/
private Settings settings;
/**
* List of System properties to pass to the JUnit tests.
*
* @parameter
*/
private Properties systemProperties;
/**
* List of provider implementations.
*
* @parameter
*/
private Map providerImplementations;
/**
* Should distributed changes be pushed to the central repository?
* For many distributed SCMs like Git, a change like a commit
* is only stored in your local copy of the repository. Pushing
* the change allows your to more easily share it with other users.
*
* @parameter expression="${pushChanges}" default-value="true"
* @since 1.4
*/
private boolean pushChanges;
/** {@inheritDoc} */
public void execute()
throws MojoExecutionException
{
if ( systemProperties != null )
{
// Add all system properties configured by the user
Iterator