maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1597206 - in /maven/shared/trunk/maven-dependency-tree/src/it/reactor: resolve-extension/src/main/java/org/apache/maven/its/deptree/ResolveDependenciesLifecycleParticipant.java setup.bsh verify.bsh
Date Fri, 23 May 2014 22:40:21 GMT
Author: hboutemy
Date: Fri May 23 22:40:20 2014
New Revision: 1597206

URL: http://svn.apache.org/r1597206
Log:
hardened checks

Modified:
    maven/shared/trunk/maven-dependency-tree/src/it/reactor/resolve-extension/src/main/java/org/apache/maven/its/deptree/ResolveDependenciesLifecycleParticipant.java
    maven/shared/trunk/maven-dependency-tree/src/it/reactor/setup.bsh
    maven/shared/trunk/maven-dependency-tree/src/it/reactor/verify.bsh

Modified: maven/shared/trunk/maven-dependency-tree/src/it/reactor/resolve-extension/src/main/java/org/apache/maven/its/deptree/ResolveDependenciesLifecycleParticipant.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-tree/src/it/reactor/resolve-extension/src/main/java/org/apache/maven/its/deptree/ResolveDependenciesLifecycleParticipant.java?rev=1597206&r1=1597205&r2=1597206&view=diff
==============================================================================
--- maven/shared/trunk/maven-dependency-tree/src/it/reactor/resolve-extension/src/main/java/org/apache/maven/its/deptree/ResolveDependenciesLifecycleParticipant.java
(original)
+++ maven/shared/trunk/maven-dependency-tree/src/it/reactor/resolve-extension/src/main/java/org/apache/maven/its/deptree/ResolveDependenciesLifecycleParticipant.java
Fri May 23 22:40:20 2014
@@ -28,6 +28,7 @@ import org.apache.maven.shared.dependenc
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.FileUtils;
 
 import java.io.File;
 import java.io.IOException;
@@ -70,19 +71,33 @@ public final class ResolveDependenciesLi
             File resolved = new File( basedir, "resolved-" + project.getArtifactId() + ".txt"
);
             try
             {
+                log.info( "building with reactor projects" );
                 // No need to filter our search. We want to resolve all artifacts.
                 dependencyGraphBuilder.buildDependencyGraph( project, null, projects );
-
-                // proof that resolution has happened
-                resolved.createNewFile();
             }
             catch ( DependencyGraphBuilderException e )
             {
                 throw new MavenExecutionException( "Could not resolve dependencies for project:
" + project, e );
             }
-            catch ( IOException e )
+
+            try
             {
-                throw new MavenExecutionException( "Could not create " + resolved, e );
+                log.info( "building without reactor projects" );
+                // resolution without reactor projects, to check that it is not possible
at this point
+                dependencyGraphBuilder.buildDependencyGraph( project, null );
+            }
+            catch ( DependencyGraphBuilderException e )
+            {
+                log.info( "expected resolution failure: " + e.getMessage() );
+
+                try
+                {
+                    FileUtils.fileWrite( resolved.getAbsolutePath(), e.getMessage() );
+                }
+                catch ( IOException ioe )
+                {
+                    throw new MavenExecutionException( "Could not write " + resolved, ioe
);
+                }
             }
         }
 

Modified: maven/shared/trunk/maven-dependency-tree/src/it/reactor/setup.bsh
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-tree/src/it/reactor/setup.bsh?rev=1597206&r1=1597205&r2=1597206&view=diff
==============================================================================
--- maven/shared/trunk/maven-dependency-tree/src/it/reactor/setup.bsh (original)
+++ maven/shared/trunk/maven-dependency-tree/src/it/reactor/setup.bsh Fri May 23 22:40:20
2014
@@ -25,7 +25,19 @@ files = FileUtils.getFiles( basedir, "re
 
 while ( files.hasNext() )
 {
-  files.next().delete();
+  file = files.next();
+  System.out.println( "deleting file " + file );
+  file.delete();
+}
+
+// delete modules from local repository
+files = FileUtils.getDirectoryNames( new File( basedir, "../.." ), "local-repo/org/apache/maven/its/dependency-tree/module*",
"", true ).iterator();
+
+while ( files.hasNext() )
+{
+  file = new File( files.next() );
+  System.out.println( "deleting directory " + file );
+  FileUtils.deleteDirectory( file );
 }
 
 return true;

Modified: maven/shared/trunk/maven-dependency-tree/src/it/reactor/verify.bsh
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-tree/src/it/reactor/verify.bsh?rev=1597206&r1=1597205&r2=1597206&view=diff
==============================================================================
--- maven/shared/trunk/maven-dependency-tree/src/it/reactor/verify.bsh (original)
+++ maven/shared/trunk/maven-dependency-tree/src/it/reactor/verify.bsh Fri May 23 22:40:20
2014
@@ -34,9 +34,11 @@ if ( !actual.equals( expected ) )
     throw new Exception( "Unexpected dependency tree" );
 }
 
-if ( !new File( basedir, "resolved-module-z-deps-y.txt" ).exists() )
+String resolved = FileUtils.fileRead( new File( basedir, "resolved-module-z-deps-y.txt" )
);
+
+if ( !"Could not resolve the following dependencies: [org.apache.maven.its.dependency-tree:module-y-deps-x:jar:1.0-SNAPSHOT
(compile), org.apache.maven.its.dependency-tree:module-x:jar:1.0-SNAPSHOT (compile)]".equals(
resolved ) )
 {
-    throw new Exception( "resolved-module-z-deps-y.txt was not written by ResolveDependenciesLifecycleParticipant"
);
+    throw new Exception( "unexpected content in resolved-module-z-deps-y.txt written by ResolveDependenciesLifecycleParticipant"
);
 }
 
 return true;



Mime
View raw message