[MNG-7024] Rootreactor mismatch causes use of directory instead of file in an artifact
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index 8238b15..aa151a1 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -107,6 +107,7 @@
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng7024SubfolderExecution.class );
suite.addTestSuite( MavenITmng6754TimestampInMultimoduleProject.class );
suite.addTestSuite( MavenITmng6981ProjectListShouldIncludeChildrenTest.class );
suite.addTestSuite( MavenITmng6972AllowAccessToGraphPackageTest.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7024SubfolderExecution.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7024SubfolderExecution.java
new file mode 100644
index 0000000..2032b79
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7024SubfolderExecution.java
@@ -0,0 +1,72 @@
+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 org.apache.maven.shared.utils.io.FileUtils;
+
+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 MavenITmng7024SubfolderExecution extends AbstractMavenIntegrationTestCase {
+ public MavenITmng7024SubfolderExecution()
+ {
+ super( "[4.0.0-alpha-1,)" );
+ }
+
+ /**
+ * Executing from a subfolder, however this folder is NOT part of the rootreactor, hence should not try to bind
+ */
+ public void testShouldIgnoreModuleA() throws Exception
+ {
+ final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7024-subfolderexecution" );
+
+ final Verifier verifier1 = newVerifier( testDir.getAbsolutePath() );
+
+ try
+ {
+ verifier1.executeGoal( "install" );
+
+ verifier1.deleteDirectory( "target" );
+ FileUtils.delete( new File( testDir, "module-a/target/module-a-1.0.jar" ) );
+ }
+ finally
+ {
+ verifier1.resetStreams();
+ }
+ verifier1.assertFilePresent( "module-a/target/classes" );
+ verifier1.assertFileNotPresent( "module-a/target/module-a-1.0.jar" );
+
+ final Verifier verifier2 = newVerifier( new File( testDir, "module-b" ).getAbsolutePath() );
+ verifier2.setAutoclean( false );
+ verifier2.addCliOption( "-fos" );
+ verifier2.addCliOption( "WARN" );
+ verifier2.executeGoal( "package" );
+
+ verifier2.verifyErrorFreeLog();
+ verifier2.resetStreams();
+ }
+
+}
diff --git a/core-it-suite/src/test/resources/mng-7024-subfolderexecution/.mvn/jvm.config b/core-it-suite/src/test/resources/mng-7024-subfolderexecution/.mvn/jvm.config
new file mode 100644
index 0000000..294c1e8
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7024-subfolderexecution/.mvn/jvm.config
@@ -0,0 +1 @@
+-DskipTests=true
\ No newline at end of file
diff --git a/core-it-suite/src/test/resources/mng-7024-subfolderexecution/module-a/pom.xml b/core-it-suite/src/test/resources/mng-7024-subfolderexecution/module-a/pom.xml
new file mode 100644
index 0000000..289f80f
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7024-subfolderexecution/module-a/pom.xml
@@ -0,0 +1,46 @@
+<?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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>module-a</artifactId>
+
+ <parent>
+ <groupId>org.apache.maven.its.mng7024</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.22.0</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-7024-subfolderexecution/module-a/src/main/java/org/apache/maven/it/Example.java b/core-it-suite/src/test/resources/mng-7024-subfolderexecution/module-a/src/main/java/org/apache/maven/it/Example.java
new file mode 100644
index 0000000..1608aba
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7024-subfolderexecution/module-a/src/main/java/org/apache/maven/it/Example.java
@@ -0,0 +1,24 @@
+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.
+ */
+
+public class Example
+{
+}
\ No newline at end of file
diff --git a/core-it-suite/src/test/resources/mng-7024-subfolderexecution/module-b/pom.xml b/core-it-suite/src/test/resources/mng-7024-subfolderexecution/module-b/pom.xml
new file mode 100644
index 0000000..fe12e95
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7024-subfolderexecution/module-b/pom.xml
@@ -0,0 +1,68 @@
+<?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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.its.mng7024</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+ </parent>
+ <artifactId>module-b</artifactId>
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.mng7024</groupId>
+ <artifactId>module-a</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>3.1.0</version>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-7024-subfolderexecution/module-b/src/main/java/org/apache/maven/it/AnotherExample.java b/core-it-suite/src/test/resources/mng-7024-subfolderexecution/module-b/src/main/java/org/apache/maven/it/AnotherExample.java
new file mode 100644
index 0000000..20ab187
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7024-subfolderexecution/module-b/src/main/java/org/apache/maven/it/AnotherExample.java
@@ -0,0 +1,28 @@
+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.
+ */
+
+public class AnotherExample
+{
+ public AnotherExample()
+ {
+ new Example();
+ }
+}
\ No newline at end of file
diff --git a/core-it-suite/src/test/resources/mng-7024-subfolderexecution/pom.xml b/core-it-suite/src/test/resources/mng-7024-subfolderexecution/pom.xml
new file mode 100644
index 0000000..0e3af5a
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7024-subfolderexecution/pom.xml
@@ -0,0 +1,67 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mng7024</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+
+ <packaging>pom</packaging>
+
+ <name>Maven Integration Test :: MNG-7024</name>
+ <description>
+ If executing 'mvn package :module-b' it should NOT try to pick up module-a from the multimodule project
+ because module-b is not part of the rootreactor (it is a profile activated module)
+ </description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ </properties>
+
+ <modules>
+ <module>module-a</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>dist</id>
+ <modules>
+ <module>module-b</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>