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 2022/04/22 21:05:22 UTC

[maven-archiver] branch master updated (57b34eb -> ea2396b)

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

slachiewicz pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-archiver.git


    from 57b34eb  Require Java 8
     add 7769e4e  Bump junit to 5.8.3
     new c9d80f5  [MSHARED-991] small code cleanup and javadoc:fix
     new ea2396b  [MSHARED-1003] Require Maven 3.2.5+

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


Summary of changes:
 pom.xml                                            |  33 ++----
 .../maven/archiver/ManifestConfiguration.java      |  61 ++++++++--
 .../org/apache/maven/archiver/ManifestSection.java |  13 +++
 .../maven/archiver/MavenArchiveConfiguration.java  |  52 ++++++++-
 .../org/apache/maven/archiver/MavenArchiver.java   | 123 ++++++++++++---------
 .../apache/maven/archiver/PomPropertiesUtil.java   |  16 ++-
 .../maven/archiver/ManifestConfigurationTest.java  |   8 +-
 .../archiver/MavenArchiveConfigurationTest.java    |  14 +--
 .../apache/maven/archiver/MavenArchiverTest.java   |  33 +++---
 .../org/apache/maven/archiver/MockArtifact.java    |   4 +-
 10 files changed, 232 insertions(+), 125 deletions(-)


[maven-archiver] 01/02: [MSHARED-991] small code cleanup and javadoc:fix

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

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

commit c9d80f54ea9b21b2c7818d9f0895a43c6cb3acf4
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Fri Apr 22 00:54:32 2022 +0200

    [MSHARED-991] small code cleanup and javadoc:fix
---
 .../maven/archiver/ManifestConfiguration.java      |  61 ++++++++--
 .../org/apache/maven/archiver/ManifestSection.java |  13 +++
 .../maven/archiver/MavenArchiveConfiguration.java  |  52 ++++++++-
 .../org/apache/maven/archiver/MavenArchiver.java   | 123 ++++++++++++---------
 .../apache/maven/archiver/PomPropertiesUtil.java   |  16 ++-
 .../apache/maven/archiver/MavenArchiverTest.java   |  13 +--
 .../org/apache/maven/archiver/MockArtifact.java    |   4 +-
 7 files changed, 201 insertions(+), 81 deletions(-)

diff --git a/src/main/java/org/apache/maven/archiver/ManifestConfiguration.java b/src/main/java/org/apache/maven/archiver/ManifestConfiguration.java
index 02e0f6b..b34c503 100644
--- a/src/main/java/org/apache/maven/archiver/ManifestConfiguration.java
+++ b/src/main/java/org/apache/maven/archiver/ManifestConfiguration.java
@@ -91,6 +91,8 @@ public class ManifestConfiguration
     private boolean useUniqueVersions = true;
 
     /**
+     * <p>Getter for the field <code>mainClass</code>.</p>
+     *
      * @return mainClass
      */
     public String getMainClass()
@@ -99,6 +101,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>Getter for the field <code>packageName</code>.</p>
+     *
      * @return the package name.
      */
     public String getPackageName()
@@ -107,6 +111,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>isAddClasspath.</p>
+     *
      * @return if addClasspath true or false.
      */
     public boolean isAddClasspath()
@@ -115,6 +121,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>isAddDefaultEntries.</p>
+     *
      * @return {@link #addDefaultEntries}
      */
     public boolean isAddDefaultEntries()
@@ -123,6 +131,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>isAddBuildEnvironmentEntries.</p>
+     *
      * @return {@link #addBuildEnvironmentEntries}
      */
     public boolean isAddBuildEnvironmentEntries()
@@ -131,6 +141,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>isAddDefaultImplementationEntries.</p>
+     *
      * @return {@link #addDefaultImplementationEntries}
      */
     public boolean isAddDefaultImplementationEntries()
@@ -139,6 +151,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>isAddDefaultSpecificationEntries.</p>
+     *
      * @return {@link #addDefaultSpecificationEntries}
      */
     public boolean isAddDefaultSpecificationEntries()
@@ -147,6 +161,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>isAddExtensions.</p>
+     *
      * @return {@link #addExtensions}
      */
     public boolean isAddExtensions()
@@ -155,6 +171,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>addClasspath</code>.</p>
+     *
      * @param addClasspath turn on addClasspath or off.
      */
     public void setAddClasspath( boolean addClasspath )
@@ -163,6 +181,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>addDefaultEntries</code>.</p>
+     *
      * @param addDefaultEntries add default entries true/false.
      */
     public void setAddDefaultEntries( boolean addDefaultEntries )
@@ -171,6 +191,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>addBuildEnvironmentEntries</code>.</p>
+     *
      * @param addBuildEnvironmentEntries add build environment information true/false.
      */
     public void setAddBuildEnvironmentEntries( boolean addBuildEnvironmentEntries )
@@ -179,6 +201,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>addDefaultImplementationEntries</code>.</p>
+     *
      * @param addDefaultImplementationEntries true to add default implementations false otherwise.
      */
     public void setAddDefaultImplementationEntries( boolean addDefaultImplementationEntries )
@@ -187,6 +211,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>addDefaultSpecificationEntries</code>.</p>
+     *
      * @param addDefaultSpecificationEntries add default specifications true/false.
      */
     public void setAddDefaultSpecificationEntries( boolean addDefaultSpecificationEntries )
@@ -195,6 +221,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>addExtensions</code>.</p>
+     *
      * @param addExtensions true to add extensions false otherwise.
      */
     public void setAddExtensions( boolean addExtensions )
@@ -203,6 +231,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>classpathPrefix</code>.</p>
+     *
      * @param classpathPrefix The prefix.
      */
     public void setClasspathPrefix( String classpathPrefix )
@@ -211,6 +241,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>mainClass</code>.</p>
+     *
      * @param mainClass The main class.
      */
     public void setMainClass( String mainClass )
@@ -219,6 +251,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>packageName</code>.</p>
+     *
      * @param packageName The package name.
      */
     public void setPackageName( String packageName )
@@ -227,6 +261,8 @@ public class ManifestConfiguration
     }
 
     /**
+     * <p>Getter for the field <code>classpathPrefix</code>.</p>
+     *
      * @return The classpath prefix.
      */
     public String getClasspathPrefix()
@@ -247,7 +283,8 @@ public class ManifestConfiguration
      * 'repository' (CLASSPATH_LAYOUT_TYPE_REPOSITORY, or the same as a maven classpath layout), and 'custom'
      * (CLASSPATH_LAYOUT_TYPE_CUSTOM). <br>
      * <b>NOTE:</b> If you specify a type of 'custom' you MUST set
-     * {@link ManifestConfiguration#setCustomClasspathLayout(String)}.
+     * {@link org.apache.maven.archiver.ManifestConfiguration#setCustomClasspathLayout(String)}.
+     *
      * @return The classpath layout type.
      */
     public String getClasspathLayoutType()
@@ -259,9 +296,10 @@ public class ManifestConfiguration
      * Set the type of layout to use when formatting classpath entries. Should be one of: 'simple'
      * (CLASSPATH_LAYOUT_TYPE_SIMPLE), 'repository' (CLASSPATH_LAYOUT_TYPE_REPOSITORY, or the same as a maven classpath
      * layout), and 'custom' (CLASSPATH_LAYOUT_TYPE_CUSTOM). The constant names noted here are defined in the
-     * {@link ManifestConfiguration} class. <br>
+     * {@link org.apache.maven.archiver.ManifestConfiguration} class. <br>
      * <b>NOTE:</b> If you specify a type of 'custom' you MUST set
-     * {@link ManifestConfiguration#setCustomClasspathLayout(String)}.
+     * {@link org.apache.maven.archiver.ManifestConfiguration#setCustomClasspathLayout(String)}.
+     *
      * @param classpathLayoutType The classpath layout type.
      */
     public void setClasspathLayoutType( String classpathLayoutType )
@@ -271,7 +309,8 @@ public class ManifestConfiguration
 
     /**
      * Retrieve the layout expression for use when the layout type set in
-     * {@link ManifestConfiguration#setClasspathLayoutType(String)} has the value 'custom'. <b>The default value is
+     * {@link org.apache.maven.archiver.ManifestConfiguration#setClasspathLayoutType(String)} has the value 'custom'.
+     * <b>The default value is
      * null.</b> Expressions will be evaluated against the following ordered list of classpath-related objects:
      * <ol>
      * <li>The current {@code Artifact} instance, if one exists.</li>
@@ -279,6 +318,7 @@ public class ManifestConfiguration
      * </ol>
      * <br>
      * <b>NOTE:</b> If you specify a layout type of 'custom' you MUST set this layout expression.
+     *
      * @return The custom classpath layout.
      */
     public String getCustomClasspathLayout()
@@ -288,7 +328,8 @@ public class ManifestConfiguration
 
     /**
      * Set the layout expression for use when the layout type set in
-     * {@link ManifestConfiguration#setClasspathLayoutType(String)} has the value 'custom'. Expressions will be
+     * {@link org.apache.maven.archiver.ManifestConfiguration#setClasspathLayoutType(String)} has the value 'custom'.
+     * Expressions will be
      * evaluated against the following ordered list of classpath-related objects:
      * <ol>
      * <li>The current {@code Artifact} instance, if one exists.</li>
@@ -298,12 +339,13 @@ public class ManifestConfiguration
      * <b>NOTE:</b> If you specify a layout type of 'custom' you MUST set this layout expression.
      * You can take a look at
      * <ol>
-     * <li>{@link MavenArchiver#SIMPLE_LAYOUT}</li>
-     * <li>{@link MavenArchiver#SIMPLE_LAYOUT_NONUNIQUE}</li>
-     * <li>{@link MavenArchiver#REPOSITORY_LAYOUT}</li>
-     * <li>{@link MavenArchiver#REPOSITORY_LAYOUT_NONUNIQUE}</li>
+     * <li>{@link org.apache.maven.archiver.MavenArchiver#SIMPLE_LAYOUT}</li>
+     * <li>{@link org.apache.maven.archiver.MavenArchiver#SIMPLE_LAYOUT_NONUNIQUE}</li>
+     * <li>{@link org.apache.maven.archiver.MavenArchiver#REPOSITORY_LAYOUT}</li>
+     * <li>{@link org.apache.maven.archiver.MavenArchiver#REPOSITORY_LAYOUT_NONUNIQUE}</li>
      * </ol>
      * how such an expression looks like.
+     *
      * @param customClasspathLayout The custom classpath layout.
      */
     public void setCustomClasspathLayout( String customClasspathLayout )
@@ -331,6 +373,7 @@ public class ManifestConfiguration
      * <br>
      * <b>NOTE:</b> If the snapshot was installed locally, this flag will not have an effect on that artifact's
      * inclusion, since it will have the same version either way (i.e. -SNAPSHOT naming).
+     *
      * @param useUniqueVersions true to use unique versions or not.
      */
     public void setUseUniqueVersions( boolean useUniqueVersions )
diff --git a/src/main/java/org/apache/maven/archiver/ManifestSection.java b/src/main/java/org/apache/maven/archiver/ManifestSection.java
index 833ce68..4970651 100644
--- a/src/main/java/org/apache/maven/archiver/ManifestSection.java
+++ b/src/main/java/org/apache/maven/archiver/ManifestSection.java
@@ -23,6 +23,7 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 
 /**
+ * <p>ManifestSection class.</p>
  */
 public class ManifestSection
 {
@@ -32,6 +33,8 @@ public class ManifestSection
     private final Map<String, String> manifestEntries = new LinkedHashMap<>();
 
     /**
+     * <p>addManifestEntry.</p>
+     *
      * @param key The key of the manifest entry.
      * @param value The appropriate value.
      */
@@ -41,6 +44,8 @@ public class ManifestSection
     }
 
     /**
+     * <p>Getter for the field <code>manifestEntries</code>.</p>
+     *
      * @return The entries.
      */
     public Map<String, String> getManifestEntries()
@@ -49,6 +54,8 @@ public class ManifestSection
     }
 
     /**
+     * <p>Getter for the field <code>name</code>.</p>
+     *
      * @return The name.
      */
     public String getName()
@@ -57,6 +64,8 @@ public class ManifestSection
     }
 
     /**
+     * <p>Setter for the field <code>name</code>.</p>
+     *
      * @param name the name.
      */
     public void setName( String name )
@@ -65,6 +74,8 @@ public class ManifestSection
     }
 
     /**
+     * <p>addManifestEntries.</p>
+     *
      * @param map The map to add.
      */
     public void addManifestEntries( Map<String, String> map )
@@ -73,6 +84,8 @@ public class ManifestSection
     }
 
     /**
+     * <p>isManifestEntriesEmpty.</p>
+     *
      * @return true if empty false otherwise.
      */
     public boolean isManifestEntriesEmpty()
diff --git a/src/main/java/org/apache/maven/archiver/MavenArchiveConfiguration.java b/src/main/java/org/apache/maven/archiver/MavenArchiveConfiguration.java
index 4fb179d..098616d 100644
--- a/src/main/java/org/apache/maven/archiver/MavenArchiveConfiguration.java
+++ b/src/main/java/org/apache/maven/archiver/MavenArchiveConfiguration.java
@@ -61,6 +61,8 @@ public class MavenArchiveConfiguration
     private File pomPropertiesFile;
 
     /**
+     * <p>isCompress.</p>
+     *
      * @return {@link #compress}
      */
     public boolean isCompress()
@@ -69,6 +71,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>isRecompressAddedZips.</p>
+     *
      * @return {@link #recompressAddedZips}
      */
     public boolean isRecompressAddedZips()
@@ -77,6 +81,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>recompressAddedZips</code>.</p>
+     *
      * @param recompressAddedZips {@link #recompressAddedZips}
      */
     public void setRecompressAddedZips( boolean recompressAddedZips )
@@ -85,6 +91,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>isIndex.</p>
+     *
      * @return {@link #index}
      */
     public boolean isIndex()
@@ -93,6 +101,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>isAddMavenDescriptor.</p>
+     *
      * @return {@link #addMavenDescriptor}
      */
     public boolean isAddMavenDescriptor()
@@ -101,6 +111,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>Getter for the field <code>manifestFile</code>.</p>
+     *
      * @return {@link #manifestFile}
      */
     public File getManifestFile()
@@ -109,6 +121,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>Getter for the field <code>manifest</code>.</p>
+     *
      * @return {@link #manifest}
      */
     //TODO: Change the name of this method into getManifestConfiguration()
@@ -122,6 +136,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>compress</code>.</p>
+     *
      * @param compress set compress to true/false.
      */
     public void setCompress( boolean compress )
@@ -130,6 +146,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>index</code>.</p>
+     *
      * @param index set index to true/false.
      */
     public void setIndex( boolean index )
@@ -138,6 +156,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>addMavenDescriptor</code>.</p>
+     *
      * @param addMavenDescriptor activate to add maven descriptor or not.
      */
     public void setAddMavenDescriptor( boolean addMavenDescriptor )
@@ -146,6 +166,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>manifestFile</code>.</p>
+     *
      * @param manifestFile The manifest file.
      */
     public void setManifestFile( File manifestFile )
@@ -154,7 +176,9 @@ public class MavenArchiveConfiguration
     }
 
     /**
-     * @param manifest {@link ManifestConfiguration}
+     * <p>Setter for the field <code>manifest</code>.</p>
+     *
+     * @param manifest {@link org.apache.maven.archiver.ManifestConfiguration}
      */
     public void setManifest( ManifestConfiguration manifest )
     {
@@ -162,6 +186,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>addManifestEntry.</p>
+     *
      * @param key The key of the entry.
      * @param value The value of the entry.
      */
@@ -171,6 +197,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>addManifestEntries.</p>
+     *
      * @param map The whole map which should be added.
      */
     public void addManifestEntries( Map<String, String> map )
@@ -179,6 +207,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>isManifestEntriesEmpty.</p>
+     *
      * @return are there entries true yes false otherwise.
      */
     public boolean isManifestEntriesEmpty()
@@ -187,6 +217,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>Getter for the field <code>manifestEntries</code>.</p>
+     *
      * @return {@link #manifestEntries}
      */
     public Map<String, String> getManifestEntries()
@@ -195,6 +227,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>Setter for the field <code>manifestEntries</code>.</p>
+     *
      * @param manifestEntries {@link #manifestEntries}
      */
     public void setManifestEntries( Map<String, String> manifestEntries )
@@ -203,7 +237,9 @@ public class MavenArchiveConfiguration
     }
 
     /**
-     * @param section {@link ManifestSection}
+     * <p>addManifestSection.</p>
+     *
+     * @param section {@link org.apache.maven.archiver.ManifestSection}
      */
     public void addManifestSection( ManifestSection section )
     {
@@ -211,7 +247,9 @@ public class MavenArchiveConfiguration
     }
 
     /**
-     * @param list Added list of {@link ManifestSection}.
+     * <p>addManifestSections.</p>
+     *
+     * @param list Added list of {@link org.apache.maven.archiver.ManifestSection}.
      */
     public void addManifestSections( List<ManifestSection> list )
     {
@@ -219,6 +257,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>isManifestSectionsEmpty.</p>
+     *
      * @return if manifestSections is empty or not.
      */
     public boolean isManifestSectionsEmpty()
@@ -227,6 +267,8 @@ public class MavenArchiveConfiguration
     }
 
     /**
+     * <p>Getter for the field <code>manifestSections</code>.</p>
+     *
      * @return {@link #manifestSections}
      */
     public List<ManifestSection> getManifestSections()
@@ -235,7 +277,9 @@ public class MavenArchiveConfiguration
     }
 
     /**
-     * @param manifestSections set The list of {@link ManifestSection}.
+     * <p>Setter for the field <code>manifestSections</code>.</p>
+     *
+     * @param manifestSections set The list of {@link org.apache.maven.archiver.ManifestSection}.
      */
     public void setManifestSections( List<ManifestSection> manifestSections )
     {
diff --git a/src/main/java/org/apache/maven/archiver/MavenArchiver.java b/src/main/java/org/apache/maven/archiver/MavenArchiver.java
index 5ece688..140a5de 100644
--- a/src/main/java/org/apache/maven/archiver/MavenArchiver.java
+++ b/src/main/java/org/apache/maven/archiver/MavenArchiver.java
@@ -19,12 +19,30 @@ package org.apache.maven.archiver;
  * under the License.
  */
 
+import javax.lang.model.SourceVersion;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.jar.Attributes;
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
 import org.apache.maven.artifact.versioning.ArtifactVersion;
 import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.utils.PropertyUtils;
+import org.apache.maven.shared.utils.StringUtils;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.archiver.jar.Manifest;
 import org.codehaus.plexus.archiver.jar.ManifestException;
@@ -36,31 +54,17 @@ import org.codehaus.plexus.interpolation.PrefixedPropertiesValueSource;
 import org.codehaus.plexus.interpolation.RecursionInterceptor;
 import org.codehaus.plexus.interpolation.StringSearchInterpolator;
 import org.codehaus.plexus.interpolation.ValueSource;
-import org.apache.maven.shared.utils.PropertyUtils;
-import org.apache.maven.shared.utils.StringUtils;
-
-import javax.lang.model.SourceVersion;
-import java.io.File;
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.jar.Attributes;
 
 import static org.apache.maven.archiver.ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_CUSTOM;
 import static org.apache.maven.archiver.ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_REPOSITORY;
 import static org.apache.maven.archiver.ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_SIMPLE;
 
 /**
+ * <p>MavenArchiver class.</p>
+ *
  * @author <a href="evenisse@apache.org">Emmanuel Venisse</a>
  * @author kama
+ * @version $Id: $Id
  */
 public class MavenArchiver
 {
@@ -117,19 +121,21 @@ public class MavenArchiver
     private boolean buildJdkSpecDefaultEntry = true;
     
     /**
+     * <p>getManifest.</p>
+     *
      * @param session the Maven Session
      * @param project the Maven Project
      * @param config the MavenArchiveConfiguration
-     * @return the {@link Manifest}
-     * @throws ManifestException in case of a failure
-     * @throws DependencyResolutionRequiredException resolution failure
+     * @return the {@link org.codehaus.plexus.archiver.jar.Manifest}
+     * @throws org.codehaus.plexus.archiver.jar.ManifestException in case of a failure
+     * @throws org.apache.maven.artifact.DependencyResolutionRequiredException resolution failure
      */
     public Manifest getManifest( MavenSession session, MavenProject project, MavenArchiveConfiguration config )
         throws ManifestException, DependencyResolutionRequiredException
     {
         boolean hasManifestEntries = !config.isManifestEntriesEmpty();
         Map<String, String> entries =
-            hasManifestEntries ? config.getManifestEntries() : Collections.<String, String>emptyMap();
+            hasManifestEntries ? config.getManifestEntries() : Collections.emptyMap();
 
         Manifest manifest = getManifest( session, project, config.getManifest(), entries );
 
@@ -187,31 +193,34 @@ public class MavenArchiver
     /**
      * Return a pre-configured manifest.
      *
-     * @param project {@link MavenProject}
-     * @param config {@link ManifestConfiguration}
-     * @return {@link Manifest}
-     * @throws ManifestException Manifest exception.
-     * @throws DependencyResolutionRequiredException Dependency resolution exception.
+     * @param project {@link org.apache.maven.project.MavenProject}
+     * @param config {@link org.apache.maven.archiver.ManifestConfiguration}
+     * @return {@link org.codehaus.plexus.archiver.jar.Manifest}
+     * @throws org.codehaus.plexus.archiver.jar.ManifestException Manifest exception.
+     * @throws org.apache.maven.artifact.DependencyResolutionRequiredException Dependency resolution exception.
      */
     // TODO Add user attributes list and user groups list
     public Manifest getManifest( MavenProject project, ManifestConfiguration config )
         throws ManifestException, DependencyResolutionRequiredException
     {
-        return getManifest( null, project, config, Collections.<String, String>emptyMap() );
+        return getManifest( null, project, config, Collections.emptyMap() );
     }
 
     /**
-     * @param mavenSession {@link MavenSession}
-     * @param project {@link MavenProject}
-     * @param config {@link ManifestConfiguration}
-     * @return {@link Manifest}
-     * @throws ManifestException the manifest exception
-     * @throws DependencyResolutionRequiredException the dependency resolution required exception
+     * <p>getManifest.</p>
+     *
+     * @param mavenSession {@link org.apache.maven.execution.MavenSession}
+     * @param project      {@link org.apache.maven.project.MavenProject}
+     * @param config       {@link org.apache.maven.archiver.ManifestConfiguration}
+     * @return {@link org.codehaus.plexus.archiver.jar.Manifest}
+     * @throws org.codehaus.plexus.archiver.jar.ManifestException              the manifest exception
+     * @throws org.apache.maven.artifact.DependencyResolutionRequiredException the dependency resolution required
+     *                                                                         exception
      */
     public Manifest getManifest( MavenSession mavenSession, MavenProject project, ManifestConfiguration config )
         throws ManifestException, DependencyResolutionRequiredException
     {
-        return getManifest( mavenSession, project, config, Collections.<String, String>emptyMap() );
+        return getManifest( mavenSession, project, config, Collections.emptyMap() );
     }
 
     private void addManifestAttribute( Manifest manifest, Map<String, String> map, String key, String value )
@@ -242,13 +251,16 @@ public class MavenArchiver
     }
 
     /**
-     * @param session {@link MavenSession}
-     * @param project {@link MavenProject}
-     * @param config {@link ManifestConfiguration}
+     * <p>getManifest.</p>
+     *
+     * @param session {@link org.apache.maven.execution.MavenSession}
+     * @param project {@link org.apache.maven.project.MavenProject}
+     * @param config  {@link org.apache.maven.archiver.ManifestConfiguration}
      * @param entries The entries.
-     * @return {@link Manifest}
-     * @throws ManifestException the manifest exception
-     * @throws DependencyResolutionRequiredException the dependency resolution required exception
+     * @return {@link org.codehaus.plexus.archiver.jar.Manifest}
+     * @throws org.codehaus.plexus.archiver.jar.ManifestException              the manifest exception
+     * @throws org.apache.maven.artifact.DependencyResolutionRequiredException the dependency resolution required
+     *                                                                         exception
      */
     protected Manifest getManifest( MavenSession session, MavenProject project, ManifestConfiguration config,
                                     Map<String, String> entries )
@@ -471,11 +483,10 @@ public class MavenArchiver
             addManifestAttribute( m, entries, "Extension-List", extensionsList.toString() );
         }
 
-        for ( Object artifact1 : artifacts )
+        for ( Artifact artifact : artifacts )
         {
             // TODO: the correct solution here would be to have an extension type, and to read
             // the real extension values either from the artifact's manifest or some part of the POM
-            Artifact artifact = (Artifact) artifact1;
             if ( "jar".equals( artifact.getType() ) )
             {
                 String artifactId = artifact.getArtifactId().replace( '.', '_' );
@@ -487,7 +498,7 @@ public class MavenArchiver
                 if ( artifact.getRepository() != null )
                 {
                     iname = artifactId + "-Implementation-URL";
-                    String url = artifact.getRepository().getUrl() + "/" + artifact.toString();
+                    String url = artifact.getRepository().getUrl() + "/" + artifact;
                     addManifestAttribute( m, entries, iname, url );
                 }
             }
@@ -544,7 +555,9 @@ public class MavenArchiver
     }
 
     /**
-     * @return {@link JarArchiver}
+     * <p>Getter for the field <code>archiver</code>.</p>
+     *
+     * @return {@link org.codehaus.plexus.archiver.jar.JarArchiver}
      */
     public JarArchiver getArchiver()
     {
@@ -552,7 +565,9 @@ public class MavenArchiver
     }
 
     /**
-     * @param archiver {@link JarArchiver}
+     * <p>Setter for the field <code>archiver</code>.</p>
+     *
+     * @param archiver {@link org.codehaus.plexus.archiver.jar.JarArchiver}
      */
     public void setArchiver( JarArchiver archiver )
     {
@@ -560,6 +575,8 @@ public class MavenArchiver
     }
 
     /**
+     * <p>setOutputFile.</p>
+     *
      * @param outputFile Set output file.
      */
     public void setOutputFile( File outputFile )
@@ -568,13 +585,15 @@ public class MavenArchiver
     }
 
     /**
-     * @param session {@link MavenSession}
-     * @param project {@link MavenProject}
-     * @param archiveConfiguration {@link MavenArchiveConfiguration}
+     * <p>createArchive.</p>
+     *
+     * @param session {@link org.apache.maven.execution.MavenSession}
+     * @param project {@link org.apache.maven.project.MavenProject}
+     * @param archiveConfiguration {@link org.apache.maven.archiver.MavenArchiveConfiguration}
      * @throws org.codehaus.plexus.archiver.ArchiverException Archiver Exception.
-     * @throws ManifestException Manifest Exception.
-     * @throws IOException IO Exception.
-     * @throws DependencyResolutionRequiredException Dependency resolution exception.
+     * @throws org.codehaus.plexus.archiver.jar.ManifestException Manifest Exception.
+     * @throws java.io.IOException IO Exception.
+     * @throws org.apache.maven.artifact.DependencyResolutionRequiredException Dependency resolution exception.
      */
     public void createArchive( MavenSession session, MavenProject project,
                                MavenArchiveConfiguration archiveConfiguration )
@@ -776,7 +795,7 @@ public class MavenArchiver
      * @return the parsed timestamp, may be <code>null</code> if <code>null</code> input or input contains only 1
      *         character
      * @since 3.5.0
-     * @throws IllegalArgumentException if the outputTimestamp is neither ISO 8601 nor an integer
+     * @throws java.lang.IllegalArgumentException if the outputTimestamp is neither ISO 8601 nor an integer
      */
     public Date parseOutputTimestamp( String outputTimestamp )
     {
diff --git a/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java b/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
index 7da8883..aacf13f 100644
--- a/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
+++ b/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
@@ -21,12 +21,12 @@ package org.apache.maven.archiver;
 
 import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintWriter;
 import java.io.StringReader;
 import java.io.StringWriter;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -39,6 +39,9 @@ import org.codehaus.plexus.archiver.Archiver;
 /**
  * This class is responsible for creating the <code>pom.properties</code> file
  * in <code>META-INF/maven/${groupId}/${artifactId}</code>.
+ *
+ * @author slachiewicz
+ * @version $Id: $Id
  */
 public class PomPropertiesUtil
 {
@@ -46,7 +49,7 @@ public class PomPropertiesUtil
         throws IOException
     {
         Properties fileProps = new Properties();
-        try ( InputStream istream = new FileInputStream( file ) )
+        try ( InputStream istream = Files.newInputStream( file.toPath() ) )
         {
             fileProps.load( istream );
             return fileProps;
@@ -107,14 +110,15 @@ public class PomPropertiesUtil
 
     /**
      * Creates the pom.properties file.
-     * @param session {@link MavenSession}
-     * @param project {@link MavenProject}
-     * @param archiver {@link Archiver}
+     *
+     * @param session {@link org.apache.maven.execution.MavenSession}
+     * @param project {@link org.apache.maven.project.MavenProject}
+     * @param archiver {@link org.codehaus.plexus.archiver.Archiver}
      * @param customPomPropertiesFile optional custom pom properties file
      * @param pomPropertiesFile The pom properties file.
      * @param forceCreation force creation true/false
      * @throws org.codehaus.plexus.archiver.ArchiverException archiver exception.
-     * @throws IOException IO exception.
+     * @throws java.io.IOException IO exception.
      */
     public void createPomProperties( MavenSession session, MavenProject project, Archiver archiver,
                                      File customPomPropertiesFile, File pomPropertiesFile, boolean forceCreation )
diff --git a/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java b/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java
index 698f0c8..6baefc4 100644
--- a/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java
+++ b/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java
@@ -23,7 +23,6 @@ import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.execution.DefaultMavenExecutionRequest;
 import org.apache.maven.execution.DefaultMavenExecutionResult;
 import org.apache.maven.execution.MavenExecutionRequest;
@@ -1221,9 +1220,9 @@ class MavenArchiverTest
         model.setVersion( "0.1.1" );
 
         final MavenProject project = new MavenProject( model );
-        project.setExtensionArtifacts( Collections.<Artifact>emptySet() );
-        project.setRemoteArtifactRepositories( Collections.<ArtifactRepository>emptyList() );
-        project.setPluginArtifactRepositories( Collections.<ArtifactRepository>emptyList() );
+        project.setExtensionArtifacts( Collections.emptySet() );
+        project.setRemoteArtifactRepositories( Collections.emptyList() );
+        project.setPluginArtifactRepositories( Collections.emptyList() );
         return project;
     }
 
@@ -1392,15 +1391,13 @@ class MavenArchiverTest
 
     private MavenSession getDummySession( Properties systemProperties )
     {
-        File settings = null;
-        List<String> goals = null;
         Date startTime = new Date();
 
         MavenExecutionRequest request = new DefaultMavenExecutionRequest();
         request.setSystemProperties( systemProperties );
-        request.setGoals( goals );
+        request.setGoals( null );
         request.setStartTime( startTime );
-        request.setUserSettingsFile( settings );
+        request.setUserSettingsFile( null );
 
         MavenExecutionResult result = new DefaultMavenExecutionResult();
 
diff --git a/src/test/java/org/apache/maven/archiver/MockArtifact.java b/src/test/java/org/apache/maven/archiver/MockArtifact.java
index 3bd51f9..ae2d50d 100644
--- a/src/test/java/org/apache/maven/archiver/MockArtifact.java
+++ b/src/test/java/org/apache/maven/archiver/MockArtifact.java
@@ -32,11 +32,11 @@ import java.io.File;
 import java.util.Collection;
 import java.util.List;
 
-/**
+/*
  * TODO move to maven-artifact-test
  */
 @SuppressWarnings( "deprecation" )
-class MockArtifact
+public class MockArtifact
     implements Artifact
 {
     private String groupId;


[maven-archiver] 02/02: [MSHARED-1003] Require Maven 3.2.5+

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

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

commit ea2396bda35a8f7c0c958691bfebf0561f9d464b
Author: Jorge Solórzano <jo...@gmail.com>
AuthorDate: Fri Apr 22 11:56:59 2022 +0200

    [MSHARED-1003] Require Maven 3.2.5+
    
    Signed-off-by: Jorge Solórzano <jo...@gmail.com>
    Closes #21
---
 pom.xml | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/pom.xml b/pom.xml
index b385640..43954a9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
   <parent>
     <groupId>org.apache.maven.shared</groupId>
     <artifactId>maven-shared-components</artifactId>
-    <version>35</version>
+    <version>36</version>
     <relativePath />
   </parent>
 
@@ -34,9 +34,8 @@
   <description>Provides utility methods for creating JARs and other archive files from a Maven project.</description>
 
   <properties>
-    <mavenVersion>3.1.1</mavenVersion>
+    <mavenVersion>3.2.5</mavenVersion>
     <javaVersion>8</javaVersion>
-    <surefire.version>2.22.2</surefire.version>
     <project.build.outputTimestamp>2022-01-02T12:43:14Z</project.build.outputTimestamp>
   </properties>
 
@@ -65,18 +64,6 @@
     <!--
       Apache Maven dependencies
     -->
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact</artifactId>
-      <version>${mavenVersion}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-model</artifactId>
-      <version>${mavenVersion}</version>
-      <scope>provided</scope>
-    </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-core</artifactId>
@@ -96,14 +83,14 @@
       <artifactId>commons-io</artifactId>
       <version>2.11.0</version>
     </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-compress</artifactId>
-      <version>1.21</version>
-    </dependency>
     <!--
       Plexus dependencies
     -->
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-io</artifactId>
+      <version>3.3.0</version>
+    </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-archiver</artifactId>