michal 2003/09/05 07:53:53
Modified: src/plugins-build/artifact/src/main/org/apache/maven/artifact/deployer
DefaultArtifactDeployer.java
src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers
FileDeployer.java
Log:
Applied a patch from Rafal Krzewski
Revision Changes Path
1.14 +48 -76
maven/src/plugins-build/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
Index: DefaultArtifactDeployer.java
===================================================================
RCS file:
/home/cvs/maven/src/plugins-build/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- DefaultArtifactDeployer.java 27 Jul 2003 21:57:19 -0000 1.13
+++ DefaultArtifactDeployer.java 5 Sep 2003 14:53:52 -0000 1.14
@@ -68,9 +68,8 @@
import org.apache.commons.lang.StringUtils;
import org.apache.maven.MavenConstants;
import org.apache.maven.MavenException;
-import org.apache.maven.deploy.RepositoryInfo;
import org.apache.maven.deploy.DeployTool;
-import org.apache.maven.deploy.deployers.Deployer;
+import org.apache.maven.deploy.RepositoryInfo;
import org.apache.maven.project.Project;
import org.apache.maven.util.MD5Sum;
@@ -131,8 +130,15 @@
public void deploy(String artifact, String type, Project project)
throws MavenException
{
-
- File file = getFileForArtifact(artifact);
+ File file;
+ if("pom".equals(type))
+ {
+ file = project.getFile();
+ }
+ else
+ {
+ file = getFileForArtifact(artifact);
+ }
File md5File = createMD5Checksum(file);
String repositoryPath =
getRepositoryFullPath(type, project, project.getCurrentVersion());
@@ -146,29 +152,13 @@
destFiles.add(repositoryPath + ".md5");
//do not deploy POM twice
- File projectMd5 = null;
if (DEPLOY_POM && !"pom".equals(type))
{
- File projectFile = project.getFile();
- projectMd5 = createMD5Checksum(projectFile);
- String pomRepositoryPath =
- getRepositoryFullPath(
- "pom",
- project,
- project.getCurrentVersion());
- srcFiles.add(projectFile.getAbsolutePath());
- srcFiles.add(projectMd5.getAbsolutePath());
- destFiles.add(pomRepositoryPath);
- destFiles.add(pomRepositoryPath + ".md5");
-
+ deploy(artifact, "pom", project);
}
doDeploy(srcFiles, destFiles, project);
- //Delete md5 files
+ //Delete md5 file
md5File.delete();
- if (DEPLOY_POM_SNAPSHOT && !"pom".equals(type))
- {
- projectMd5.delete();
- }
}
/**
@@ -179,21 +169,23 @@
{
String snapshotSignature = getSnapshotSignature();
- File file = getFileForArtifact(artifact);
+ File file;
+ if("pom".equals(type))
+ {
+ file = project.getFile();
+ }
+ else
+ {
+ file = getFileForArtifact(artifact);
+ }
File md5File = createMD5Checksum(file);
File snapshotVersionFile =
createSnapshotVersionFile(file, snapshotSignature, project, type);
- String repositoryPath =
- getRepositoryFullPath(
- type,
- project,
- MavenConstants.SNAPSHOT_SIGNIFIER);
List srcFiles = new ArrayList();
-
- srcFiles.add(file.getAbsolutePath());
srcFiles.add(file.getAbsolutePath());
srcFiles.add(md5File.getAbsolutePath());
+ srcFiles.add(file.getAbsolutePath());
srcFiles.add(md5File.getAbsolutePath());
srcFiles.add(snapshotVersionFile.getAbsolutePath());
@@ -204,53 +196,27 @@
MavenConstants.SNAPSHOT_SIGNIFIER);
String timestampedFilename =
getRepositoryFullPath(type, project, snapshotSignature);
+ String snapshotVersionsFilename =
+ getRepositoryDirectoryPath(type, project)
+ + project.getArtifactId()
+ + "-snapshot-version";
List destFiles = new ArrayList();
destFiles.add(snapshotFilename);
destFiles.add(snapshotFilename + ".md5");
destFiles.add(timestampedFilename);
destFiles.add(timestampedFilename + ".md5");
- destFiles.add(
- getRepositoryDirectoryPath(type, project)
- + project.getArtifactId()
- + "-snapshot-version");
+ destFiles.add(snapshotVersionsFilename);
// do not deploy POM twice
- File projectMd5 = null;
if (DEPLOY_POM_SNAPSHOT && !"pom".equals(type))
{
- File projectFile = project.getFile();
- projectMd5 = createMD5Checksum(projectFile);
- String pomRepositoryPath =
- getRepositoryFullPath(
- "pom",
- project,
- project.getCurrentVersion());
- srcFiles.add(projectFile.getAbsolutePath());
- srcFiles.add(projectFile.getAbsolutePath());
-
- srcFiles.add(projectMd5.getAbsolutePath());
- srcFiles.add(projectMd5.getAbsolutePath());
- srcFiles.add(snapshotVersionFile.getAbsolutePath());
-
- destFiles.add(pomRepositoryPath);
- destFiles.add(pomRepositoryPath);
- destFiles.add(pomRepositoryPath + ".md5");
- destFiles.add(pomRepositoryPath + ".md5");
- destFiles.add(
- getRepositoryDirectoryPath("pom", project)
- + project.getArtifactId()
- + "-snapshot-version");
+ deploySnapshot(artifact, "pom", project);
}
doDeploy(srcFiles, destFiles, project);
- // Delete md5 files
+ // Delete md5 file
md5File.delete();
- if (DEPLOY_POM_SNAPSHOT && !"pom".equals(type))
- {
- projectMd5.delete();
- }
-
};
/**
@@ -259,7 +225,15 @@
public void install(String artifact, String type, Project project)
throws MavenException
{
- File file = getFileForArtifact(artifact);
+ File file;
+ if("pom".equals(type))
+ {
+ file = project.getFile();
+ }
+ else
+ {
+ file = getFileForArtifact(artifact);
+ }
doInstall(file, type, project, project.getCurrentVersion());
// do not install twice
if (INSTALL_POM && !"pom".equals(type))
@@ -278,7 +252,15 @@
public void installSnapshot(String artifact, String type, Project project)
throws MavenException
{
- File file = getFileForArtifact(artifact);
+ File file;
+ if("pom".equals(type))
+ {
+ file = project.getFile();
+ }
+ else
+ {
+ file = getFileForArtifact(artifact);
+ }
String snapshotSignature = getSnapshotSignature();
System.out.println("Installing snapshot of:'" + artifact + "''");
doInstall(file, type, project, MavenConstants.SNAPSHOT_SIGNIFIER);
@@ -293,7 +275,6 @@
MavenConstants.SNAPSHOT_SIGNIFIER);
doInstall(projectFile, "pom", project, snapshotSignature);
}
-
}
/**
@@ -311,7 +292,6 @@
String version)
throws MavenException
{
-
try
{
File destFile =
@@ -325,7 +305,6 @@
System.out.println(
"Copying: from '" + file + "' to: '" + destFile + "'");
FileUtils.copyFile(file, destFile);
-
}
catch (IOException e)
{
@@ -336,7 +315,6 @@
+ e.getMessage();
throw new MavenException(msg, e);
}
-
}
/**
@@ -365,7 +343,6 @@
System.out.println(
"Will deploy to " + repos.length + " repository(ies): " + repoStr);
- Deployer deployer = null;
for (int i = 0; i < repos.length; i++)
{
@@ -393,7 +370,6 @@
}
}
-
}
/**
@@ -487,7 +463,6 @@
throw new MavenException(msg);
}
return file.getAbsoluteFile();
-
}
/**
@@ -506,7 +481,6 @@
throws MavenException
{
File file = null;
- String basename = FileUtils.basename(artifact.getAbsolutePath());
String filename =
project.getArtifactId() + "-" + type + "-snapshot-version";
try
@@ -521,7 +495,6 @@
"Cannot create snapshot-version file:" + file);
}
return file;
-
}
/**
@@ -576,5 +549,4 @@
}
return type;
}
-
}
1.11 +2 -2
maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/FileDeployer.java
Index: FileDeployer.java
===================================================================
RCS file:
/home/cvs/maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/FileDeployer.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FileDeployer.java 19 Aug 2003 04:45:05 -0000 1.10
+++ FileDeployer.java 5 Sep 2003 14:53:53 -0000 1.11
@@ -112,7 +112,7 @@
{
destFile.mkdirs();
}
- destFile = new File(destFile, request.getDestFile());
+ destFile = new File(destFile, request.filename());
FileUtils.copyFile(srcFile, destFile);
}
catch (IOException e)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]