diff --git a/artifact/plugin.jelly b/artifact/plugin.jelly index 3d6cdc41..d053f2a8 100644 --- a/artifact/plugin.jelly +++ b/artifact/plugin.jelly @@ -22,7 +22,11 @@ xmlns:j="jelly:core" xmlns:define="jelly:define" xmlns:ant="jelly:ant" + xmlns:util="jelly:util" + xmlns:maven="jelly:maven" xmlns:velocity="jelly:velocity" + xmlns:artifact="artifact" + xmlns:deploy="deploy" > @@ -44,15 +48,84 @@ className="org.apache.maven.artifact.deployer.DeployBean"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + maven.artifact.legacy is set to true - using legacy deploy mode + + + + maven.artifact.legacy is set to false - using artifact deploy mode + + + + maven.repo.list is not set - using legacy deploy mode + + + + maven.repo.list is set - using artifact deploy mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Moving ${artifact} to the ${resolvedDirectory} on ${siteAddress} + + + + + + + + + + + + + + + + + + + + + + + + + + Executing ${siteCommand} with the username ${username} on ${siteAddress} + + + + + + + + + + + + + + + + + + + + + + + + + + + ${excludes} + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/artifact/project.xml b/artifact/project.xml index 7cd5d776..1595bf2b 100644 --- a/artifact/project.xml +++ b/artifact/project.xml @@ -78,6 +78,12 @@ 1.0.1 jar + + commons-logging + commons-logging + 1.0.3 + jar + jsch jsch diff --git a/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java b/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java index 2b0f68d7..ba9cc0a6 100644 --- a/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java +++ b/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java @@ -28,6 +28,8 @@ import java.util.TimeZone; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.maven.MavenConstants; import org.apache.maven.MavenException; import org.apache.maven.deploy.DeployTool; @@ -41,7 +43,7 @@ import org.apache.maven.util.MD5Sum; * * * @author Michal Maczka - * @version $Id: DefaultArtifactDeployer.java,v 1.18 2004/05/10 23:36:34 brett Exp $ + * @version $Id: DefaultArtifactDeployer.java,v 1.19 2004/06/14 13:36:47 brett Exp $ */ public class DefaultArtifactDeployer implements ArtifactDeployer { @@ -77,6 +79,8 @@ public class DefaultArtifactDeployer implements ArtifactDeployer SNAPSHOT_SIGNATURE_FMT.setTimeZone(TimeZone.getTimeZone("GMT")); } + private static final Log LOG = LogFactory.getLog(DefaultArtifactDeployer.class); + /** * @see ArtifactDeployer#deploy(String, String, Project) * @@ -279,6 +283,45 @@ public class DefaultArtifactDeployer implements ArtifactDeployer } } + private String findSshIdentity() { + String key = findSshIdentity( System.getProperty( "user.home" ) ); + if ( key != null ) { + return key; + } + if ( System.getProperty( "user.home" ).equals( System.getProperty( "user.home.env" ) ) == false ) { + key = findSshIdentity( System.getProperty( "user.home.env" ) ); + if ( key != null ) { + return key; + } + } + LOG.warn( "Unable to locate identity id_rsa, id_dsa or identity - set maven.repo.default.privatekey" ); + return null; + } + + private String findSshIdentity( String home ) { + if ( home == null ) { + return null; + } + File sshHome = new File( home, ".ssh" ); + LOG.debug( "Looking for SSH keys in " + sshHome ); + File key = new File( sshHome, "id_dsa" ); + if ( key.exists() ) { + LOG.debug( "found " + key ); + return key.getAbsolutePath(); + } + key = new File( sshHome, "id_rsa" ); + if ( key.exists() ) { + LOG.debug( "found " + key ); + return key.getAbsolutePath(); + } + key = new File( sshHome, "identity" ); + if ( key.exists() ) { + LOG.debug( "found " + key ); + return key.getAbsolutePath(); + } + return null; + } + /** * @param artifact * @param type @@ -296,15 +339,29 @@ public class DefaultArtifactDeployer implements ArtifactDeployer String repoStr = (String) project.getContext().getVariable("maven.repo.list"); - if (repoStr == null || repoStr.length() == 0) + if (repoStr == null || repoStr.trim().length() == 0) { - System.out.println("No remote repository was defined."); - return; + String central = (String) project.getContext().getVariable("maven.repo.central"); + if (central != null && central.trim().length() > 0) { + repoStr = "default"; + project.getContext().setVariable("maven.repo.default", "scp://" + central); + if ( project.getContext().getVariable("maven.repo.default.privatekey") == null ) { + project.getContext().setVariable("maven.repo.default.privatekey", findSshIdentity()); + } + if ( project.getContext().getVariable("maven.repo.default.passphrase") == null ) { + LOG.warn( "WARNING: assuming empty passphrase. Specify maven.repo.default.passphrase if needed" ); + project.getContext().setVariable("maven.repo.default.passphrase", ""); + } + project.getContext().setVariable("maven.repo.default.directory", project.getContext().getVariable("maven.repo.central.directory")); + project.getContext().setVariable("maven.repo.default.username", project.getContext().getVariable("maven.username")); + project.getContext().setVariable("maven.repo.default.group", project.getContext().getVariable("maven.remote.group")); + } } + String[] repos = StringUtils.split(repoStr, ","); - System.out.println( - "Will deploy to " + repos.length + " repository(ies): " + repoStr); + System.out.println( "Will deploy to " + repos.length + " repository(ies): " + repoStr); + boolean success = false; for (int i = 0; i < repos.length; i++) { @@ -317,6 +374,7 @@ public class DefaultArtifactDeployer implements ArtifactDeployer RepositoryInfoBuilder.getRepositoryInfo(project, repo); deployTool.deploy(repoInfo, srcFiles, destFiles); + success = true; } catch (Exception e) { @@ -325,13 +383,16 @@ public class DefaultArtifactDeployer implements ArtifactDeployer + repoInfo.getRepositoryAlias() + " Reason: " + e.getMessage(); - System.out.print(msg); + LOG.warn(msg); + LOG.debug(e); // deploy to next repository - e.printStackTrace(); continue; } } + if ( !success ) { + throw new MavenException("Unable to deploy to any repositories"); + } } /** diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/FileDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/FileDeployer.java index 4d852721..256b3ce1 100644 --- a/artifact/src/main/org/apache/maven/deploy/deployers/FileDeployer.java +++ b/artifact/src/main/org/apache/maven/deploy/deployers/FileDeployer.java @@ -30,7 +30,7 @@ import org.apache.maven.deploy.exceptions.TransferFailedException; * file system. * * @author Michal Maczka - * @version $Id: FileDeployer.java,v 1.13 2004/05/02 15:04:34 vmassol Exp $ + * @version $Id: FileDeployer.java,v 1.14 2004/06/14 13:36:48 brett Exp $ */ public class FileDeployer extends AbstractDeployer { @@ -79,7 +79,7 @@ public class FileDeployer extends AbstractDeployer catch (IOException e) { throw new TransferFailedException( - "Cannot copy file: " + e.getMessage()); + "Cannot copy file: " + e.getMessage(), e); } } } diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/FtpDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/FtpDeployer.java index 54de94fe..95ab6875 100644 --- a/artifact/src/main/org/apache/maven/deploy/deployers/FtpDeployer.java +++ b/artifact/src/main/org/apache/maven/deploy/deployers/FtpDeployer.java @@ -40,7 +40,7 @@ import org.apache.maven.deploy.exceptions.TransferFailedException; * * @author Jason van Zyl * @author Michal Maczka - * @version $Id: FtpDeployer.java,v 1.9 2004/05/02 15:04:34 vmassol Exp $ + * @version $Id: FtpDeployer.java,v 1.10 2004/06/14 13:36:48 brett Exp $ * * @todo review exception handling * @@ -108,7 +108,7 @@ public class FtpDeployer extends AbstractDeployer // do nothing } } - throw new AuthenticationException("Could not connect to server."); + throw new AuthenticationException("Could not connect to server.",e); } try @@ -130,7 +130,7 @@ public class FtpDeployer extends AbstractDeployer } catch (IOException e) { - throw new AuthenticationException("Cannot login to remote system"); + throw new AuthenticationException("Cannot login to remote system",e); } } @@ -179,8 +179,7 @@ public class FtpDeployer extends AbstractDeployer } catch (Exception e) { - e.printStackTrace(); - throw new TransferFailedException(e.getMessage()); + throw new TransferFailedException(e.getMessage(),e); } } diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/GenericSshDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/GenericSshDeployer.java index a8971176..f6cb330a 100644 --- a/artifact/src/main/org/apache/maven/deploy/deployers/GenericSshDeployer.java +++ b/artifact/src/main/org/apache/maven/deploy/deployers/GenericSshDeployer.java @@ -40,7 +40,7 @@ import com.jcraft.jsch.UserInfo; * and if that doesn't work then we fall back * to using the login and password * - * @version $Id: GenericSshDeployer.java,v 1.8 2004/03/02 14:59:31 evenisse Exp $ + * @version $Id: GenericSshDeployer.java,v 1.9 2004/06/14 13:36:48 brett 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 @@ -167,7 +167,6 @@ public abstract class GenericSshDeployer extends AbstractDeployer } catch (Exception e) { - e.printStackTrace(); throw new AuthenticationException( "Cannot connect. Reason: " + e.getMessage(), e); diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/SFtpDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/SFtpDeployer.java index cc0b0cd3..5683a7c9 100644 --- a/artifact/src/main/org/apache/maven/deploy/deployers/SFtpDeployer.java +++ b/artifact/src/main/org/apache/maven/deploy/deployers/SFtpDeployer.java @@ -32,7 +32,7 @@ import com.jcraft.jsch.SftpProgressMonitor; * An SSH2/SFTP deployer * * @author Michal Maczka - * @version $Revision: 1.9 $ $Date: 2004/03/02 14:59:31 $ + * @version $Revision: 1.10 $ $Date: 2004/06/14 13:36:48 $ */ public class SFtpDeployer extends GenericSshDeployer { @@ -78,7 +78,7 @@ public class SFtpDeployer extends GenericSshDeployer } catch (Exception e) { - throw new AuthenticationException(e.getMessage()); + throw new AuthenticationException(e.getMessage(),e); } } diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/ScpDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/ScpDeployer.java index dc6f55ef..c1a2befd 100644 --- a/artifact/src/main/org/apache/maven/deploy/deployers/ScpDeployer.java +++ b/artifact/src/main/org/apache/maven/deploy/deployers/ScpDeployer.java @@ -39,7 +39,7 @@ import java.util.List; * An SSH2/SCP deployer * * @author Michal Maczka - * @version $Revision: 1.9 $ $Date: 2004/05/12 12:33:55 $ + * @version $Revision: 1.10 $ $Date: 2004/06/14 13:36:48 $ */ public class ScpDeployer extends GenericSshDeployer { @@ -180,7 +180,7 @@ public class ScpDeployer extends GenericSshDeployer } } - throw new TransferFailedException("Cannot create ZIP file"); + throw new TransferFailedException("Cannot create ZIP file",e); } try @@ -264,7 +264,7 @@ public class ScpDeployer extends GenericSshDeployer catch (Exception e) { throw new TransferFailedException( - "Cannot execute remote command: " + command); + "Cannot execute remote command: " + command,e); } finally { diff --git a/deploy/src/plugin-test/.cvsignore b/artifact/src/plugin-test/.cvsignore similarity index 100% rename from deploy/src/plugin-test/.cvsignore rename to artifact/src/plugin-test/.cvsignore diff --git a/deploy/src/plugin-test/maven.xml b/artifact/src/plugin-test/maven.xml similarity index 100% rename from deploy/src/plugin-test/maven.xml rename to artifact/src/plugin-test/maven.xml diff --git a/deploy/src/plugin-test/project.xml b/artifact/src/plugin-test/project.xml similarity index 100% rename from deploy/src/plugin-test/project.xml rename to artifact/src/plugin-test/project.xml diff --git a/artifact/xdocs/changes.xml b/artifact/xdocs/changes.xml index 927e468f..20a5c7c6 100644 --- a/artifact/xdocs/changes.xml +++ b/artifact/xdocs/changes.xml @@ -26,6 +26,7 @@ + Absorb the deploy plugin to give one point of migration Build and run against the installed version of Maven Replace Apache Jakarta Maven by Apache Maven in Manifest diff --git a/artifact/xdocs/properties.xml b/artifact/xdocs/properties.xml index ea4c81eb..5ec589aa 100644 --- a/artifact/xdocs/properties.xml +++ b/artifact/xdocs/properties.xml @@ -137,5 +137,51 @@ section from the Maven User Guide .

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
maven.artifact.legacyYes + Force legacy (deploy) operation mode, where the SSH and SCP command line tools are used. + If artifact is not configured, this will take effect automatically. +
maven.scp.executableYes + Specifies the name (and possibly location) of the remote secure + copy executable to use (SCP). + The default value is scp (i.e. an executable + named scp must be in your path). +
maven.scp.argsYes + Specifies optional parameters that are passed to the scp executable. +
maven.ssh.executableYes + Specifies the name (and possibly location) of the remote secure + shell executable to use (SSH). + The default value is ssh (i.e. an executable + named ssh must be in your path). +
maven.ssh.argsYes + Specifies optional parameters that are passed to the ssh executable. +
+
diff --git a/deploy/.cvsignore b/deploy/.cvsignore deleted file mode 100644 index 30e5f424..00000000 --- a/deploy/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -target -velocity.log -maven.log -build.properties diff --git a/deploy/plugin.jelly b/deploy/plugin.jelly deleted file mode 100644 index b56991b7..00000000 --- a/deploy/plugin.jelly +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Moving ${artifact} to the ${resolvedDirectory} on ${siteAddress} - - - - - - - - - - - - - - - - - - - - - - - - - - Executing ${siteCommand} with the username ${username} on ${siteAddress} - - - - - - - - - - - - - - - - - - - - - - - - - - - ${excludes} - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/deploy/project.properties b/deploy/project.properties deleted file mode 100644 index d66f96c3..00000000 --- a/deploy/project.properties +++ /dev/null @@ -1,19 +0,0 @@ -# ------------------------------------------------------------------- -# Copyright 2001-2004 The Apache Software Foundation. -# -# Licensed 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. -# ------------------------------------------------------------------- - -# ------------------------------------------------------------------- -# P R O J E C T P R O P E R T I E S -# ------------------------------------------------------------------- diff --git a/deploy/project.xml b/deploy/project.xml deleted file mode 100644 index 6086aae6..00000000 --- a/deploy/project.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - ../plugin-parent/project.xml - 3 - maven-deploy-plugin - Maven Deploy Plugin - 1.3 - - Deploy to remote repository - http://maven.apache.org/reference/plugins/deploy/ - http://jira.codehaus.org/BrowseProject.jspa?id=10330 - /www/maven.apache.org/reference/plugins/deploy/ - - scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/deploy/ - scm:cvs:ext:${maven.username}@cvs.apache.org:/home/cvs:maven-plugins/deploy/ - http://cvs.apache.org/viewcvs/maven-plugins/deploy/ - - - - 1.2 - 1.2 - MAVEN_DEPLOY_1_2 - - - 1.3 - 1.3 - MAVEN_DEPLOY_1_3 - - - - - Stéphane Mor - smor - stephanemor@yahoo.fr - Hasgard Systèmes et Réseaux - - Java Developer - - - - Jason van Zyl - jvanzyl - jason@zenplex.com - Zenplex - - Architect - Release Manager - - - - - diff --git a/deploy/xdocs/.cvsignore b/deploy/xdocs/.cvsignore deleted file mode 100644 index cb6131bb..00000000 --- a/deploy/xdocs/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -stylesheets diff --git a/deploy/xdocs/changes.xml b/deploy/xdocs/changes.xml deleted file mode 100644 index 89f3e40f..00000000 --- a/deploy/xdocs/changes.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - Changes for the Deploy plugin - Vincent Massol - - - - Add optional maven.ssh.args and maven.scp.args. - - - Probably lots of things but nobody was counting... - - - diff --git a/deploy/xdocs/goals.xml b/deploy/xdocs/goals.xml deleted file mode 100644 index fa73bfcc..00000000 --- a/deploy/xdocs/goals.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - Maven Deploy goals - dIon Gillard - - - -
- - - - - - -
GoalDescription
deploy:pom - Deploy project.xml, a.k.a. the POM to the central repository. -
-
- -
diff --git a/deploy/xdocs/index.xml b/deploy/xdocs/index.xml deleted file mode 100644 index e370dddf..00000000 --- a/deploy/xdocs/index.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - Maven Deployment Plug-in - Jason van Zyl - - - -
-

- This plugin is a general deployment mechanism used for deploying - artifacts into the central Maven repository and for deploying - a project's site. -

-
- -
diff --git a/deploy/xdocs/navigation.xml b/deploy/xdocs/navigation.xml deleted file mode 100644 index 3e0e81ca..00000000 --- a/deploy/xdocs/navigation.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - Maven Deploy Plugin - - - - - - - - - - - diff --git a/deploy/xdocs/properties.xml b/deploy/xdocs/properties.xml deleted file mode 100644 index 941a4eae..00000000 --- a/deploy/xdocs/properties.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - Deploy Properties - Stéphane MOR - - - -
- - - - - - - - - - - - - - - - - - - - - -
maven.scp.executableYes - Specifies the name (and possibly location) of the remote secure - copy executable to use (SCP). This is used by the "deploy:pom" goal. - The default value is scp (i.e. an executable - named scp must be in your path). -
maven.scp.argsYes - Specifies optional parameters that are passed to the scp executable. -
maven.ssh.executableYes - Specifies the name (and possibly location) of the remote secure - shell executable to use (SSH). This is used by the "deploy:pom" goal. - The default value is ssh (i.e. an executable - named ssh must be in your path). -
maven.ssh.argsYes - Specifies optional parameters that are passed to the ssh executable. -
-
- -