You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2020/07/03 09:14:03 UTC

[maven-help-plugin] branch MPH-164 created (now a777d5f)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch MPH-164
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git.


      at a777d5f  [MPH-164] - Effective-pom ignores artifact argument Set the projects argument to only contain the wanted artifact to avoid processing the local pom when the artifact argument has been provided.

This branch includes the following new commits:

     new a777d5f  [MPH-164] - Effective-pom ignores artifact argument Set the projects argument to only contain the wanted artifact to avoid processing the local pom when the artifact argument has been provided.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-help-plugin] 01/01: [MPH-164] - Effective-pom ignores artifact argument Set the projects argument to only contain the wanted artifact to avoid processing the local pom when the artifact argument has been provided.

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MPH-164
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git

commit a777d5f10ff6336d38dfa690128d7e07f9becf0f
Author: Christian Lindblom <cr...@croister.se>
AuthorDate: Mon Mar 9 15:36:39 2020 +0100

    [MPH-164] - Effective-pom ignores artifact argument
    Set the projects argument to only contain the wanted artifact to
    avoid processing the local pom when the artifact argument
    has been provided.
---
 .../invoker.properties                             | 18 ++++++++++
 .../module/pom.xml                                 | 23 ++++++++++++
 src/it/effective-pom-multimodule-artifact/pom.xml  | 41 ++++++++++++++++++++++
 .../test.properties                                | 19 ++++++++++
 .../verify.groovy                                  | 30 ++++++++++++++++
 .../maven/plugins/help/EffectivePomMojo.java       |  2 ++
 6 files changed, 133 insertions(+)

diff --git a/src/it/effective-pom-multimodule-artifact/invoker.properties b/src/it/effective-pom-multimodule-artifact/invoker.properties
new file mode 100644
index 0000000..adecbad
--- /dev/null
+++ b/src/it/effective-pom-multimodule-artifact/invoker.properties
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:effective-pom
diff --git a/src/it/effective-pom-multimodule-artifact/module/pom.xml b/src/it/effective-pom-multimodule-artifact/module/pom.xml
new file mode 100644
index 0000000..0a041ec
--- /dev/null
+++ b/src/it/effective-pom-multimodule-artifact/module/pom.xml
@@ -0,0 +1,23 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.maven.its.help</groupId>
+    <artifactId>test</artifactId>
+    <version>1.0</version>
+  </parent>
+  <packaging>pom</packaging>
+  <artifactId>module</artifactId>
+</project>
diff --git a/src/it/effective-pom-multimodule-artifact/pom.xml b/src/it/effective-pom-multimodule-artifact/pom.xml
new file mode 100644
index 0000000..bf048a5
--- /dev/null
+++ b/src/it/effective-pom-multimodule-artifact/pom.xml
@@ -0,0 +1,41 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.help</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+  <url>https://issues.apache.org/jira/browse/MPH-105</url>
+  <description>
+    Tests that the effective POM goal in a multi-module project prints the effective POM of all projects in the reactor
+  </description>
+  <modules>
+    <module>module</module>
+  </modules>
+
+  <build>
+    <plugins>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/effective-pom-multimodule-artifact/test.properties b/src/it/effective-pom-multimodule-artifact/test.properties
new file mode 100644
index 0000000..037f045
--- /dev/null
+++ b/src/it/effective-pom-multimodule-artifact/test.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.
+
+output = result.txt
+artifact = org.apache.maven.plugins:maven-help-plugin
diff --git a/src/it/effective-pom-multimodule-artifact/verify.groovy b/src/it/effective-pom-multimodule-artifact/verify.groovy
new file mode 100644
index 0000000..fae54ad
--- /dev/null
+++ b/src/it/effective-pom-multimodule-artifact/verify.groovy
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+String content = new File( basedir, "build.log" ).text
+assert content.indexOf( "<projects>" ) == -1
+
+def result = new File(basedir, 'result.txt');
+assert result.exists()
+
+def LS = System.getProperty("line.separator")
+assert result.text.find('(?s)' +
+        '  <groupId>org.apache.maven.plugins</groupId>' + LS +
+        '  <artifactId>maven-help-plugin</artifactId>'
+) != null
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java b/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java
index 144f247..eb94595 100644
--- a/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java
@@ -24,6 +24,7 @@ import java.io.StringWriter;
 import java.io.Writer;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
@@ -111,6 +112,7 @@ public class EffectivePomMojo
         if ( StringUtils.isNotEmpty( artifact ) )
         {
             project = getMavenProject( artifact );
+            projects = Collections.singletonList( project );
         }
 
         StringWriter w = new StringWriter();