Code clean-up and docs provided

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113541 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
michal 2003-06-29 11:57:40 +00:00
parent 7870c16e79
commit e9549c0bf4
27 changed files with 1185 additions and 240 deletions

View File

@ -61,23 +61,39 @@ import org.apache.maven.project.Project;
/**
*
* The Bean which serves as Proxy To Hibernate API
* <br/>
* The Bean which is used in Jelly Scripts
* and serves as a proxy to Artifact Deployer API
*
* Note that all paths in repository are computed
* and source file name is igonred.
*
* Other remark: To deploy an artifact means much
* more then to copy signle file. In every case
* also MD5 file created and copied to remote repository.
* In case of snapshots the process in even more complex.
*
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: ArtifactDeployer.java,v 1.1 2003/06/16 14:26:01 michal Exp $
* @version $Id: ArtifactDeployer.java,v 1.2 2003/06/29 11:57:39 michal Exp $
*/
public interface ArtifactDeployer
{
/**
* Deploy given artifact to remote repository
* @param artifact
* @param type
* @param project
* @throws MavenException
* Deploy given artifact to remote repository
*
* @param artifact Artifact filename
* @param type The type of the artifact
* (like <code>war</code>, <code>jar</code>)
* @param project The project which is a producer of the artifact
* POM conatains a bunch of varaiables which are used
* to control the deployment process (e.g
* <ul>
* <li>artifactId<li>
* <li>groupId</li>
* <li>list of remote repositories</li>
* </ul>
*
* @throws MavenException
*/
public void deploy(String artifact, String type, Project project)
throws MavenException;
@ -85,30 +101,37 @@ public interface ArtifactDeployer
/**
* Deploy given artifact as a snapshot to remote repository
* @param artifact
* @param type
* @param project
* @param type The type of the artifact
* (like <code>war</code>, <code>jar</code>)
* @param project The project which is a producer of the artifact
* @see ArtifactDeployer#deploy(String, String, Project)
*
* @throws MavenException
*/
public void deploySnapshot(String artifact, String type, Project project)
throws MavenException;
/**
* Install given artifact in local repository
* @param artifact
* @param type
* @param project
* @param artifact file name of the artifact
* @param type The type of the artifact
* (like <code>war</code>, <code>jar</code>)
* @param project The project which is a producer of the artifact
* @throws MavenException
*/
*/
public void install(String artifact, String type, Project project)
throws MavenException;
/**
* Install given artifact as snapshot in local repository
* @param artifact
* @param type
* @param project
* @param type The type of the artifact
* (like <code>war</code>, <code>jar</code>)
* @param project The project which is a producer of the artifact
* @throws MavenException
*/
*/
public void installSnapshot(String artifact, String type, Project project)
throws MavenException;
}

View File

@ -76,13 +76,13 @@ import org.apache.maven.util.MD5Sum;
*
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: DefaultArtifactDeployer.java,v 1.9 2003/06/25 15:25:19 michal Exp $
* @version $Id: DefaultArtifactDeployer.java,v 1.10 2003/06/29 11:57:39 michal Exp $
*/
public class DefaultArtifactDeployer implements ArtifactDeployer
{
/**
*
* Date/time stamp which is appended to snapshot filenames
*/
public final static DateFormat SNAPSHOT_MARKER =
new SimpleDateFormat("yyyyMMdd.HHmmss");
@ -191,8 +191,8 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
}
/**
* Install given file in local repsoitory
* @param artifact the artifact file to insatall
* Install given file in local repository
* @param artifact the artifact file to install
* @param type The type of the artiafct
* @param project
* @param version String denominating the version of the artifact
@ -254,10 +254,8 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
// trick add special values to context for default repository;
String repos =
(String) project.getContext().getVariable("maven.repo.repos");
System.out.println("repos: " + repos);
(String) project.getContext().getVariable("maven.repo.list");
String distSite = project.getDistributionSite();
if (distSite != null && distSite.length() > 0)
{
@ -273,7 +271,7 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
if (repos == null || repos.length() == 0)
{
System.out.println("No remote repository is defined");
System.out.println("No remote repository is defined for deployment");
return;
}
String[] repoArray = StringUtils.split(repos, ",");
@ -328,8 +326,9 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
}
/**
*
* Return the local repository path form given project
* @param project
* @return The path to local repoository in local file system
*/
private String getLocalRepository(Project project)
{
@ -337,11 +336,13 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
}
/**
*
* @param type
* @param project
* Return relative path from repositorry root
* for given parameters
* @param type Artifact type
* @param project
* @param snapshot
* @return
* @todo replace this with RepoistoryLayout Service
*/
private String getRepositoryPath(
String type,
@ -355,6 +356,14 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
return path.toString();
}
/**
*
* @param type
* @param project
* @param version
* @return
*/
private String getRepositoryFile(
String type,
Project project,
@ -441,6 +450,11 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
}
/**
* Create MD5 checksum file for given file. File is created
* in the same folder
* @param File
* @return The <code>File</code> which contatins MD5 checksum
* @throws MavenException when opertaion failed
*/
private File createMD5Checksum(File file) throws MavenException
{
@ -475,9 +489,9 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
}
/**
*
* Return file extension for given type
* @todo Dirty hack util Repository Layout Service is used
* @return
* @return extension for given type
*/
private String extensionForType(String type)
{

View File

@ -64,10 +64,10 @@ import org.apache.maven.project.Project;
/**
*
* The Bean which provides access to Artifact Deployement API
* for jelly scripts.
* from jelly scripts.
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: DeployBean.java,v 1.2 2003/06/25 15:25:19 michal Exp $
* @version $Id: DeployBean.java,v 1.3 2003/06/29 11:57:39 michal Exp $
*/
public class DeployBean
{
@ -156,7 +156,6 @@ public class DeployBean
*/
public void deploy() throws MavenException
{
System.out.println("deploy called");
checkAttributes();
artifactDeployer.deploy(artifact, type, project);
}

View File

@ -58,6 +58,7 @@ package org.apache.maven.artifact.deployer;
import org.apache.maven.deploy.DeployRequest;
import org.apache.maven.deploy.exceptions.DeployException;
import org.apache.maven.deploy.exceptions.WrongParameterException;
import org.apache.maven.project.Project;
/**
@ -65,7 +66,7 @@ import org.apache.maven.project.Project;
* Perform mapping between project's properties and attributes of DeployRequest class.
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: DeployRequestBuilder.java,v 1.1 2003/06/25 15:25:19 michal Exp $
* @version $Id: DeployRequestBuilder.java,v 1.2 2003/06/29 11:57:39 michal Exp $
*/
public class DeployRequestBuilder
{
@ -122,29 +123,27 @@ public class DeployRequestBuilder
"maven.repo." + repository + ".group");
String proxyHost =
(String) project.getContext().getVariable(
"maven.repo." + repository + ".proxy");
(String) project.getContext().getProxyHost();
String proxyUser =
(String) project.getContext().getVariable(
"maven.repo." + repository + ".proxy.username");
(String) project.getContext().getProxyUserName();
String proxyPassword =
(String) project.getContext().getVariable(
"maven.repo." + repository + ".proxy.password");
(String) project.getContext().getProxyPassword();
String proxyPort =
(String) project.getContext().getVariable(
"maven." + repository + ".proxy.port");
request.setUser(username);
(String) project.getContext().getProxyPort();
request.setUserName(username);
request.setPassword(password);
request.setPassphrase(passphrase);
request.setPrivateKey(privateKey);
request.setGroup(remoteGroup);
request.setUrl(url);
request.setProxyHost(proxyHost);
request.setProxyUser(proxyUser);
request.setProxyPass(proxyPassword);
request.setProxyUserName(proxyUser);
request.setProxyPassword(proxyPassword);
if (port != null)
{
try
@ -154,7 +153,7 @@ public class DeployRequestBuilder
}
catch (Exception e)
{
throw new DeployException("maven.repo." + repository + ".port should be an integer");
throw new WrongParameterException("maven.repo." + repository + ".port should be an integer");
}
}
if (proxyPort != null)
@ -165,7 +164,7 @@ public class DeployRequestBuilder
}
catch (Exception e)
{
throw new DeployException("maven.repo." + repository + ".proxy.port should be an integer");
throw new WrongParameterException("maven.repo." + repository + ".proxy.port should be an integer");
}
}

View File

@ -18,7 +18,7 @@ package org.apache.maven.deploy;
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* 3. The end-userName documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
@ -57,42 +57,72 @@ package org.apache.maven.deploy;
*/
/**
* Holder of the variables which are used by deployers for
* esatblishing connection to remote hosts and to
* deploy the file to correct location in remote file system
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: DeployRequest.java,v 1.4 2003/06/25 15:25:19 michal Exp $
* @version $Id: DeployRequest.java,v 1.5 2003/06/29 11:57:40 michal Exp $
*/
public class DeployRequest
{
/** Used to mark */
public final static int UNKNOWN_PORT = -1;
public final static String HEADER_USER_AGENT =
"Maven-Deploy-" + DeployTool.VERSION;
/** The nickname (alias) of the repository*/
private String repositoryAlias;
/** URL of the remote host*/
private String url;
/** Port of remote host */
private int port = UNKNOWN_PORT;
/** The directory where artifact will be placed */
private String destDir;
/** The filename of the artifact */
private String destFile;
/** The artifact file in local file system */
private String srcFile;
/*
* Resource access user / password /group
*/
private String user;
/** The login name of the user in @ remote host*/
private String userName;
/** Password */
private String password;
/** Remote group name */
private String group;
/** The passpharse of the user's private key file */
private String passphrase;
/** The absoluth path to private key file */
private String privateKey;
/*
* Proxy server settings. If proxy host is not null, settings will be used.
*/
/** Proxy Server host*/
private String proxyHost = null;
private String proxyUser = null;
private String proxyPass = null;
/** the login name of the user @ Proxy Server host*/
private String proxyUserName = null;
/** the password user @ Proxy Server host*/
private String proxyPassword = null;
/** Proxy server port */
private int proxyPort = UNKNOWN_PORT;
/** Indicates if debug mode should be used*/
private boolean debugOn = false;
/**
* Set the alias of the repository
* @param repositoryAlias
*/
public void setRepositoryAlias(String repositoryAlias)
@ -101,7 +131,8 @@ public class DeployRequest
}
/**
* @return
* Get the port of the host
* @return the port of the remote host where repository resides.
*/
public int getPort()
{
@ -109,6 +140,7 @@ public class DeployRequest
}
/**
* Set the port of the remote host
* @param port
*/
public void setPort(int port)
@ -117,7 +149,12 @@ public class DeployRequest
}
/**
* @return
* Get the passphrase of the private key file.
* Passphrase is used only when host/protocol supports
* authetification via exchange of private/public keys
* and private key was provided.
*
* @return the passphrase of the private key file
*/
public String getPassphrase()
{
@ -125,7 +162,8 @@ public class DeployRequest
}
/**
* @param passphrase
* Set the passphrase of the private key file
* @param passphrase the passphrase of the private key file
*/
public void setPassphrase(String passphrase)
{
@ -133,7 +171,8 @@ public class DeployRequest
}
/**
* @return
* Get the absoluth path to the private key
* @return the path to private key
*/
public String getPrivateKey()
{
@ -141,7 +180,8 @@ public class DeployRequest
}
/**
* @param privateKey
* Set the aboluth path to private key
* @param privateKey The path to private key in local file system
*/
public void setPrivateKey(String privateKey)
{
@ -149,7 +189,10 @@ public class DeployRequest
}
/**
* @return
* Get the remote group to which will belong to
* after deployemnt. Not all protolcols support
* allow to change the group of the artifact
* @return remote group
*/
public String getGroup()
{
@ -157,7 +200,9 @@ public class DeployRequest
}
/**
* @param group
* Set the remote group for artifact which is deployed
* @param group The remote group to which
* artifact which is deployed will belong
*/
public void setGroup(String group)
{
@ -173,7 +218,8 @@ public class DeployRequest
}
/**
* @return
* Get aboluth path to local files = artifact
* @return Path to artifact file
*/
public String getSrcFile()
{
@ -181,6 +227,7 @@ public class DeployRequest
}
/**
* Set the aboluthe path to artifact file
* @param srcFile
*/
public void setSrcFile(String inputFile)
@ -189,7 +236,10 @@ public class DeployRequest
}
/**
* @return
* Get destination directory in remote file system for
* the artifact
*
* @return destination dir for artifact
*/
public String getDestDir()
{
@ -197,7 +247,9 @@ public class DeployRequest
}
/**
* @param destDir
* Set destinatin directory in remote file system
*
* @param destDir the remote path for the artifact
*/
public void setDestDir(String outputDir)
{
@ -205,6 +257,7 @@ public class DeployRequest
}
/**
* Get destination file name
* @return
*/
public String getDestFile()
@ -213,6 +266,7 @@ public class DeployRequest
}
/**
* Set destination file name
* @param destFile
*/
public void setDestFile(String outputFile)
@ -221,7 +275,9 @@ public class DeployRequest
}
/**
* @return
* Get the password to be used when user will be authetificated
* while connection to remote host is established
* @return the password of user
*/
public String getPassword()
{
@ -229,6 +285,8 @@ public class DeployRequest
}
/**
*
*
* @param password
*/
public void setPassword(String pass)
@ -237,7 +295,8 @@ public class DeployRequest
}
/**
* @return
* Returhn proxy server host name
* @return proxy server host name
*/
public String getProxyHost()
{
@ -245,6 +304,7 @@ public class DeployRequest
}
/**
* Set proxy host name
* @param proxyHost
*/
public void setProxyHost(String proxyHost)
@ -253,23 +313,26 @@ public class DeployRequest
}
/**
* @return
* Get user's password used to login to proxy server
* @return the user's password at proxy host
*/
public String getProxyPass()
public String getProxyPassword()
{
return proxyPass;
return proxyPassword;
}
/**
* @param proxyPass
* Set the proxy server password
* @param proxyPassword teh epassword to use to login to a proxy server
*/
public void setProxyPass(String proxyPass)
public void setProxyPassword(String proxyPass)
{
this.proxyPass = proxyPass;
this.proxyPassword = proxyPass;
}
/**
* @return
* Get the proxy port
* @return Poroxy server port
*/
public int getProxyPort()
{
@ -277,6 +340,7 @@ public class DeployRequest
}
/**
* Set the proxy port
* @param proxyPort
*/
public void setProxyPort(int proxyPort)
@ -285,23 +349,27 @@ public class DeployRequest
}
/**
*
* Get the proxy user name
* @return
*/
public String getProxyUser()
public String getProxyUserName()
{
return proxyUser;
return proxyUserName;
}
/**
* @param proxyUser
* Set the proxy user name
* @param proxyUserName the proxy user name
*/
public void setProxyUser(String proxyUser)
public void setProxyUserName(String proxyUser)
{
this.proxyUser = proxyUser;
this.proxyUserName = proxyUser;
}
/**
* @return
* Get url of remote host
* @return URL (with protocol) of remote host
*/
public String getUrl()
{
@ -309,7 +377,8 @@ public class DeployRequest
}
/**
* @param url
* Set url of remote host
* @param url url of remote host
*/
public void setUrl(String url)
{
@ -317,24 +386,26 @@ public class DeployRequest
}
/**
* @return
* Get user login name at remote host
* @return user name at remote host
*/
public String getUser()
public String getUserName()
{
return user;
return userName;
}
/**
* @param user
* Set user name at remote host
* @param userName
*/
public void setUser(String user)
public void setUserName(String user)
{
this.user = user;
this.userName = user;
}
/**
* Cut of protocol from the URL
* @return
* Return the host name (Cuts of protocol from the URL)
* @return The host name
*/
public String getHost()
{
@ -342,11 +413,13 @@ public class DeployRequest
{
return "localhost";
}
return url.substring(url.indexOf("://") + 3);
return url.substring(url.indexOf("://") + 3).trim();
}
/**
* @return
* Get the name of the repository to which deploy attempt will be made
*
* @return the name (nickname, alias) of the repository
*/
public String getRepositoryAlias()
{
@ -354,4 +427,22 @@ public class DeployRequest
return repositoryAlias;
}
/**
* Get Debug mode
* @return the debug mode
*/
public boolean isDebugOn()
{
return debugOn;
}
/**
* Set deplyer in debug mode - more messages will be wriiten
* @param debugOn
*/
public void setDebugOn(boolean debugOn)
{
this.debugOn = debugOn;
}
}

View File

@ -62,27 +62,44 @@ import org.apache.maven.deploy.deployers.FtpDeployer;
import org.apache.maven.deploy.deployers.HttpDeployer;
import org.apache.maven.deploy.deployers.SFtpDeployer;
import org.apache.maven.deploy.deployers.ScpDeployer;
import org.apache.maven.deploy.exceptions.DeployException;
import org.apache.maven.deploy.exceptions.UnsupportedProtocolDeployException;
import org.apache.maven.deploy.exceptions.NotAuthorizedDeployException;
import org.apache.maven.deploy.exceptions.ProxyNotAuthorizedDeployException;
import org.apache.maven.deploy.exceptions.TransferFailedException;
import org.apache.maven.deploy.exceptions.UnsupportedProtocolException;
import org.apache.maven.deploy.exceptions.WrongParameterException;
/**
*
* Delegates
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: DeployTool.java,v 1.4 2003/06/25 12:33:11 michal Exp $
* @version $Id: DeployTool.java,v 1.5 2003/06/29 11:57:40 michal Exp $
*/
public class DeployTool
{
/** Current Version **/
public static final String VERSION = "1.0-dev";
public void performUpload(DeployRequest request) throws DeployException
/**
* Upload (deploy) artifact to remote repository using
* paramerters kepts in <code>DeployReequest</code>
* @param request The settings
* @throws DeployException When operation fails
*/
public void performUpload(DeployRequest request)
throws
TransferFailedException,
NotAuthorizedDeployException,
ProxyNotAuthorizedDeployException,
TransferFailedException,
WrongParameterException,
UnsupportedProtocolException
{
String url = request.getUrl();
Deployer deployer = null;
if (url == null || url.length() == 1)
{
throw new DeployException(
"No URL provided for repsoitory: "
throw new WrongParameterException(
"No URL provided for repository: "
+ request.getRepositoryAlias());
}
if (url.startsWith(HttpDeployer.PROTOCOL))
@ -107,7 +124,7 @@ public class DeployTool
}
if (deployer == null)
{
throw new UnsupportedProtocolDeployException(url);
throw new UnsupportedProtocolException(url);
}
deployer.deploy(request);

View File

@ -1,7 +1,10 @@
package org.apache.maven.deploy.deployers;
import org.apache.maven.deploy.DeployRequest;
import org.apache.maven.deploy.exceptions.DeployException;
import org.apache.maven.deploy.exceptions.NotAuthorizedDeployException;
import org.apache.maven.deploy.exceptions.ProxyNotAuthorizedDeployException;
import org.apache.maven.deploy.exceptions.TransferFailedException;
import org.apache.maven.deploy.exceptions.WrongParameterException;
/* ====================================================================
* The Apache Software License, Version 1.1
@ -61,15 +64,27 @@ import org.apache.maven.deploy.exceptions.DeployException;
/**
* Interface for all Maven deployers.
*
* Deployer which uploads a file to remote host accordingly to paramters
* recieved in <i>deploy request</i>
*
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
* @version $Id: Deployer.java,v 1.1 2003/06/17 22:05:59 michal Exp $
* @version $Id: Deployer.java,v 1.2 2003/06/29 11:57:40 michal Exp $
*/
public interface Deployer
{
/**
*
* @param request
* Perform an unppload of single file to remote host
* @param request <code>DeployRequest</code> which should contatin all parameters
* which are necessery to upload a file
* to remote host.
*/
public void deploy(DeployRequest request) throws DeployException;
public void deploy(DeployRequest request)
throws
TransferFailedException,
NotAuthorizedDeployException,
ProxyNotAuthorizedDeployException,
TransferFailedException,
WrongParameterException;
}

View File

@ -61,40 +61,43 @@ import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.apache.maven.deploy.DeployRequest;
import org.apache.maven.deploy.exceptions.DeployException;
import org.apache.maven.deploy.exceptions.TransferFailedException;
/**
* Deployer which deploys to directory visible in local
* file system.
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: FileDeployer.java,v 1.5 2003/06/25 15:25:18 michal Exp $
* @version $Id: FileDeployer.java,v 1.6 2003/06/29 11:57:40 michal Exp $
*/
public class FileDeployer implements Deployer
{
/** Protocol understandable by this deployer*/
public final static String PROTOCOL = "file://";
/**
* @see org.apache.maven.fetch.fetchers.Fetcher#fetchUrl(java.lang.String, java.io.OutputStream)
*/
public void deploy(DeployRequest request) throws DeployException
public void deploy(DeployRequest request) throws TransferFailedException
{
try
{
File inputFile = new File(request.getSrcFile());
File srcFile = new File(request.getSrcFile());
File outputFile =
File destFile =
new File(request.getHost(), request.getDestDir());
if (! outputFile.exists())
if (! destFile.exists())
{
outputFile.mkdirs();
destFile.mkdirs();
}
outputFile = new File( outputFile, request.getDestFile());
FileUtils.copyFile(inputFile, outputFile);
destFile = new File( destFile, request.getDestFile());
FileUtils.copyFile(srcFile, destFile);
}
catch (IOException e)
{
throw new DeployException("Cannot copy file: " + e.getMessage());
throw new TransferFailedException("Cannot copy file: " + e.getMessage());
}
}
}

View File

@ -66,11 +66,7 @@ import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPConnectionClosedException;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.maven.deploy.DeployRequest;
import org.apache.maven.deploy.exceptions.DeployException;
import org.apache.maven.deploy.exceptions.TransferFailedException;
/**
* An FTP deployer based on the FTPClient in the Commons Net package.
@ -80,41 +76,44 @@ import org.apache.maven.deploy.exceptions.DeployException;
*
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: FtpDeployer.java,v 1.4 2003/06/25 15:25:18 michal Exp $
* @version $Id: FtpDeployer.java,v 1.5 2003/06/29 11:57:39 michal Exp $
*
*
*/
public class FtpDeployer extends AbstractDeployer
{
/** Protocol understandable by this deployer*/
public final static String PROTOCOL = "ftp://";
/**
* Description of the Method
*/
public void deploy(DeployRequest request) throws DeployException
{
String username = request.getUser();
String password = request.getPassword();
String host = request.getHost();
FTPClient ftp = new FTPClient();
ftp.addProtocolCommandListener(
new PrintCommandListener(new PrintWriter(System.out)));
/**
* @see Deployer#deploy(DeployRequest)
*/
public void deploy(DeployRequest request) throws TransferFailedException
{
String username = request.getUserName();
String password = request.getPassword();
String host = request.getHost();
FTPClient ftp = new FTPClient();
if (request.isDebugOn())
{
ftp.addProtocolCommandListener(
new PrintCommandListener(new PrintWriter(System.out)));
}
try
{
{
int reply;
if ( request.getPort()!= DeployRequest.UNKNOWN_PORT)
if (request.getPort() != DeployRequest.UNKNOWN_PORT)
{
ftp.connect(host, request.getPort());
ftp.connect(host, request.getPort());
}
else
{
ftp.connect(host);
}
}
System.out.println("Connected to " + host + ".");
// After connection attempt, you should check the reply code to verify
@ -122,10 +121,10 @@ public class FtpDeployer extends AbstractDeployer
reply = ftp.getReplyCode();
if (FTPReply.isPositiveCompletion(reply) == false)
{
{
ftp.disconnect();
System.err.println();
throw new DeployException("FTP server refused connection.");
throw new TransferFailedException("FTP server refused connection.");
}
}
catch (IOException e)
@ -140,12 +139,12 @@ public class FtpDeployer extends AbstractDeployer
{
// do nothing
}
}
throw new DeployException("Could not connect to server.");
}
throw new TransferFailedException("Could not connect to server.");
}
__main : try
{
{
if (ftp.login(username.trim(), password.trim()) == false)
{
ftp.logout();
@ -162,15 +161,15 @@ public class FtpDeployer extends AbstractDeployer
String workingDir = request.getDestDir();
String filename = request.getDestFile();
System.out.println("Working directory " + workingDir);
System.out.println("Filename: " + filename);
System.out.println("Filename: " + filename);
ftp.makeDirectory(workingDir);
ftp.changeWorkingDirectory( workingDir);
ftp.storeFile(filename, new FileInputStream(request.getSrcFile()));
ftp.changeWorkingDirectory(workingDir);
ftp.storeFile(filename, new FileInputStream(request.getSrcFile()));
ftp.logout();
}
catch (FTPConnectionClosedException e)
{
throw new DeployException("Server closed connection.");
{
throw new TransferFailedException("Server closed connection.");
}
catch (IOException e)
{
@ -227,5 +226,5 @@ public class FtpDeployer extends AbstractDeployer
writer.flush();
}
}
}

View File

@ -59,7 +59,8 @@ package org.apache.maven.deploy.deployers;
import java.io.File;
import org.apache.maven.deploy.DeployRequest;
import org.apache.maven.deploy.exceptions.DeployException;
import org.apache.maven.deploy.exceptions.TransferFailedException;
import org.apache.maven.deploy.exceptions.WrongParameterException;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Proxy;
@ -69,36 +70,39 @@ import com.jcraft.jsch.Session;
import com.jcraft.jsch.UserInfo;
/**
* An ssh2 deployer that uses the JSch library and the JCE.
* A base class for deployers using protocols from SSH2 family
* and JSch library for underlining implmenetation
*
* This class deals with authetification stage of the process.
* This class deals with authentification stage of the process.
*
* We will first try to
* use public keys for authentication and if that doesn't work then we fall back
* to using the login and password of the user in question. NOTE: We are
* assuming the standard port of 22.
* to using the login and password
*
*
* @version $Id: GenericSshDeployer.java,v 1.2 2003/06/25 15:25:18 michal Exp $
* @version $Id: GenericSshDeployer.java,v 1.3 2003/06/29 11:57:40 michal Exp $
* @todo still have to account for differing setups for people deploying to
* their own sites and to the central repository.
* @todo improve exception handling
*/
public abstract class GenericSshDeployer extends AbstractDeployer
{
/** Default port used for SSH protocol */
public final static int DEFAULT_SSH_PORT = 22;
/** Default port used by SOCKS5 proxy server */
public final static int SOCKS5_PROXY_PORT = 1080;
/**
* @see Deployer#project
*
* @todo better way of guessing what kind of proxy server is used
* by user
* by user. Jsch Supports among others SOCKS and HTTP proxies
*/
public Session getSession(DeployRequest request) throws DeployException
public Session getSession(final DeployRequest request)
throws TransferFailedException
{
try
{
JSch jsch = new JSch();
@ -108,36 +112,11 @@ public abstract class GenericSshDeployer extends AbstractDeployer
{
port = DEFAULT_SSH_PORT;
}
System.out.println("host: '"+ request.getHost() + "'");
String host = request.getHost();
Session session = jsch.getSession(request.getUser(), host, port);
String proxyHost = request.getProxyHost();
if (proxyHost != null)
{
Proxy proxy = null;
int proxyPort = request.getProxyPort();
//if port == 1080 we will use SOCKS5 Proxy
// otherwise will use HTTP Proxy
if (proxyPort == SOCKS5_PROXY_PORT)
{
proxy = new ProxySOCKS5(proxyHost);
((ProxySOCKS5) proxy).setUserPasswd(
request.getProxyUser(),
request.getProxyPass());
}
else
{
proxy = new ProxyHTTP(proxyHost, proxyPort);
((ProxyHTTP) proxy).setUserPasswd(
request.getProxyUser(),
request.getProxyPass());
}
proxy.connect(session, host, port);
}
Session session =
jsch.getSession(request.getUserName(), host, port);
// Look for the private key and use it if available.
if (request.getPrivateKey() != null)
{
@ -145,12 +124,54 @@ public abstract class GenericSshDeployer extends AbstractDeployer
if (privateKey.exists())
{
if (request.getPassphrase() == null)
{
String msg =
"Private key provided "
+ "without passpharse for repo: "
+ request.getRepositoryAlias();
throw new WrongParameterException(msg);
}
System.out.println("Using private key: " + privateKey);
jsch.addIdentity(
privateKey.getAbsolutePath(),
request.getPassphrase());
}
else
{
String msg = "Private key: " + privateKey + " not found ";
throw new WrongParameterException(msg);
}
}
String proxyHost = request.getProxyHost();
if (proxyHost != null)
{
Proxy proxy = null;
int proxyPort = request.getProxyPort();
// HACK:
//if port == 1080 we will use SOCKS5 Proxy
// otherwise will use HTTP Proxy
if (proxyPort == SOCKS5_PROXY_PORT)
{
proxy = new ProxySOCKS5(proxyHost);
((ProxySOCKS5) proxy).setUserPasswd(
request.getProxyUserName(),
request.getProxyPassword());
}
else
{
proxy = new ProxyHTTP(proxyHost, proxyPort);
((ProxyHTTP) proxy).setUserPasswd(
request.getProxyUserName(),
request.getProxyPassword());
}
proxy.connect(session, host, port);
}
// username and password will be given via UserInfo interface.
UserInfo ui = new MavenUserInfo(request);
session.setUserInfo(ui);
@ -161,7 +182,7 @@ public abstract class GenericSshDeployer extends AbstractDeployer
catch (Exception e)
{
e.printStackTrace();
throw new DeployException(
throw new TransferFailedException(
"Cannot connect. Reason: " + e.getMessage(),
e);
}

View File

@ -70,13 +70,13 @@ import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.maven.deploy.DeployRequest;
import org.apache.maven.deploy.exceptions.DeployException;
import org.apache.maven.deploy.exceptions.TransferFailedException;
/**
* An HTTP deployer based the Commons HttpClient library.
*
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
* @version $Id: HttpDeployer.java,v 1.3 2003/06/25 15:25:18 michal Exp $
* @version $Id: HttpDeployer.java,v 1.4 2003/06/29 11:57:39 michal Exp $
*
* @todo still have to account for differing setups for people deploying to
* their own sites and to the central repository.
@ -86,12 +86,14 @@ import org.apache.maven.deploy.exceptions.DeployException;
*/
public class HttpDeployer extends AbstractDeployer
{
/**Protocol understood by by this deployer*/
public final static String PROTOCOL = "http://";
/**
* Description of the Method
*/
public void deploy(DeployRequest request) throws DeployException
public void deploy(DeployRequest request) throws TransferFailedException
{
URL url = null;
try
@ -104,7 +106,7 @@ public class HttpDeployer extends AbstractDeployer
Credentials creds =
new UsernamePasswordCredentials(
request.getUser(),
request.getUserName(),
request.getPassword());
//create a singular HttpClient object
@ -135,7 +137,7 @@ public class HttpDeployer extends AbstractDeployer
}
catch(FileNotFoundException io)
{
throw new DeployException("input file: '"+ request.getSrcFile() + " not found ");
throw new TransferFailedException("input file: '"+ request.getSrcFile() + " not found ");
}
//turn follow redirects off

View File

@ -58,7 +58,8 @@ package org.apache.maven.deploy.deployers;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.deploy.DeployRequest;
import org.apache.maven.deploy.exceptions.DeployException;
import org.apache.maven.deploy.exceptions.TransferFailedException;
import org.apache.maven.deploy.exceptions.WrongParameterException;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSchException;
@ -70,21 +71,24 @@ import com.jcraft.jsch.SftpException;
* An SSH2/SFTP deployer
*
* @author Michal Maczka
* @version $Revision: 1.3 $ $Date: 2003/06/25 15:25:18 $
* @version $Revision: 1.4 $ $Date: 2003/06/29 11:57:39 $
*/
public class SFtpDeployer extends GenericSshDeployer
{
/**Protocol understood by by this deployer*/
public final static String PROTOCOL = "sftp://";
/** SSH2 Chanel names used to communicate with the server*/
private final static String SFTP_CHANNEL = "sftp";
/** artibute of file used in SSH which denotes is given file is a directory*/
private static final int S_IFDIR = 0x4000;
/**
* @see Deployer#project
*
* @todo better way of guessing what king of proxy server is used
* @see Deployer#deploy(DeployRequest)
*/
public void deploy(DeployRequest request) throws DeployException
public void deploy(DeployRequest request)
throws TransferFailedException, WrongParameterException
{
Integer groupId = null;
try
@ -96,7 +100,7 @@ public class SFtpDeployer extends GenericSshDeployer
}
catch (NumberFormatException e)
{
throw new DeployException("SFTP deployer: remote group should be an integer");
throw new WrongParameterException("SFTP deployer: remote group should be an integer");
}
Session session = getSession(request);
@ -109,7 +113,7 @@ public class SFtpDeployer extends GenericSshDeployer
// directory
String[] dirs = StringUtils.split(request.getDestDir(), "/");
for (int i = 0; i < dirs.length; i++)
{
{
try
{
SftpATTRS attrs = channel.stat(dirs[i]);
@ -120,7 +124,7 @@ public class SFtpDeployer extends GenericSshDeployer
}
else
{
throw new DeployException(
throw new WrongParameterException(
"Incorrect remote path:" + request.getDestDir());
}
}
@ -147,7 +151,7 @@ public class SFtpDeployer extends GenericSshDeployer
String msg =
"Error occured while deploying to remote host:"
+ request.getHost();
throw new DeployException(msg, e);
throw new TransferFailedException(msg, e);
}
catch (JSchException e)
@ -155,7 +159,7 @@ public class SFtpDeployer extends GenericSshDeployer
String msg =
"Error occured while deploying to remote host:"
+ request.getHost();
throw new DeployException(msg, e);
throw new TransferFailedException(msg, e);
}
finally
{

View File

@ -62,7 +62,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import org.apache.maven.deploy.DeployRequest;
import org.apache.maven.deploy.exceptions.DeployException;
import org.apache.maven.deploy.exceptions.TransferFailedException;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.Session;
@ -71,21 +71,21 @@ import com.jcraft.jsch.Session;
* An SSH2/SCP deployer
*
* @author Michal Maczka
* @version $Revision: 1.2 $ $Date: 2003/06/25 15:25:18 $
* @version $Revision: 1.3 $ $Date: 2003/06/29 11:57:40 $
*/
public class ScpDeployer extends GenericSshDeployer
{
/**Protocol understood by by this deployer*/
public final static String PROTOCOL = "scp://";
/** SSH2 Chanel names used to communicate with the server*/
public final static String EXEC_CHANNEL = "exec";
/**
* @see Deployer#project
*
* @todo better way of guessing what king of proxy server is used
* @see Deployer#deploy(DeployRequest)
*
*/
public void deploy(DeployRequest request) throws DeployException
public void deploy(DeployRequest request) throws TransferFailedException
{
Session session = getSession(request);
@ -116,10 +116,10 @@ public class ScpDeployer extends GenericSshDeployer
}
/**
* Execute simple command
* Execute <i>"simple"</i> remote command using exec channel
*/
private void executeSimpleCommand(Session session, String command)
throws DeployException
throws TransferFailedException
{
System.out.println("Executing command: " + command);
@ -134,7 +134,7 @@ public class ScpDeployer extends GenericSshDeployer
}
catch (Exception e)
{
throw new DeployException(
throw new TransferFailedException(
"Cannot execute remote command: " + command);
}
finally
@ -151,7 +151,7 @@ public class ScpDeployer extends GenericSshDeployer
* Code extracted from JSCH exaples
*/
private void doCopy(Session session, DeployRequest request)
throws DeployException
throws TransferFailedException
{
try
@ -231,7 +231,7 @@ public class ScpDeployer extends GenericSshDeployer
String msg =
"Error occured while deploying to remote host:"
+ request.getHost();
throw new DeployException(msg,e);
throw new TransferFailedException(msg,e);
}
}

View File

@ -58,11 +58,11 @@ package org.apache.maven.deploy.exceptions;
/**
*
* Root class for all exception thrown by Deployers
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: DeployException.java,v 1.1 2003/06/17 22:06:00 michal Exp $
* @version $Id: DeployException.java,v 1.2 2003/06/29 11:57:39 michal Exp $
*/
public class DeployException extends Exception
public abstract class DeployException extends Exception
{
private final String message;
private final Throwable cause;

View File

@ -0,0 +1,88 @@
package org.apache.maven.deploy.exceptions;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
/**
* Exception which should be thrown when IO error occures during
* making remote copy of the file
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: TransferFailedException.java,v 1.1 2003/06/29 11:57:39 michal Exp $
*/
public class TransferFailedException extends DeployException
{
/**
* @param message
*/
public TransferFailedException(String message)
{
super(message);
}
/**
* @param message
* @param cause
*/
public TransferFailedException(String message, Throwable cause)
{
super(message, cause);
// TODO Auto-generated constructor stub
}
}

View File

@ -60,14 +60,14 @@ package org.apache.maven.deploy.exceptions;
/**
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: UnsupportedProtocolDeployException.java,v 1.1 2003/06/17 22:06:00 michal Exp $
* @version $Id: UnsupportedProtocolException.java,v 1.1 2003/06/29 11:57:39 michal Exp $
*/
public class UnsupportedProtocolDeployException extends DeployException
public class UnsupportedProtocolException extends DeployException
{
/**
* @param message
*/
public UnsupportedProtocolDeployException(String message)
public UnsupportedProtocolException(String message)
{
super(message);
}
@ -76,7 +76,7 @@ public class UnsupportedProtocolDeployException extends DeployException
* @param message
* @param cause
*/
public UnsupportedProtocolDeployException(String message, Throwable cause)
public UnsupportedProtocolException(String message, Throwable cause)
{
super(message, cause);
}

View File

@ -0,0 +1,84 @@
package org.apache.maven.deploy.exceptions;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
/**
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: WrongParameterException.java,v 1.1 2003/06/29 11:57:39 michal Exp $
*/
public class WrongParameterException extends DeployException
{
/**
* @param message
*/
public WrongParameterException(String message)
{
super(message);
}
/**
* @param message
* @param cause
*/
public WrongParameterException(String message, Throwable cause)
{
super(message, cause);
}
}

View File

@ -0,0 +1 @@
stylesheets

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
<properties>
<title>Maven Artifact Plugin Properties</title>
<author email="michal.maczka@dimatics.com">Michal Maczka</author>
</properties>
<body>
<section name="Key-based authentification">
<p>
In preparation
</p>
</section>
</body>
</document>

View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Changes</title>
<author email="jason@zenplex.com">Jason van Zyl</author>
</properties>
<body>
<release version="1.0" date="2002-08-04">
<action dev="jvanzyl" type="add">
Original release for Maven 1.0-beta8
</action>
</release>
</body>
</document>

View File

@ -0,0 +1,49 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Maven Artifact Plug-in Examples</title>
<author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
<section name="Examples">
<p>
The following example demonstrates how to depoyment
of artifact to remote repsoitories can be configured.
<source><![CDATA[
#list of repositories to which we will deploy.
#There are 4 repositories
maven.repo.repos= R1, R2, R3, R4
#settings for repository 'R1'
maven.repo.R1=ftp://ftp.boo.com
maven.repo.R1.username=michal
maven.repo.R1.password=********
maven.repo.R1.directory=/web/repository
#settings for repository 'R2'
maven.repo.R2=sftp://host2.com
maven.repo.R2.username=michal
maven.repo.R2.password=*********
maven.repo.R2.port=22
maven.repo.R2.directory=maven/repoistory
maven.repo.R2.group=Michal
#settings for repository 'R3'
maven.repo.R3=scp://host3.com
maven.repo.R3.username=michal
maven.repo.R3.directory=repo
maven.repo.R3.group=remote_grup
maven.repo.R3.privatekey=/home/.ssh/id_dsa
#settings for repository 'R4'
maven.repo.R4=file://c:\\temp
maven.repo.R4.directory=repository
]]></source>
</p>
</section>
</body>
</document>

41
artifact/xdocs/index.xml Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Maven Artifact Plugin Properties</title>
<author email="michal.maczka@dimatics.com">Michal Maczka</author>
</properties>
<body>
<section name="Maven Artifact Plugin ">
<subsection name="Overview of the Maven Arifact Plug-in Reference Documentation">
<p>
This plugin generates java sources from schemas using Castor.
</p>
<table>
<tr><th>Document</th><th>Description</th></tr>
<tr><td><a href="properties.html">Properties</a></td>
<td>
The behavior of the Maven Artifact Plug-in can be altered via
several properties. This document describes each property
available, and the default used.
</td>
</tr>
<tr><td><a href="tags.html">Tags</a></td>
<td>
The Artifact plugin defines Jelly tags to generate java
sources. This document describes the tags and their
arguments.
</td>
</tr>
<tr><td><a href="examples.html">Examples</a></td>
<td>
This document provides examples on how to configure the Maven Artifact
plugin for deploying artifacts to remote repository
</td>
</tr>
</table>
</subsection>
</section>
</body>
</document>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Maven Artifact Plugin">
<title>Maven Artifact Plugin</title>
<body>
<links>
<item name="Maven" href="http://maven.apache.org/"/>
</links>
<menu name="Overview">
<item name="Goals" href="/goals.html" />
<item name="Properties" href="/properties.html" />
<item name="Tags" href="/tags.html" />
<item name="Examples" href="/examples.html" />
<item name="Supported Protocols" href="/protocols.html" />
<item name="Security Considerations" href="/security.html" />
<item name="Key-based Authentification" href="/authentification.html" />
</menu>
</body>
</project>

View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
<properties>
<title>Maven Artifact Plugin Properties</title>
<author email="michal.maczka@dimatics.com">Michal Maczka</author>
</properties>
<body>
<section name="Maven Artifact Plugin Settings">
<table>
<tr>
<th>Property name</th>
<th>Description</th>
<th>Optional?</th>
</tr>
<tr>
<td>maven.repo.list</td>
<td>
The list of comma separated names of
the repositories to which artifacts produced by
the project will be deployed. E.g.:
<br/>
<i>maven.repo.list=myrepo1,ibiblio</i>
<br/>
The names of all other properties are constructed using the
entries present in this list.
Below the set of properties which can be used for
configuration of deployment process to each of the repositories
provided in the list. <i>x</i> in the names
of those properties should be replaced by actual repository name
(like <i>ibiblio</i>).
In case of doubts see an <a href="example.html">example</a>
</td>
<td>No</td>
</tr>
<tr>
<td>maven.repo.x</td>
<td>
Specifies the URL of remote repository. The URL
should contain the protocol name.
<br/>
See the <a href="protocols.html">the list</a> of supported protocols.
<br/>
x corresponds to
repository name defined using <i>maven.repo.list</i> property.
</td>
<td>No</td>
</tr>
<tr>
<td>maven.repo.x.directory</td>
<td>
The path at remote file system where artifacts will be put
</td>
<td>No</td>
</tr>
<tr>
<td>maven.repo.x.username</td>
<td>
The user name which will be used to authetificated
user if access to repository requires authentification.
</td>
<td>Yes</td>
</tr>
<tr>
<td>maven.repo.x.password</td>
<td>
The password which will be used to authetificate
user.
<br/>
If server/protocol supports authetification via
both private/public keys and password,
first will try to use keys for authentication
and if that doesn't work then
we fall back to using the username and password
</td>
<td>Yes</td>
</tr>
<tr>
<td>maven.repo.x.group</td>
<td>
The remote group (UNIX group) to which
artifact will belong after it
will be deployed
</td>
<td>Yes</td>
</tr>
<tr>
<td>maven.repo.x.privatekey</td>
<td>
The absoluth path to private key file.
<br/>
Thie is used only for when protocol
supports authetification via private/public
key pair.
</td>
<td>Yes</td>
</tr>
<tr>
<td>maven.repo.x.passphrase</td>
<td>
The passphrase used to decrypt private key file
</td>
<td>Yes</td>
</tr>
</table>
</section>
<section name="Other properties used">
<p>
If you are behind firewall and need to use proxy server see
<a href="http://maven.apache.org/reference/user-guide.html#Using%20Proxies">following</a>
section from the <b>Maven User Guide</b> .
</p>
</section>
</body>
</document>

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
<properties>
<title>Maven Artifact Plugin Properties</title>
<author email="michal.maczka@dimatics.com">Michal Maczka</author>
</properties>
<body>
<section name="Supported protocols">
<table>
<tr>
<th>Protocol name</th>
<th>URL Prefix</th>
<th>Username</th>
<th>Directory</th>
<th>Password</th>
<th>Group</th>
<th>Private Key</th>
<th>Passphrase</th>
<th>Port</th>
</tr>
<tr>
<td>
<b>SCP</b>
(Secure Copy)
</td>
<td>scp://</td>
<td>Mandatory</td>
<td>Mandatory</td>
<td>Mandatory if private key unless private key is provided</td>
<td>Optional</td>
<td>Optional</td>
<td>Optional</td>
<td>Optional (deafult is 22)</td>
</tr>
<tr>
<td>
<b>SFTP</b>
(Secure FTP)
</td>
<td>sftp://</td>
<td>Mandatory</td>
<td>Mandatory</td>
<td>Mandatory if private key unless private key is provided</td>
<td>Optional</td>
<td>Optional</td>
<td>Optional</td>
<td>Optional (deafult is 22)</td>
</tr>
<tr>
<td><b>FTP</b></td>
<td>ftp://</td>
<td>Mandatory</td>
<td>Mandatory</td>
<td>Mandatory</td>
<td>Not supported</td>
<td>Not supported</td>
<td>Not supported</td>
<td>Optional (deafult is 21)</td>
</tr>
<tr>
<td><b>FILE</b></td>
<td>file://</td>
<td>Not supported</td>
<td>Mandatory</td>
<td>Not supported</td>
<td>Not supported</td>
<td>Not supported</td>
<td>Not supported</td>
<td>Not supported</td>
</tr>
</table>
</section>
</body>
</document>

View File

@ -0,0 +1,45 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Maven Artifact Plug-in Examples</title>
<author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
<section name="Securiry consideration">
<p>
<source><![CDATA[
>
> For the moment I have tested my API with username, user password
> kept in properties file. I think that such approach is not acceptable.
>
> You can use command line to pass properties to maven:
>
> maven war:deloy -Dmaven.repo.ibiblio.password = ******
>
>
> This is already better ... but still not perfect.
>
> I will try to implement/use(if I find one) simple class which will "Prompt"
> to type your password (eventually to enter other required parameters which
> are missing)
>
> regards
>
>
> Michal
I would avoid the command line passed password. It is much less secure
on unix than the password kept in a file. Command line can be seen by
simple ps commands, or e.g. linux systems store the in the /proc filesystem.
It should be used only from command files.
incze
]]></source>
</p>
</section>
</body>
</document>

206
artifact/xdocs/tags.xml Normal file
View File

@ -0,0 +1,206 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Maven Castor Plug-in Tags</title>
<author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
<section name="Overview">
<p>
This document describes the
<a href="http://jakarta.apache.org/commons/jelly/tags.html">tags</a>
that are available when using the Artifact Plug-in with Maven.
</p>
</section>
<section name="Tags">
<table>
<tr><th>Name</th><th>Description</th></tr>
<tr>
<td><a href="#artifact:deploy">artifact:delpoy</a></td>
<td>Deploy artifact to remote repository(ies)</td>
</tr>
<tr>
<td><a href="#artifact:deploy-snapshot">artifact:delpoy-snapshot</a></td>
<td>Deploy snapshot version of artifact to remote repository</td>
</tr>
<tr>
<td><a href="#artifact:install">artifact:install</a></td>
<td>Install artifact in local repository</td>
</tr>
<tr>
<td><a href="#artifact:deploy-snapshot">artifact:install-snapshot</a></td>
<td>Install snapshot version of artifact in local repository</td>
</tr>
</table>
<subsection name="artifact:deploy">
<p>
Deploy an artifact to the set of remote repositories.
<br/>
Following files will be deployed to remote repository:
<ol>
<li>Artifact file</li>
<li>MD5 checksum file of this artifact</li>
</ol>
</p>
<table>
<tr>
<th>Attribute Name</th><th>Description</th><th>Optional?</th>
</tr>
<tr>
<td>artifact</td>
<td>The path to the artifact file</td>
<td>No</td>
</tr>
<tr>
<td>type</td>
<td>The type of the artifact
(like <i>jar</i> or <i>war</i>). Type is used for
computing a detination path in repository.
</td>
<td>No</td>
</tr>
<tr>
<td>project</td>
<td>
The project (POM) which produced artifact which will be deployed.
<br/>
POM contatins a bunch of settings (variables and context properties)
which must be conulted in order to deploy artifact to repsoitories(s).
Those settings include:
<ol>
<li>List of remote repositories where artifact will be deployed</li>
<li>artifactId, groupId, version</li>
<li>Individual settings of each repository</li>
<li>Proxy server settings</li>
<li>...</li>
</ol>
</td>
<td>NO</td>
</tr>
</table>
</subsection>
<subsection name="artifact:deploy-snapshot">
<p>
Deploy a snapshot version of the artifact to a set of remote repositories.
<br/>
During deloyment following files are put to remote repository:
<ul>
<li>Timestamped Artifact file</li>
<li>MD5 checksum file of timestamped artifact file</li>
<li>Artifact file with version marked as <i>SNAPSHOT</i></li>
<li>MD5 checksum file of this file</li>
<li>${artifactId}-snapshot-version</li>
</ul>
For exaple for artifact with artifactId = <i>foo</i>
the following files will be transfered to the remote repository:
<ul>
<li>foo-20030620.124616.jar</li>
<li>foo-20030620.124616.jar.md5</li>
<li>foo-SNAPSHOT.jar</li>
<li>foo-SNAPSHOT.jar.md5</li>
<li>foo-snapshot-version</li>
</ul>
File <i>foo-snapshot-version</i>
simply contains the version number (20030620.124616)
that the snapshot is linked with,
so that
<a href="http://maven.apache.org/reference/user-guide.html#Resolving%20SNAPSHOT%20Dependencies">'convert-snapshots'</a>
can correctly update dependencies in projects which will use this artifact.
<br/>
<b>artifact:deploy-snapshot</b> tag uses the same set of attributes
as <a href="artifact:deloy">artifact:deploy</a> tag
</p>
</subsection>
<subsection name="artifact:install">
<p>
Install an artifact in the local repository
<br/>
Following files will be copied to the local repository:
<ol>
<li>Artifact file</li>
<li>MD5 checksum file of this artifact</li>
</ol>
</p>
<p>
<i>Why I should use <b>artifact:install</b> when it is so easy
just to copy a file inside my plugin?
</i>
<br/>
There are few good reason for that:
<ul>
<li>
What is simple now, not necesserly must stay simple in the future.
E.g. when Maven will run in client-server mode
information about repository content can be cached
and even some files from repository can cached in memory
(e.g. POMS). Using centralized "proxy" which copies
files to the repository can play importand role in this
process.
</li>
<li>
It is as simple to use as ant:copy task, but does not require
usage of Ant.
</li>
</ul>
</p>
<table>
<tr>
<th>Attribute Name</th><th>Description</th><th>Optional?</th>
</tr>
<tr>
<td>artifact</td>
<td>The path to the artifact file</td>
<td>No</td>
</tr>
<tr>
<td>type</td>
<td>The type of the artifact
(like <i>jar</i> or <i>war</i>). Type is used for
computing a detination path in repository.
</td>
<td>No</td>
</tr>
<tr>
<td>project</td>
<td>
Information kept in the POM included following bits
used for controling:
<ul>
<li>artifactId, groupId, version</li>
<li>Location of the local repository</li>
</ul>
</td>
<td>NO</td>
</tr>
</table>
</subsection>
<subsection name="artifact:install-snapshot">
<p>
Install a snapshot version of the artifact in the local repository
<br/>
Following files are copied to the local repository:
<ul>
<li>Timestamped Artifact file</li>
<li>Artifact file with version marked as <i>SNAPSHOT</i></li>
</ul>
For exaple for artifact with artifactId foo
following files will be transfered to local repository:
<ul>
<li>foo-20030620.124616.jar</li>
<li>foo-SNAPSHOT.jar</li>
</ul>
<br/>
<b>artifact:install-snapshot</b> tag uses the same set of attributes
as <a href="#artifact:install">artifact:install</a> tag
</p>
</subsection>
</section>
</body>
</document>