michael-o commented on a change in pull request #2:
URL: https://github.com/apache/maven-studies/pull/2#discussion_r500152875



##########
File path: src/main/java/org/apache/maven/plugins/sign/SignMojo.java
##########
@@ -0,0 +1,210 @@
+package org.apache.maven.plugins.sign;
+
+/*
+ * 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 org.apache.maven.artifact.Artifact;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.sign.pgp.PGPSigner;
+import org.apache.maven.plugins.sign.pgp.PGPSignerException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+import org.apache.maven.project.artifact.ProjectArtifact;
+import org.eclipse.aether.transform.FileTransformer;
+import org.eclipse.aether.transform.TransformException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Sign project artifacts.
+ *
+ * @author Slawomir Jaranowski
+ */
+@Mojo( name = "sign", defaultPhase = LifecyclePhase.VERIFY )
+public class SignMojo extends AbstractMojo
+{
+
+    private static final Logger LOGGER = LoggerFactory.getLogger( 
SignMojo.class );
+
+    @Parameter( defaultValue = "${project}", readonly = true, required = true )
+    private MavenProject project;
+
+    @Parameter( defaultValue = "${session}", required = true, readonly = true )
+    protected MavenSession session;
+
+    @Parameter( property = "sign.keyId" )
+    private String keyId;
+
+    @Parameter( required = true, property = "sign.keyPassphrase" )
+    private String keyPassphrase;
+
+    @Parameter( required = true, property = "sign.keyFile" )
+    private File keyFile;
+
+    @Inject
+    private MavenProjectHelper projectHelper;
+
+    private PGPSigner pgpSigner;
+
+    @Override
+    public void execute() throws MojoExecutionException
+    {
+        try
+        {
+            pgpSigner = new PGPSigner( new PGPSecretKeyInfoFromParams( keyId, 
keyPassphrase, keyFile ) );
+        }
+        catch ( PGPSignerException e )
+        {
+            throw new MojoExecutionException( e.getMessage(), e );

Review comment:
       Argggggggg...really ugly. So you have no option :-(




----------------------------------------------------------------
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.

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


Reply via email to