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 2026/09/11 22:16:43 UTC
(maven-plugin-tools) 01/10: MPLUGIN-421: Add comment-only source reproducer
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch maven-plugin-tools-3.x
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git
commit 88f504de7133fa6bf7966259168743afd5f2334a
Author: Vaclav Haisman <vh...@gmail.com>
AuthorDate: Fri Aug 7 22:07:07 2026 +0200
MPLUGIN-421: Add comment-only source reproducer
(cherry picked from commit 35c816d49c9ad2aa00152938e2336a41f8a77270)
---
.../src/it/mplugin-421/invoker.properties | 18 +++++
maven-plugin-plugin/src/it/mplugin-421/pom.xml | 77 ++++++++++++++++++++++
.../apache/maven/plugin/coreit/CommentOnly.java | 20 ++++++
.../org/apache/maven/plugin/coreit/HelloMojo.java | 32 +++++++++
.../src/it/mplugin-421/verify.groovy | 32 +++++++++
pom.xml | 2 +
6 files changed, 181 insertions(+)
diff --git a/maven-plugin-plugin/src/it/mplugin-421/invoker.properties b/maven-plugin-plugin/src/it/mplugin-421/invoker.properties
new file mode 100644
index 00000000..a5ed592b
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-421/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 = clean verify
diff --git a/maven-plugin-plugin/src/it/mplugin-421/pom.xml b/maven-plugin-plugin/src/it/mplugin-421/pom.xml
new file mode 100644
index 00000000..2321a47f
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-421/pom.xml
@@ -0,0 +1,77 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mplugin-421</groupId>
+ <artifactId>mplugin-421</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <name>Maven Integration Test :: mplugin-421</name>
+ <description>Checks that comment-only Java sources do not prevent plugin descriptor generation.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>@maven3Version@</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>@project.version@</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>@version.maven-compiler-plugin@</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <goalPrefix>mplugin421</goalPrefix>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/maven-plugin-plugin/src/it/mplugin-421/src/main/java/org/apache/maven/plugin/coreit/CommentOnly.java b/maven-plugin-plugin/src/it/mplugin-421/src/main/java/org/apache/maven/plugin/coreit/CommentOnly.java
new file mode 100644
index 00000000..7d50ac21
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-421/src/main/java/org/apache/maven/plugin/coreit/CommentOnly.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+// This file intentionally contains no Java declaration.
diff --git a/maven-plugin-plugin/src/it/mplugin-421/src/main/java/org/apache/maven/plugin/coreit/HelloMojo.java b/maven-plugin-plugin/src/it/mplugin-421/src/main/java/org/apache/maven/plugin/coreit/HelloMojo.java
new file mode 100644
index 00000000..c2b7a2fa
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-421/src/main/java/org/apache/maven/plugin/coreit/HelloMojo.java
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugins.annotations.Mojo;
+
+/** Says hello. */
+@Mojo(name = "hello")
+public class HelloMojo extends AbstractMojo {
+
+ @Override
+ public void execute() {
+ getLog().info("Hello");
+ }
+}
diff --git a/maven-plugin-plugin/src/it/mplugin-421/verify.groovy b/maven-plugin-plugin/src/it/mplugin-421/verify.groovy
new file mode 100644
index 00000000..df29f2e1
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-421/verify.groovy
@@ -0,0 +1,32 @@
+/*
+ * 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 groovy.xml.XmlParser
+
+File descriptorFile = new File( basedir, "target/classes/META-INF/maven/plugin.xml" )
+assert descriptorFile.isFile()
+
+def pluginDescriptor = new XmlParser().parse( descriptorFile )
+def mojo = pluginDescriptor.mojos.mojo.find { it.goal.text() == "hello" }
+
+assert mojo != null
+assert mojo.implementation.text() == "org.apache.maven.plugin.coreit.HelloMojo"
+assert mojo.description.text() == "Says hello."
+
+return true
diff --git a/pom.xml b/pom.xml
index 0bc0e0b1..2a5eee52 100644
--- a/pom.xml
+++ b/pom.xml
@@ -368,6 +368,8 @@
</includes>
<excludes>
<exclude>**/it/source-encoding/</exclude>
+ <!-- Intentionally contains no type declaration (MPLUGIN-421). -->
+ <exclude>**/it/mplugin-421/**/CommentOnly.java</exclude>
</excludes>
</java>
</configuration>