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/04/09 04:37:45 UTC

[maven-dependency-plugin] branch MDEP-425 created (now 4d2efe2)

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

slachiewicz pushed a change to branch MDEP-425
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git.


      at 4d2efe2  [MDEP-425] Add list-plugin-repositories goal

This branch includes the following new commits:

     new 4d2efe2  [MDEP-425] Add list-plugin-repositories goal

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-dependency-plugin] 01/01: [MDEP-425] Add list-plugin-repositories goal

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

slachiewicz pushed a commit to branch MDEP-425
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git

commit 4d2efe2f41e57c622e3d8ddd81f5841c82690aa0
Author: Matt Nelson <ma...@cerner.com>
AuthorDate: Fri Aug 17 13:59:30 2018 -0500

    [MDEP-425] Add list-plugin-repositories goal
---
 .../list-plugin-repositories/invoker.properties    | 18 ++++++
 src/it/projects/list-plugin-repositories/pom.xml   | 47 +++++++++++++++
 .../resolvers/ListPluginRepositoriesMojo.java      | 66 ++++++++++++++++++++++
 3 files changed, 131 insertions(+)

diff --git a/src/it/projects/list-plugin-repositories/invoker.properties b/src/it/projects/list-plugin-repositories/invoker.properties
new file mode 100644
index 0000000..f88ba5b
--- /dev/null
+++ b/src/it/projects/list-plugin-repositories/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}:list-plugin-repositories
diff --git a/src/it/projects/list-plugin-repositories/pom.xml b/src/it/projects/list-plugin-repositories/pom.xml
new file mode 100644
index 0000000..e871ea8
--- /dev/null
+++ b/src/it/projects/list-plugin-repositories/pom.xml
@@ -0,0 +1,47 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.dependency</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Test</name>
+  <description>
+    Test dependency:list-plugin-repositories
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ListPluginRepositoriesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ListPluginRepositoriesMojo.java
new file mode 100644
index 0000000..b4e16e8
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ListPluginRepositoriesMojo.java
@@ -0,0 +1,66 @@
+package org.apache.maven.plugins.dependency.resolvers;
+
+/*
+ * 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.util.List;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
+
+/**
+ * Goal that resolves all project plugins and then lists the plugin
+ * repositories used by the build and by the transitive plugins
+ *
+ * @since 3.2
+ */
+@Mojo( name = "list-plugin-repositories", threadSafe = true )
+public class ListPluginRepositoriesMojo
+    extends AbstractResolveMojo
+{
+
+    @Parameter( defaultValue = "${project.pluginArtifactRepositories}", readonly = true, required = true )
+    private List<ArtifactRepository> remotePluginRepositories;
+   
+    /**
+     * Displays a list of the plugin repositories used by this build.
+     *
+     * @throws MojoExecutionException with a message if an error occurs.
+     */
+    @Override
+    protected void doExecute()
+        throws MojoExecutionException
+    {
+        this.getLog().info( "Plugin repositories used by this build:" );
+
+        for ( ArtifactRepository repo : remotePluginRepositories )
+        {
+            this.getLog().info( repo.toString() );
+        }
+    }
+
+    @Override
+    protected ArtifactsFilter getMarkedArtifactFilter()
+    {
+        return null;
+    }
+}