Author: bentmann
Date: Sun Jul 11 18:57:26 2010
New Revision: 963122
URL: http://svn.apache.org/viewvc?rev=963122&view=rev
Log:
[MDEPLOY-112] deployed snapshot name has different build numbers for multiple
artifacts of the same build
Added:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/pom.xml
(with props)
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/setup.bsh
(with props)
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/verify.bsh
(with props)
Modified:
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
Added:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/pom.xml?rev=963122&view=auto
==============================================================================
---
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/pom.xml
(added)
+++
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/pom.xml
Sun Jul 11 18:57:26 2010
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.deploy.nmas</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <description>
+ Tests the deployment of a snapshot for a project that has no main artifact
file but only attached artifacts
+ and check whether the attached artifacts get the proper timestamped
version (see MDEPLOY-112).
+ </description>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+
+ <distributionManagement>
+ <repository>
+ <id>it</id>
+ <url>file:///${basedir}/target/repo</url>
+ </repository>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <classifier>it</classifier>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.3</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/setup.bsh
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/setup.bsh?rev=963122&view=auto
==============================================================================
---
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/setup.bsh
(added)
+++
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/setup.bsh
Sun Jul 11 18:57:26 2010
@@ -0,0 +1,14 @@
+import java.io.*;
+import java.util.*;
+
+import org.codehaus.plexus.util.*;
+
+File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/nmas"
);
+System.out.println( "Deleting " + file );
+FileUtils.deleteDirectory( file );
+
+file = new File( basedir, "target/repo" );
+System.out.println( "Deleting " + file );
+FileUtils.deleteDirectory( file );
+
+return true;
Propchange:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/setup.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/setup.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/verify.bsh
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/verify.bsh?rev=963122&view=auto
==============================================================================
---
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/verify.bsh
(added)
+++
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/verify.bsh
Sun Jul 11 18:57:26 2010
@@ -0,0 +1,42 @@
+import java.io.*;
+import java.util.*;
+
+File dir = new File( new File( basedir, "target/repo" ),
"org/apache/maven/its/deploy/nmas/test/1.0-SNAPSHOT" );
+
+String[] files = dir.list();
+
+if ( files == null )
+{
+ throw new FileNotFoundException( "Missing directory: " + dir );
+}
+
+String pom = null, jar = null;
+
+for ( String file : files )
+{
+ if ( file.matches( "test-1\\.0-[0-9]{8}\\.[0-9]{6}-([0-9]+)\\.pom" ) )
+ {
+ pom = file.substring( 0, file.length() - 4 );
+ }
+ if ( file.matches( "test-1\\.0-[0-9]{8}\\.[0-9]{6}-([0-9]+)-it\\.jar" ) )
+ {
+ jar = file.substring( 0, file.length() - 7 );
+ }
+}
+
+if ( pom == null )
+{
+ throw new FileNotFoundException( "Missing timestamped POM" );
+}
+
+if ( jar == null )
+{
+ throw new FileNotFoundException( "Missing timestamped JAR" );
+}
+
+if ( !jar.equals( pom ) )
+{
+ throw new IllegalStateException( "Timestamp mismatch " + jar + " vs " +
pom );
+}
+
+return true;
Propchange:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/verify.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/verify.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified:
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java?rev=963122&r1=963121&r2=963122&view=diff
==============================================================================
---
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
(original)
+++
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
Sun Jul 11 18:57:26 2010
@@ -169,6 +169,9 @@ public class DeployMojo
}
getDeployer().deploy( pomFile, pomArtifact, repo,
getLocalRepository() );
+
+ // propagate the timestamped version to the main artifact
for the attached artifacts to pick it up
+ artifact.setResolvedVersion( pomArtifact.getVersion() );
}
else
{