You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "mthmulders (via GitHub)" <gi...@apache.org> on 2023/05/28 18:06:58 UTC

[GitHub] [maven-toolchains-plugin] mthmulders commented on a diff in pull request #14: Add a mojo to display discovered toolchains

mthmulders commented on code in PR #14:
URL: https://github.com/apache/maven-toolchains-plugin/pull/14#discussion_r1208596301


##########
pom.xml:
##########
@@ -67,28 +67,66 @@ under the License.
   </distributionManagement>
 
   <properties>
-    <javaVersion>8</javaVersion>
-    <mavenVersion>3.2.5</mavenVersion>
+    <maven.compiler.target>11</maven.compiler.target>
+    <mavenVersion>4.0.0-alpha-6-SNAPSHOT</mavenVersion>
     <project.build.outputTimestamp>2022-06-18T21:03:59Z</project.build.outputTimestamp>
   </properties>
 
   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-plugin-api</artifactId>
+      <artifactId>maven-api-core</artifactId>
       <version>${mavenVersion}</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-core</artifactId>
+      <artifactId>maven-toolchain-builder</artifactId>
       <version>${mavenVersion}</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.plugin-tools</groupId>
       <artifactId>maven-plugin-annotations</artifactId>
+      <version>3.8.1</version>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.eclipse.sisu</groupId>
+      <artifactId>org.eclipse.sisu.plexus</artifactId>
+      <version>0.9.0.M2</version>
+    </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <version>3.8.1</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <version>3.5.0</version>
+      </plugin>
+      <plugin>

Review Comment:
   I'm afraid that adding this plugin in a PR that adds functionality makes our Git history hard to track down. If I'm not mistaken, I see a lot of changes in this PR that aren't necessary for the new Mojo, but are required by Spotless. Would it be possible to introduce Spotless in a separate PR, and add the commit that merges it to a **.git-blame-ignore-revs** file like we did for Maven itself?



##########
src/main/java/org/apache/maven/plugins/toolchain/DisplayDiscoveredToolchainsMojo.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.plugins.toolchain;
+
+import java.io.StringWriter;
+
+import org.apache.maven.api.Session;
+import org.apache.maven.api.plugin.MojoException;
+import org.apache.maven.api.plugin.annotations.Component;
+import org.apache.maven.api.plugin.annotations.Mojo;
+import org.apache.maven.api.services.xml.ToolchainsXmlFactory;
+import org.apache.maven.api.toolchain.PersistedToolchains;
+import org.apache.maven.toolchain.discovery.ToolchainDiscoverer;
+
+@Mojo(name = "display-discovered-toolchains", requiresProject = false)

Review Comment:
   With this name, I'd expect the goal to print a human-readable list of toolchains.
   
   On the other hand, I think there's a lot of value in generating the **toolchains.xml** (as this Mojo currently does), but I'd expect that goal to be something like `generate-toolchains-xml`.
   
   How would you feel about having two goals for those two use cases?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org