maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MINVOKER-224) Unable to set cloneProjectsTo to null
Date Thu, 29 Mar 2018 03:27:00 GMT

    [ https://issues.apache.org/jira/browse/MINVOKER-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16418372#comment-16418372
] 

ASF GitHub Bot commented on MINVOKER-224:
-----------------------------------------

olamy closed pull request #2: MINVOKER-224
URL: https://github.com/apache/maven-invoker-plugin/pull/2
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/it/clone-maven-plugin-packaging/invoker.properties b/src/it/clone-maven-plugin-packaging/invoker.properties
new file mode 100644
index 0000000..f45dd01
--- /dev/null
+++ b/src/it/clone-maven-plugin-packaging/invoker.properties
@@ -0,0 +1,19 @@
+# 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.
+
+# NOTE: Don't clean here to be able to detect test failures
+invoker.goals = initialize
diff --git a/src/it/clone-maven-plugin-packaging/pom.xml b/src/it/clone-maven-plugin-packaging/pom.xml
new file mode 100644
index 0000000..d3f9f85
--- /dev/null
+++ b/src/it/clone-maven-plugin-packaging/pom.xml
@@ -0,0 +1,65 @@
+<?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.plugins.invoker</groupId>
+  <artifactId>clone-maven-plugin-packaging</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>maven-plugin</packaging>
+
+  <description>Test to check for cloned project of packaging maven-plugin.</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+          <cloneClean>true</cloneClean>
+          <pomIncludes>
+            <pomInclude>*/pom.xml</pomInclude>
+          </pomIncludes>
+          <goals>
+            <goal>validate</goal>
+          </goals>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <phase>initialize</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/src/it/clone-maven-plugin-packaging/src/it/clone-clean/pom.xml b/src/it/clone-maven-plugin-packaging/src/it/clone-clean/pom.xml
new file mode 100644
index 0000000..267fcdb
--- /dev/null
+++ b/src/it/clone-maven-plugin-packaging/src/it/clone-clean/pom.xml
@@ -0,0 +1,32 @@
+<?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>test</groupId>
+  <artifactId>clone-clean</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>
diff --git a/src/it/clone-maven-plugin-packaging/verify.bsh b/src/it/clone-maven-plugin-packaging/verify.bsh
new file mode 100644
index 0000000..2ee7280
--- /dev/null
+++ b/src/it/clone-maven-plugin-packaging/verify.bsh
@@ -0,0 +1,31 @@
+/*
+ * 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 java.io.*;
+
+try
+{
+    File itRoot = new File( basedir, "target/it/clone-clean" );
+    return itRoot.exists();
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
diff --git a/src/it/local-repo-default/pom.xml b/src/it/local-repo-default/pom.xml
index d993004..b601efb 100644
--- a/src/it/local-repo-default/pom.xml
+++ b/src/it/local-repo-default/pom.xml
@@ -43,6 +43,7 @@ under the License.
         <artifactId>maven-invoker-plugin</artifactId>
         <version>@pom.version@</version>
         <configuration>
+          <cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo>
           <pomIncludes>
             <pomInclude>*/pom.xml</pomInclude>
           </pomIncludes>
diff --git a/src/it/not-clone-not-plugin/invoker.properties b/src/it/not-clone-not-plugin/invoker.properties
new file mode 100644
index 0000000..f45dd01
--- /dev/null
+++ b/src/it/not-clone-not-plugin/invoker.properties
@@ -0,0 +1,19 @@
+# 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.
+
+# NOTE: Don't clean here to be able to detect test failures
+invoker.goals = initialize
diff --git a/src/it/not-clone-not-plugin/pom.xml b/src/it/not-clone-not-plugin/pom.xml
new file mode 100644
index 0000000..4cf525c
--- /dev/null
+++ b/src/it/not-clone-not-plugin/pom.xml
@@ -0,0 +1,64 @@
+<?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.plugins.invoker</groupId>
+  <artifactId>not-clone-not-a-plugin-invocation</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <description>Test to check for not cloning non maven plugin project.</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <cloneProjectsTo/>
+          <pomIncludes>
+            <pomInclude>*/pom.xml</pomInclude>
+          </pomIncludes>
+          <goals>
+            <goal>validate</goal>
+          </goals>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <phase>initialize</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/src/it/not-clone-not-plugin/src/it/clone-clean/pom.xml b/src/it/not-clone-not-plugin/src/it/clone-clean/pom.xml
new file mode 100644
index 0000000..267fcdb
--- /dev/null
+++ b/src/it/not-clone-not-plugin/src/it/clone-clean/pom.xml
@@ -0,0 +1,32 @@
+<?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>test</groupId>
+  <artifactId>clone-clean</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>
diff --git a/src/it/not-clone-not-plugin/verify.bsh b/src/it/not-clone-not-plugin/verify.bsh
new file mode 100644
index 0000000..b219ae5
--- /dev/null
+++ b/src/it/not-clone-not-plugin/verify.bsh
@@ -0,0 +1,31 @@
+/*
+ * 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 java.io.*;
+
+try
+{
+    File itRoot = new File( basedir, "target/it/clone-clean" );
+    return !itRoot.exists();
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
diff --git a/src/it/script-context/pom.xml b/src/it/script-context/pom.xml
index aed4ce6..6d35a68 100644
--- a/src/it/script-context/pom.xml
+++ b/src/it/script-context/pom.xml
@@ -42,6 +42,7 @@ under the License.
         <artifactId>maven-invoker-plugin</artifactId>
         <version>@project.version@</version>
         <configuration>
+          <cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo>
           <pomIncludes>
             <pomInclude>*/pom.xml</pomInclude>
           </pomIncludes>
diff --git a/src/it/script-errors/pom.xml b/src/it/script-errors/pom.xml
index 6ff883d..124bd90 100644
--- a/src/it/script-errors/pom.xml
+++ b/src/it/script-errors/pom.xml
@@ -43,6 +43,7 @@ under the License.
         <artifactId>maven-invoker-plugin</artifactId>
         <version>@project.version@</version>
         <configuration>
+          <cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo>
           <pomIncludes>
             <pomInclude>*/pom.xml</pomInclude>
           </pomIncludes>
diff --git a/src/it/script-interpreter-detection/pom.xml b/src/it/script-interpreter-detection/pom.xml
index fa46328..b5d5ee1 100644
--- a/src/it/script-interpreter-detection/pom.xml
+++ b/src/it/script-interpreter-detection/pom.xml
@@ -40,6 +40,7 @@ under the License.
         <artifactId>maven-invoker-plugin</artifactId>
         <version>@pom.version@</version>
         <configuration>
+          <cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo>
           <debug>true</debug>
           <pomIncludes>
             <pomInclude>*/pom.xml</pomInclude>
diff --git a/src/it/selector-conditions/pom.xml b/src/it/selector-conditions/pom.xml
index 9397897..c73a245 100644
--- a/src/it/selector-conditions/pom.xml
+++ b/src/it/selector-conditions/pom.xml
@@ -25,7 +25,7 @@ under the License.
   <groupId>org.apache.maven.plugins.invoker</groupId>
   <artifactId>selector-conditions</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>jar</packaging>
+  <packaging>maven-plugin</packaging>
 
   <description>Test to check for selection of builds based on OS and/or JRE.</description>
 
@@ -41,6 +41,7 @@ under the License.
         <version>@pom.version@</version>
         <configuration>
           <debug>true</debug>
+
           <pomIncludes>
             <pomInclude>*/pom.xml</pomInclude>
           </pomIncludes>
diff --git a/src/it/selector-scripts/pom.xml b/src/it/selector-scripts/pom.xml
index 160b593..c3be520 100644
--- a/src/it/selector-scripts/pom.xml
+++ b/src/it/selector-scripts/pom.xml
@@ -40,6 +40,7 @@ under the License.
         <artifactId>maven-invoker-plugin</artifactId>
         <version>@pom.version@</version>
         <configuration>
+          <cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo>
           <debug>true</debug>
           <pomIncludes>
             <pomInclude>*/pom.xml</pomInclude>
diff --git a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
index debba76..97a20a2 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
@@ -19,37 +19,6 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.Writer;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.TreeSet;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Profile;
@@ -57,10 +26,10 @@
 import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.invoker.model.BuildJob;
-import org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Writer;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.invoker.model.BuildJob;
+import org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Writer;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Settings;
 import org.apache.maven.settings.SettingsUtils;
@@ -97,6 +66,39 @@
 import org.codehaus.plexus.util.cli.CommandLineUtils;
 import org.codehaus.plexus.util.cli.Commandline;
 import org.codehaus.plexus.util.cli.StreamConsumer;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
 import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
 
 /**
@@ -175,7 +177,7 @@
      *
      * @since 1.1
      */
-    @Parameter( defaultValue = "${project.build.directory}/its" )
+    @Parameter( property = "invoker.cloneProjectsTo" )
     private File cloneProjectsTo;
 
     // CHECKSTYLE_OFF: LineLength
@@ -683,6 +685,12 @@ public void execute()
             cloneProjects( collectedProjects );
             projectsDir = cloneProjectsTo;
         }
+        if ( cloneProjectsTo == null && "maven-plugin".equals( project.getPackaging()
) )
+        {
+            cloneProjectsTo = new File( project.getBuild().getDirectory(), "its" );
+            cloneProjects( collectedProjects );
+            projectsDir = cloneProjectsTo;
+        }
         else
         {
             getLog().warn( "Filtering of parent/child POMs is not supported without cloning
the projects" );


 

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


> Unable to set cloneProjectsTo to null
> -------------------------------------
>
>                 Key: MINVOKER-224
>                 URL: https://issues.apache.org/jira/browse/MINVOKER-224
>             Project: Maven Invoker Plugin
>          Issue Type: Bug
>    Affects Versions: 3.0.1
>            Reporter: Phillip Webb
>            Assignee: Olivier Lamy (*$^¨%`£)
>            Priority: Major
>             Fix For: 3.0.2
>
>
> [MINVOKER-219|https://issues.apache.org/jira/browse/MINVOKER-219] changed the default
value of {{cloneProjectsTo}} to {{target/its}}. This change unfortunately now makes it impossible
to have a {{null}} value, meaning that in-place invocation is no longer supported. From the
Javadoc:
> {quote}Directory to which projects should be cloned prior to execution. If set to null,
each integration test will be run in the directory in which the corresponding IT POM was found.
In this case, you most likely want to configure your SCM to ignore target and build.log in
the test's base directory.{quote}
> Is it possible to revert this change, or to provide a alternative property to allow cloning
to be skipped?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message