From aaab7f48aa71ca2fd47c5ecb6bdd781ff4ad7158 Mon Sep 17 00:00:00 2001 From: brett Date: Fri, 18 Feb 2005 02:03:09 +0000 Subject: [PATCH] use file wagon for install, and improve output git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@154227 13f79535-47bb-0310-9956-ffa450edef68 --- artifact/plugin.jelly | 26 +++++++++++++++++-- .../deployer/DefaultArtifactDeployer.java | 25 +++--------------- .../maven/artifact/deployer/UploadMeter.java | 2 +- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/artifact/plugin.jelly b/artifact/plugin.jelly index f62673fa..c36e86ed 100644 --- a/artifact/plugin.jelly +++ b/artifact/plugin.jelly @@ -33,12 +33,12 @@ @@ -52,7 +52,28 @@ method="deploySnapshot" className="org.apache.maven.artifact.deployer.DeployBean"/> + + Installing... + + + + + Installing as a snapshot... + + + + Deploying... @@ -97,6 +118,7 @@ + Deploying as snapshot... 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 4c75fd76..1cb93bb4 100644 --- a/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java +++ b/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java @@ -244,17 +244,11 @@ public class DefaultArtifactDeployer { try { - // TODO: swap for file wagon - File destFile = new File( getLocalRepository( project ), - handler.constructRepositoryFullPath( type, project, version ) ); - if ( !destFile.getParentFile().exists() ) - { - destFile.getParentFile().mkdirs(); - } - LOG.info( "Copying: from '" + file + "' to: '" + destFile + "'" ); - FileUtils.copyFile( file, destFile ); + Repository repository = new Repository( "local", "file:" + project.getContext().getMavenRepoLocal() ); + String repositoryPath = handler.constructRepositoryFullPath( type, project, version ); + deployFiles( repository, Collections.singletonList( file ), Collections.singletonList( repositoryPath ) ); } - catch ( IOException e ) + catch ( Exception e ) { String msg = "Cannot install file: '" + file + "'. Reason: " + e.getMessage(); throw new MavenException( msg, e ); @@ -442,17 +436,6 @@ public class DefaultArtifactDeployer } } - /** - * 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 ) - { - return project.getContext().getMavenRepoLocal(); - } - /** * @return */ diff --git a/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java b/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java index 9fc0c727..a8c1b361 100755 --- a/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java +++ b/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java @@ -55,7 +55,7 @@ public class UploadMeter implements TransferListener { shownSoFar = 0; complete = 0; - System.out.println( "Uploading " + transferEvent.getLocalFile().getName() + ": " ); + System.out.println( "Uploading to " + transferEvent.getResource().getName() + ": " ); total = transferEvent.getLocalFile().length(); }