rfscholte commented on a change in pull request #54: [MNG-4660] Add integration 
test to show that --resume-from works
URL: 
https://github.com/apache/maven-integration-testing/pull/54#discussion_r373371441
 
 

 ##########
 File path: 
core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660ResumeFromTest.java
 ##########
 @@ -0,0 +1,74 @@
+package org.apache.maven.it;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * This is a test case for <a 
href="https://issues.apache.org/jira/browse/MNG-4660";>MNG-4660</a>.
+ *
+ * @author Maarten Mulders
+ * @author Martin Kanters
+ */
+public class MavenITmng4660ResumeFromTest extends 
AbstractMavenIntegrationTestCase {
+    public MavenITmng4660ResumeFromTest()
+    {
+        // TODO Update version range once bug has been fixed!
+        super( "[3.6.3,)" );
+    }
+
+    /**
+     * Test that the --resume-from flag resolves dependencies inside the same 
Maven project
+     * without having them installed first.
+     */
+    public void testIt() throws Exception
+    {
+        final File testDir = ResourceExtractor.simpleExtractResources( 
getClass(), "/mng-4660-resume-from" );
+
+        final Verifier verifier1 = newVerifier( testDir.getAbsolutePath() );
+        verifier1.deleteDirectory( "target" );
+        verifier1.deleteArtifacts( "org.apache.maven.its.mng4660" );
+
+        try
+        {
+            verifier1.executeGoal("verify");
+            fail( "Expected this invocation to fail" ); // See TestCase.java
+        }
+        catch ( final VerificationException ve )
+        {
+            verifier1.verifyTextInLog( "Deliberately fail test case" );
+        }
+        finally
+        {
+            verifier1.resetStreams();
+        }
+
+        final Verifier verifier2 = newVerifier( testDir.getAbsolutePath() );
+        verifier2.setAutoclean( false );
+        verifier2.addCliOption( "--resume-from" );
+        verifier2.addCliOption( ":module-b" );
+        verifier2.executeGoal( "compile" ); // to prevent the unit test from 
failing (again)
 
 Review comment:
   This looks like a mixup of 2 separate issues:
   1. you want to continue and reuse the artifacts that have already been 
build. In that case the goal should be `verify`.
   2. you want to compile module-b, but since Maven hasn't attached its 
artifacts to the reactor, you need to recompile module-a too. In that case I 
would add `verifier2.addCliOption( "--also-make" );`
   
   Both are interesting and don't work right now. 1 is harder (and matches the 
description of the issue), 2 should be reasonably easier and already a huge 
improvement, but requires a separate issue.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to