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 2021/05/05 18:25:22 UTC

[maven-gpg-plugin] 01/02: mvn 3.1.1

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

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

commit 33ef92bb468a92ead553313cc85e2febe0c1d602
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Wed May 5 20:21:37 2021 +0200

    mvn 3.1.1
---
 pom.xml                                            | 52 +---------------------
 .../maven/plugins/gpg/SignAndDeployFileMojo.java   | 23 +++++-----
 2 files changed, 14 insertions(+), 61 deletions(-)

diff --git a/pom.xml b/pom.xml
index 6cf4e98..51a3cef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,7 +62,7 @@ under the License.
   </distributionManagement>
 
   <properties>
-    <mavenVersion>3.0</mavenVersion>
+    <mavenVersion>3.1.1</mavenVersion>
     <javaVersion>7</javaVersion>
     <project.build.outputTimestamp>2021-05-05T16:39:01Z</project.build.outputTimestamp>
     <resource.delimiter>@</resource.delimiter>
@@ -110,20 +110,6 @@ under the License.
       <version>0.13.1</version>
     </dependency>
     <dependency>
-      <!-- org.eclipse.aether.util.artifact.SubArtifact -->
-      <groupId>org.apache.maven.resolver</groupId>
-      <artifactId>maven-resolver-util</artifactId>
-      <version>1.4.1</version>
-      <optional>true</optional>
-    </dependency>
-    <dependency>
-      <!-- org.sonatype.aether.util.artifact.SubArtifact -->
-      <groupId>org.sonatype.aether</groupId>
-      <artifactId>aether-util</artifactId>
-      <version>1.13.1</version>
-      <optional>true</optional>
-    </dependency>
-    <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
       <version>3.3.0</version>
@@ -187,42 +173,6 @@ under the License.
         </plugin>
       </plugins>
     </pluginManagement>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>3.2.2</version>
-        <executions>
-          <execution>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <artifactSet>
-                <includes>
-                  <include>org.apache.maven.resolver:maven-resolver-util</include>
-                  <include>org.sonatype.aether:aether-util</include>
-                </includes>
-              </artifactSet>
-              <filters>
-                <filter>
-                  <artifact>org.apache.maven.resolver:maven-resolver-util</artifact>
-                  <includes>
-                    <include>org/eclipse/aether/util/artifact/SubArtifact.class</include>
-                  </includes>
-                </filter>
-                <filter>
-                  <artifact>org.sonatype.aether:aether-util</artifact>
-                  <includes>
-                    <include>org/sonatype/aether/util/artifact/SubArtifact.class</include>
-                  </includes>
-                </filter>
-              </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
   </build>
 
   <profiles>
diff --git a/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java b/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java
index b7bc314..991d2b8 100644
--- a/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java
+++ b/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java
@@ -36,14 +36,13 @@ import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
 import org.apache.maven.artifact.repository.MavenArtifactRepository;
 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.model.InputLocation;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Parent;
 import org.apache.maven.model.building.DefaultModelBuildingRequest;
 import org.apache.maven.model.building.ModelBuildingRequest;
 import org.apache.maven.model.building.ModelProblem;
-import org.apache.maven.model.building.ModelProblem.Severity;
 import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.building.ModelProblemCollectorRequest;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
 import org.apache.maven.model.validation.ModelValidator;
@@ -585,7 +584,7 @@ public class SignAndDeployFileMojo
                     
         List<String> result = new ArrayList<>();
 
-        SimpleModelProblemCollector problemCollector = new SimpleModelProblemCollector( result );
+        ModelProblemCollector problemCollector = new SimpleModelProblemCollector( result );
 
         modelValidator.validateEffectiveModel( model, request, problemCollector );
 
@@ -594,7 +593,7 @@ public class SignAndDeployFileMojo
             StringBuilder msg = new StringBuilder( "The artifact information is incomplete or not valid:\n" );
             for ( String e : result )
             {
-                msg.append( " - " + e + '\n' );
+                msg.append( " - " ).append( e ).append( '\n' );
             }
             throw new MojoFailureException( msg.toString() );
         }
@@ -648,9 +647,8 @@ public class SignAndDeployFileMojo
                 }
                 deployer.deploy( buildingRequest, deploymentRepository, Collections.singletonList( artifact ) );
 
-                for ( Object o : artifact.getMetadataList() )
+                for ( ArtifactMetadata metadata : artifact.getMetadataList() )
                 {
-                    ArtifactMetadata metadata = (ArtifactMetadata) o;
                     getLog().info( "Metadata[" + metadata.getKey() + "].filename = " + metadata.getRemoteFilename() );
                 }
                 exception = null;
@@ -692,13 +690,18 @@ public class SignAndDeployFileMojo
             this.result = result;
         }
 
-        public void add( Severity severity, String message, InputLocation location, Exception cause )
+        /**
+         * Adds the specified problem.
+         *
+         * @param req must not be null
+         */
+        @Override
+        public void add( ModelProblemCollectorRequest req )
         {
-            if ( !ModelProblem.Severity.WARNING.equals( severity ) )
+            if ( !req.getSeverity().equals( ModelProblem.Severity.WARNING ) )
             {
-                result.add( message );
+                result.add( req.getMessage() );
             }
         }
-
     }
 }