aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2008-08-06 10:59:34 +0000
committerMaria Odea B. Ching <oching@apache.org>2008-08-06 10:59:34 +0000
commite7c982ab6c5d7508e2d109f4eb29088f952ed3a1 (patch)
treeb71e8511d541e278e9d903955af1d0577f6d69b9
parent5a2cefab124cc3f1ce9bc096429c216ca160e8d4 (diff)
downloadarchiva-e7c982ab6c5d7508e2d109f4eb29088f952ed3a1.tar.gz
archiva-e7c982ab6c5d7508e2d109f4eb29088f952ed3a1.zip
[MRM-896]
-remove classifier from filename of poms during artifact upload git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@683220 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
index c6ada1d06..c539f1962 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
@@ -68,6 +68,7 @@ import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.Preparable;
import com.opensymphony.xwork.Validateable;
import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang.StringUtils;
/**
* Upload an artifact using Jakarta file upload in webwork. If set by the user a pom will also be generated. Metadata
@@ -388,11 +389,18 @@ public class UploadAction
return ERROR;
}
+ String pomFilename = filename;
+ if( classifier != null && !"".equals( classifier ) )
+ {
+ pomFilename = StringUtils.remove( pomFilename, "-" + classifier );
+ }
+ pomFilename = FilenameUtils.removeExtension( pomFilename ) + ".pom";
+
if ( generatePom )
{
try
{
- File generatedPomFile = createPom( targetPath, filename );
+ File generatedPomFile = createPom( targetPath, pomFilename );
consumers.executeConsumers( repoConfig, generatedPomFile );
}
catch ( IOException ie )
@@ -410,10 +418,9 @@ public class UploadAction
if ( pomFile != null && pomFile.length() > 0 )
{
try
- {
- String targetFilename = filename.replaceAll( packaging, "pom" );
- copyFile( pomFile, targetPath, targetFilename );
- consumers.executeConsumers( repoConfig, new File( targetPath, targetFilename ) );
+ {
+ copyFile( pomFile, targetPath, pomFilename );
+ consumers.executeConsumers( repoConfig, new File( targetPath, pomFilename ) );
}
catch ( IOException ie )
{
@@ -482,9 +489,7 @@ public class UploadAction
projectModel.setVersion( version );
projectModel.setPackaging( packaging );
- filename = FilenameUtils.removeExtension(filename) + ".pom";
- File pomFile = new File( targetPath, filename);
-
+ File pomFile = new File( targetPath, filename);
pomWriter.write( projectModel, pomFile );
return pomFile;