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/08/22 09:10:32 UTC

[maven-pdf-plugin] branch MPDF-95 updated (6e78dfe -> 07124d3)

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

slachiewicz pushed a change to branch MPDF-95
in repository https://gitbox.apache.org/repos/asf/maven-pdf-plugin.git.


 discard 6e78dfe  [MPDF-95] Require Maven 3.1.1
     add 9712c7a  Bump junit to 4.13.2
     add 80b7e3d  Bump maven-reporting-impl from 2.3 to 3.0.0
     add a04c704  Bump Doxia to 1.9.1/DoxiaTools 1.9.2
     add d3ce676  [MPDF-97] Upgrade Doxia to 1.10 and DoxiaTools to 1.10
     add 9c14ca5  Bump plexus-interpolation from 1.24 to 1.26
     add a0feac6  Bump commons-io from 2.5 to 2.6
     add 8dff265  update CI url
     new 07124d3  [MPDF-95] Require Maven 3.1.1

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (6e78dfe)
            \
             N -- N -- N   refs/heads/MPDF-95 (07124d3)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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.


Summary of changes:
 README.md                                 |  8 ++---
 pom.xml                                   | 50 +++++++++++++++++++++++++------
 src/it/pdf-aggregate/pom.xml              |  2 +-
 src/it/pdf-with-reporting-section/pom.xml |  2 +-
 4 files changed, 47 insertions(+), 15 deletions(-)

[maven-pdf-plugin] 01/01: [MPDF-95] Require Maven 3.1.1

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

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

commit 07124d3beb564b0c66320d1fabcbf8203944574e
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Fri Jun 4 10:25:24 2021 +0200

    [MPDF-95] Require Maven 3.1.1
---
 pom.xml                                            | 63 +++++++++++++------
 .../plugins/pdf/DocumentDescriptorReader.java      |  6 +-
 .../java/org/apache/maven/plugins/pdf/PdfMojo.java | 73 +---------------------
 .../plugins/pdf/DocumentDescriptorReaderTest.java  |  4 +-
 .../plugins/pdf/stubs/DefaultMavenProjectStub.java | 10 ++-
 .../pdf/stubs/FilteringMavenProjectStub.java       | 12 ++--
 .../plugins/pdf/stubs/ITextMavenProjectStub.java   |  9 ++-
 7 files changed, 62 insertions(+), 115 deletions(-)

diff --git a/pom.xml b/pom.xml
index a34bff5..2a90f80 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@ under the License.
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-plugins</artifactId>
     <version>34</version>
-    <relativePath>../../pom/maven/maven-plugins/pom.xml</relativePath>
+    <relativePath/>
   </parent>
 
   <artifactId>maven-pdf-plugin</artifactId>
@@ -91,7 +91,7 @@ under the License.
   <properties>
     <doxiaVersion>1.10</doxiaVersion>
     <doxiaSitetoolsVersion>1.10</doxiaSitetoolsVersion>
-    <mavenVersion>2.2.1</mavenVersion>
+    <mavenVersion>3.1.1</mavenVersion>
     <javaVersion>7</javaVersion>
     <project.build.outputTimestamp>2020-04-07T21:04:00Z</project.build.outputTimestamp>
   </properties>
@@ -115,19 +115,20 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.reporting</groupId>
       <artifactId>maven-reporting-exec</artifactId>
-      <version>1.4</version>
+      <version>1.5.1</version>
     </dependency>
   
     <!-- Maven -->
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-project</artifactId>
+      <artifactId>maven-core</artifactId>
       <version>${mavenVersion}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-core</artifactId>
+      <artifactId>maven-compat</artifactId>
       <version>${mavenVersion}</version>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
@@ -140,11 +141,6 @@ under the License.
       <version>${mavenVersion}</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact-manager</artifactId>
-      <version>${mavenVersion}</version>
-    </dependency>
-    <dependency>
       <groupId>org.apache.maven.plugin-tools</groupId>
       <artifactId>maven-plugin-annotations</artifactId>
       <scope>provided</scope>
@@ -160,6 +156,12 @@ under the License.
       <groupId>org.apache.maven.doxia</groupId>
       <artifactId>doxia-sink-api</artifactId>
       <version>${doxiaVersion}</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>plexus-container-default</artifactId>
+          <groupId>org.codehaus.plexus</groupId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
@@ -187,6 +189,12 @@ under the License.
       <groupId>org.apache.maven.doxia</groupId>
       <artifactId>doxia-integration-tools</artifactId>
       <version>${doxiaSitetoolsVersion}</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>plexus-container-default</artifactId>
+          <groupId>org.codehaus.plexus</groupId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
@@ -244,12 +252,8 @@ under the License.
       <version>1.0-beta-7</version>
       <exclusions>
         <exclusion>
-          <groupId>org.codehaus.plexus</groupId>
           <artifactId>plexus-component-api</artifactId>
-        </exclusion>
-        <exclusion>
           <groupId>org.codehaus.plexus</groupId>
-          <artifactId>plexus-container-default</artifactId>
         </exclusion>
       </exclusions>
     </dependency>
@@ -271,14 +275,9 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.plugin-testing</groupId>
       <artifactId>maven-plugin-testing-harness</artifactId>
-      <version>1.3</version>
+      <version>3.1.0</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-container-default</artifactId>
-      <version>1.0-alpha-9-stable-1</version>
-    </dependency>
   </dependencies>
 
   <build>
@@ -293,6 +292,30 @@ under the License.
     </pluginManagement>
 
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <id>ensure-no-container-api</id>
+            <configuration>
+              <rules>
+                <bannedDependencies>
+                  <excludes>
+                    <exclude>org.codehaus.plexus:plexus-component-api</exclude>
+                    <exclude>org.codehaus.plexus:plexus-container-default</exclude>
+                  </excludes>
+                  <message>The new containers are not supported. You probably added a dependency that is missing the exclusions.</message>
+                </bannedDependencies>
+              </rules
+              <fail>true</fail>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
 <!-- START SNIPPET: configuration -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
diff --git a/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java b/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java
index 7b72355..c893606 100644
--- a/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java
+++ b/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java
@@ -138,7 +138,7 @@ public class DocumentDescriptorReader
                     }
                     catch ( Exception e )
                     {
-                        addFeedback( "Failed to extract \'" + expression + "\' from: " + project, e );
+                        addFeedback( "Failed to extract '" + expression + "' from: " + project, e );
                     }
 
                     return null;
@@ -164,9 +164,7 @@ public class DocumentDescriptorReader
         }
         catch ( InterpolationException e )
         {
-            final IOException io = new IOException( "Error interpolating document descriptor" );
-            io.initCause( e );
-            throw io;
+            throw new IOException( "Error interpolating document descriptor", e );
         }
     }
 }
diff --git a/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java b/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
index 142c777..f993526 100644
--- a/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
+++ b/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
@@ -21,7 +21,6 @@ package org.apache.maven.plugins.pdf;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.Reader;
 import java.io.StringReader;
 import java.io.StringWriter;
@@ -31,15 +30,10 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.Properties;
 
 import org.apache.commons.io.input.XmlStreamReader;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.doxia.Doxia;
 import org.apache.maven.doxia.docrenderer.AbstractDocumentRenderer;
 import org.apache.maven.doxia.docrenderer.DocumentRenderer;
@@ -71,13 +65,11 @@ import org.apache.maven.model.ReportPlugin;
 import org.apache.maven.model.Reporting;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.PluginManager;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.reporting.AbstractMavenReportRenderer;
 import org.apache.maven.reporting.MavenReport;
 import org.apache.maven.reporting.MavenReportException;
@@ -157,14 +149,6 @@ public class PdfMojo
     private SiteTool siteTool;
 
     /**
-     * The Plugin manager instance used to resolve Plugin descriptors.
-     *
-     * @since 1.1
-     */
-    @Component( role = PluginManager.class )
-    private PluginManager pluginManager;
-
-    /**
      * Doxia.
      *
      * @since 1.1
@@ -172,14 +156,6 @@ public class PdfMojo
     @Component
     private Doxia doxia;
 
-    /**
-     * Project builder.
-     *
-     * @since 1.1
-     */
-    @Component
-    private MavenProjectBuilder mavenProjectBuilder;
-
     // ----------------------------------------------------------------------
     // Mojo Parameters
     // ----------------------------------------------------------------------
@@ -1376,11 +1352,6 @@ public class PdfMojo
     protected List<MavenReportExecution> getReports()
         throws MojoExecutionException
     {
-        if ( !isMaven3OrMore() )
-        {
-            getLog().error( "Report generation is not supported with Maven <= 2.x" );
-        }
-
         MavenReportExecutorRequest mavenReportExecutorRequest = new MavenReportExecutorRequest();
         mavenReportExecutorRequest.setLocalRepository( localRepository );
         mavenReportExecutorRequest.setMavenSession( session );
@@ -1428,52 +1399,10 @@ public class PdfMojo
             mpir.setArtifactId( "maven-project-info-reports-plugin" );
             reportingPlugins.add( mpir );
         }
-        return reportingPlugins.toArray( new ReportPlugin[reportingPlugins.size()] );
+        return reportingPlugins.toArray( new ReportPlugin[0] );
     }
 
     /**
-     * Check the current Maven version to see if it's Maven 3.0 or newer.
-     */
-    protected static boolean isMaven3OrMore()
-    {
-        try
-        {
-            ArtifactVersion mavenVersion = new DefaultArtifactVersion( getMavenVersion() );
-            return VersionRange.createFromVersionSpec( "[3.0,)" ).containsVersion( mavenVersion );
-        }
-        catch ( InvalidVersionSpecificationException e )
-        {
-            return false;
-        }
-//        return new ComparableVersion( getMavenVersion() ).compareTo( new ComparableVersion( "3.0" ) ) >= 0;
-    }
-
-    protected static String getMavenVersion()
-    {
-        // This relies on the fact that MavenProject is the in core classloader
-        // and that the core classloader is for the maven-core artifact
-        // and that should have a pom.properties file
-        // if this ever changes, we will have to revisit this code.
-        final Properties properties = new Properties();
-
-        try ( InputStream in = MavenProject.class.getClassLoader().getResourceAsStream(
-                "META-INF/maven/org.apache.maven/maven-core/pom.properties" ) )
-        {
-            properties.load( in );
-        }
-        catch ( IOException ioe )
-        {
-            return "";
-        }
-
-        return properties.getProperty( "version" ).trim();
-    }
-
-    // ----------------------------------------------------------------------
-    // static methods
-    // ----------------------------------------------------------------------
-
-    /**
      * Write the given content to the given file.
      * <br/>
      * <b>Note</b>: try also to fix the content due to some issues in
diff --git a/src/test/java/org/apache/maven/plugins/pdf/DocumentDescriptorReaderTest.java b/src/test/java/org/apache/maven/plugins/pdf/DocumentDescriptorReaderTest.java
index d402633..ab07d3f 100644
--- a/src/test/java/org/apache/maven/plugins/pdf/DocumentDescriptorReaderTest.java
+++ b/src/test/java/org/apache/maven/plugins/pdf/DocumentDescriptorReaderTest.java
@@ -65,8 +65,8 @@ public class DocumentDescriptorReaderTest
         assertEquals( "Table of Contents", model.getToc().getName() );
         assertEquals( 5, model.getToc().getItems().size() );
         assertNotNull( model.getMeta() );
-        assertTrue( model.getMeta().getTitle().indexOf(
-                "User guide in en of Test filtering version 1.0-SNAPSHOT" ) == 0 );
+        assertEquals( 0, model.getMeta().getTitle().indexOf(
+                "User guide in en of Test filtering version 1.0-SNAPSHOT" ) );
         assertEquals( "vsiveton@apache.org ltheussl@apache.org", model.getMeta().getAuthor() );
     }
 
diff --git a/src/test/java/org/apache/maven/plugins/pdf/stubs/DefaultMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/pdf/stubs/DefaultMavenProjectStub.java
index 240dfb3..1975fb9 100644
--- a/src/test/java/org/apache/maven/plugins/pdf/stubs/DefaultMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/pdf/stubs/DefaultMavenProjectStub.java
@@ -25,12 +25,11 @@ import java.util.Collections;
 import java.util.List;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.MavenArtifactRepository;
 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.ReaderFactory;
 
 /**
@@ -67,11 +66,10 @@ public class DefaultMavenProjectStub
     }
 
     /** {@inheritDoc} */
-    public List getRemoteArtifactRepositories()
+    public List<ArtifactRepository> getRemoteArtifactRepositories()
     {
-        ArtifactRepository repository =
-            new DefaultArtifactRepository( "central", "http://repo1.maven.org/maven2",
-                                           new DefaultRepositoryLayout() );
+        ArtifactRepository repository = new MavenArtifactRepository( "central", "https://repo.maven.apache.org/maven2",
+                new DefaultRepositoryLayout(), null, null );
 
         return Collections.singletonList( repository );
     }
diff --git a/src/test/java/org/apache/maven/plugins/pdf/stubs/FilteringMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/pdf/stubs/FilteringMavenProjectStub.java
index 93a587f..27467b5 100644
--- a/src/test/java/org/apache/maven/plugins/pdf/stubs/FilteringMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/pdf/stubs/FilteringMavenProjectStub.java
@@ -26,12 +26,12 @@ import java.util.List;
 import java.util.Properties;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.MavenArtifactRepository;
 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.model.Developer;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.ReaderFactory;
 
 /**
@@ -73,7 +73,7 @@ public class FilteringMavenProjectStub
     }
 
     /** {@inheritDoc} */
-    public List getDevelopers()
+    public List<Developer> getDevelopers()
     {
         return getModel().getDevelopers();
     }
@@ -85,11 +85,11 @@ public class FilteringMavenProjectStub
     }
 
     /** {@inheritDoc} */
-    public List getRemoteArtifactRepositories()
+    public List<ArtifactRepository> getRemoteArtifactRepositories()
     {
         ArtifactRepository repository =
-            new DefaultArtifactRepository( "central", "http://repo1.maven.org/maven2",
-                                           new DefaultRepositoryLayout() );
+            new MavenArtifactRepository( "central", "https://repo.maven.apache.org/maven2",
+                    new DefaultRepositoryLayout(), null,null );
 
         return Collections.singletonList( repository );
     }
diff --git a/src/test/java/org/apache/maven/plugins/pdf/stubs/ITextMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/pdf/stubs/ITextMavenProjectStub.java
index 0b2e5bf..c55df9b 100644
--- a/src/test/java/org/apache/maven/plugins/pdf/stubs/ITextMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/pdf/stubs/ITextMavenProjectStub.java
@@ -25,12 +25,11 @@ import java.util.Collections;
 import java.util.List;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.MavenArtifactRepository;
 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.ReaderFactory;
 
 /**
@@ -61,11 +60,11 @@ public class ITextMavenProjectStub
     }
 
     /** {@inheritDoc} */
-    public List getRemoteArtifactRepositories()
+    public List<ArtifactRepository> getRemoteArtifactRepositories()
     {
         ArtifactRepository repository =
-            new DefaultArtifactRepository( "central", "http://repo1.maven.org/maven2",
-                                           new DefaultRepositoryLayout() );
+                new MavenArtifactRepository( "central", "https://repo.maven.apache.org/maven2",
+                        new DefaultRepositoryLayout(), null, null );
 
         return Collections.singletonList( repository );
     }