1 package org.apache.maven.it;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.io.File;
23
24 import org.apache.maven.it.util.ResourceExtractor;
25
26 public class MavenITmng5591WorkspaceReader
27 extends AbstractMavenIntegrationTestCase
28 {
29 public MavenITmng5591WorkspaceReader()
30 {
31 super( "[3.1.0,)" );
32 }
33
34 public void testWorkspaceReader()
35 throws Exception
36 {
37 /*
38 * The point of this test is to validate that ide WorkspaceReader, like one used by m2e, does not interfere with
39 * reactor dependency resolution. The test comes in two parts. mng-5591-workspace-reader/extension is noop
40 * WorkspaceReader implementation and mng-5591-workspace-reader/basic is a multimodule project with inter-module
41 * dependencies. The workspace reader extension is injected in maven runtime with -Dmaven.ext.class.path command
42 * line argument. The multimodule build fails unless reactor resolution works properly.
43 */
44
45 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5591-workspace-reader" );
46 File extensionDir = new File( testDir, "extension" );
47 File projectDir = new File( testDir, "basic" );
48
49 Verifier verifier;
50
51 // install the test extension
52 verifier = newVerifier( extensionDir.getAbsolutePath(), "remote" );
53 verifier.executeGoal( "install" );
54 verifier.resetStreams();
55 verifier.verifyErrorFreeLog();
56
57 // compile the test project
58 verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
59 verifier.addCliOption( "-Dmaven.ext.class.path="
60 + new File( extensionDir, "target/mng-5591-workspace-reader-extension-0.1.jar" ).getCanonicalPath() );
61 verifier.executeGoal( "compile" );
62 verifier.resetStreams();
63 verifier.verifyErrorFreeLog();
64 }
65
66 }