You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/03/18 13:35:50 UTC

[maven-artifact-transfer] 01/01: [MSHARED-701] - WIP - Remove installation of pom checksum - IT's do not fail o Added a different setup for ITs

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MSHARED-701
in repository https://gitbox.apache.org/repos/asf/maven-artifact-transfer.git

commit af315067c6bfb1e3a10cac721e3109e116e29d81
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Mar 18 14:34:59 2018 +0100

    [MSHARED-701] - WIP - Remove installation of pom checksum - IT's do not fail
     o Added a different setup for ITs
---
 .../project/install/ProjectInstallerTest.java      | 67 ++++++++++++++++++----
 .../src/test/projects/example/pom.xml              |  2 +-
 .../projects/{example => pom-only-example}/pom.xml | 13 +++--
 .../install/internal/DefaultProjectInstaller.java  |  2 +-
 4 files changed, 65 insertions(+), 19 deletions(-)

diff --git a/src/it/maven-project-installer-plugin/src/test/java/org/apache/maven/plugin/project/install/ProjectInstallerTest.java b/src/it/maven-project-installer-plugin/src/test/java/org/apache/maven/plugin/project/install/ProjectInstallerTest.java
index c6b8e2e..1c465a7 100644
--- a/src/it/maven-project-installer-plugin/src/test/java/org/apache/maven/plugin/project/install/ProjectInstallerTest.java
+++ b/src/it/maven-project-installer-plugin/src/test/java/org/apache/maven/plugin/project/install/ProjectInstallerTest.java
@@ -76,6 +76,51 @@ public class ProjectInstallerTest
         result.assertErrorFreeLog();
 
         // Check that the current plugins has been called at least once.
+        result.assertLogText( "[INFO] --- maven-project-installer-plugin:1.0.0:project-installer (id-project-installer) @ maven-project-installer-project-it ---" );
+
+        String mvnVersion = mavenRuntime.getMavenVersion() + "/";
+        // The "." will be replaced by "/" in the running of the artifact-installer-plugin so I need to do the same
+        // here.
+        // Maybe there is a more elegant way to do that?
+        mvnVersion = mvnVersion.replaceAll( "\\.", "/" );
+
+        String mavenRepoLocal = System.getProperty( "maven.repo.local" );
+        File localRepo = new File( mavenRepoLocal );
+
+        System.out.println( "localRepo='" + localRepo.getAbsolutePath() + "'" );
+        System.out.println( "mvnVersion='" + mvnVersion + "'" );
+
+        File baseDirectoy =
+            new File( localRepo,
+                      "PROJECT-INSTALLER-GROUPID-" + mvnVersion + "maven-project-installer-project-it/1.0.0-A/" );
+
+        checkForPomFile( baseDirectoy, "maven-project-installer-project-it" );
+
+        checkForJarFile( baseDirectoy, "maven-project-installer-project-it" );
+
+        checkForJarClassifierFile( baseDirectoy, "maven-project-installer-project-it" );
+
+    }
+
+    @Test
+    public void buildPomOnlyExample()
+        throws Exception
+    {
+        File basedir = resources.getBasedir( "pom-only-example" );
+        //@formatter:off
+        MavenExecutionResult result =
+            mavenRuntime
+                .forProject( basedir )
+                .withCliOption( "-DmvnVersion=" + mavenRuntime.getMavenVersion() ) // Might be superfluous
+                .withCliOption( "-B" )
+                .withCliOption( "-V" )
+                // We use verify to prevent running maven-install-plugin.
+                .execute( "clean", "verify" );
+        //@formatter:on
+
+        result.assertErrorFreeLog();
+
+        // Check that the current plugins has been called at least once.
         result.assertLogText( "[INFO] --- maven-project-installer-plugin:1.0.0:project-installer (id-project-installer) @ maven-project-installer-plugin-it ---" );
 
         String mvnVersion = mavenRuntime.getMavenVersion() + "/";
@@ -92,37 +137,37 @@ public class ProjectInstallerTest
 
         File baseDirectoy =
             new File( localRepo,
-                      "PROJECT-INSTALLER-GROUPID-" + mvnVersion + "maven-project-installer-plugin-it/1.0.0-A/" );
+                      "PROJECT-INSTALLER-GROUPID-MSHARED-701-" + mvnVersion + "maven-project-installer-plugin-it/2.0.701/" );
 
-        checkForPomFile( baseDirectoy );
+        checkForPomFile( baseDirectoy, "maven-project-installer-project-701" );
 
-        checkForJarFile( baseDirectoy );
+        checkForJarFile( baseDirectoy, "maven-project-installer-project-701" );
 
-        checkForJarClassifierFile( baseDirectoy );
+        checkForJarClassifierFile( baseDirectoy, "maven-project-installer-project-701" );
 
     }
 
-    private void checkForJarClassifierFile( File baseDirectoy )
+    private void checkForJarClassifierFile( File baseDirectoy, String baseArtifact )
     {
-        File jarClassifierFile = new File( baseDirectoy, "maven-project-installer-plugin-it-1.0.0-A-classifier.jar" );
+        File jarClassifierFile = new File( baseDirectoy, baseArtifact + "-1.0.0-A-classifier.jar" );
         assertTrue( "jarClassifierFile '" + jarClassifierFile.getAbsolutePath() + "'", jarClassifierFile.exists() );
         assertTrue( "jarClassifier md5 not found.", new File( jarClassifierFile.getAbsolutePath() + ".md5" ).exists() );
         assertTrue( "jarClassifier sha1 not found.",
                     new File( jarClassifierFile.getAbsolutePath() + ".sha1" ).exists() );
     }
 
-    private void checkForJarFile( File baseDirectoy )
+    private void checkForJarFile( File baseDirectoy, String baseArtifact )
     {
-        File jarFile = new File( baseDirectoy, "maven-project-installer-plugin-it-1.0.0-A.jar" );
+        File jarFile = new File( baseDirectoy, baseArtifact + "-1.0.0-A.jar" );
         assertTrue( "jarFile '" + jarFile.getAbsolutePath() + "'", jarFile.exists() );
         assertTrue( "jar md5 not found.", new File( jarFile.getAbsolutePath() + ".md5" ).exists() );
         assertTrue( "jar sha1 not found.", new File( jarFile.getAbsolutePath() + ".sha1" ).exists() );
     }
 
-    private void checkForPomFile( File baseDirectoy )
+    private void checkForPomFile( File baseDirectoy, String baseArtifact )
     {
-        File pomFile = new File( baseDirectoy, "maven-project-installer-plugin-it-1.0.0-A.pom" );
-        assertTrue( "pomFile '" + pomFile.getAbsolutePath() + "'", pomFile.exists() );
+        File pomFile = new File( baseDirectoy, baseArtifact + "-1.0.0-A.pom" );
+        assertTrue( "pomFile not found. '" + pomFile.getAbsolutePath() + "'", pomFile.exists() );
         assertTrue( "pom md5 not found.", new File( pomFile.getAbsolutePath() + ".md5" ).exists() );
         assertTrue( "pom sha1 not found.", new File( pomFile.getAbsolutePath() + ".sha1" ).exists() );
     }
diff --git a/src/it/maven-project-installer-plugin/src/test/projects/example/pom.xml b/src/it/maven-project-installer-plugin/src/test/projects/example/pom.xml
index 03d5e5d..2fa5873 100644
--- a/src/it/maven-project-installer-plugin/src/test/projects/example/pom.xml
+++ b/src/it/maven-project-installer-plugin/src/test/projects/example/pom.xml
@@ -30,7 +30,7 @@
   </parent>
 
   <groupId>PROJECT-INSTALLER-GROUPID-${mvnVersion}</groupId>
-  <artifactId>maven-project-installer-plugin-it</artifactId>
+  <artifactId>maven-project-installer-project-it</artifactId>
   <version>1.0.0-A</version>
 
   <build>
diff --git a/src/it/maven-project-installer-plugin/src/test/projects/example/pom.xml b/src/it/maven-project-installer-plugin/src/test/projects/pom-only-example/pom.xml
similarity index 83%
copy from src/it/maven-project-installer-plugin/src/test/projects/example/pom.xml
copy to src/it/maven-project-installer-plugin/src/test/projects/pom-only-example/pom.xml
index 03d5e5d..5ef07af 100644
--- a/src/it/maven-project-installer-plugin/src/test/projects/example/pom.xml
+++ b/src/it/maven-project-installer-plugin/src/test/projects/pom-only-example/pom.xml
@@ -29,9 +29,10 @@
     <relativePath />
   </parent>
 
-  <groupId>PROJECT-INSTALLER-GROUPID-${mvnVersion}</groupId>
-  <artifactId>maven-project-installer-plugin-it</artifactId>
-  <version>1.0.0-A</version>
+  <groupId>PROJECT-INSTALLER-GROUPID-MSHARED-701</groupId>
+  <artifactId>maven-project-installer-project-701</artifactId>
+  <version>2.0.701</version>
+  <description>Check if installing POM only will fail for current implementation see MSHARED-701</description>
 
   <build>
     <pluginManagement>
@@ -48,7 +49,7 @@
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-project-installer-plugin</artifactId>
+        <artifactId>maven-artifact-installer-plugin</artifactId>
         <version>${it-plugin.version}</version>
         <configuration>
           <localRepositoryPath>${localRepositoryPath}</localRepositoryPath>
@@ -56,9 +57,9 @@
         </configuration>
         <executions>
           <execution>
-            <id>id-project-installer</id>
+            <id>id-artifact-installer</id>
             <goals>
-              <goal>project-installer</goal>
+              <goal>artifact-installer</goal>
             </goals>
           </execution>
         </executions>
diff --git a/src/main/java/org/apache/maven/shared/project/install/internal/DefaultProjectInstaller.java b/src/main/java/org/apache/maven/shared/project/install/internal/DefaultProjectInstaller.java
index 8d643c3..1b62490 100644
--- a/src/main/java/org/apache/maven/shared/project/install/internal/DefaultProjectInstaller.java
+++ b/src/main/java/org/apache/maven/shared/project/install/internal/DefaultProjectInstaller.java
@@ -100,7 +100,7 @@ class DefaultProjectInstaller
             {
                 installer.install( buildingRequest,
                                    Collections.<Artifact>singletonList( new ProjectArtifact( project ) ) );
-                installChecksums( buildingRequest, artifact, createChecksum );
+                // installChecksums( buildingRequest, artifact, createChecksum );
                 addMetaDataFilesForArtifact( buildingRequest, artifact, metadataFiles, createChecksum );
             }
         }

-- 
To stop receiving notification emails like this one, please contact
khmarbaise@apache.org.