[Git][java-team/maven-reporting-exec][master] 9 commits: New upstream version 2.0.0
Emmanuel Bourg (@ebourg)
gitlab at salsa.debian.org
Thu Oct 24 11:47:33 BST 2024
Emmanuel Bourg pushed to branch master at Debian Java Maintainers / maven-reporting-exec
Commits:
f22a1fec by Emmanuel Bourg at 2024-10-23T22:44:13+02:00
New upstream version 2.0.0
- - - - -
aaf6891f by Emmanuel Bourg at 2024-10-23T22:44:13+02:00
Update upstream source from tag 'upstream/2.0.0'
Update to upstream version '2.0.0'
with Debian dir ee01e1c1a8461969da7a9352269dff181266ff53
- - - - -
8b7872d2 by Emmanuel Bourg at 2024-10-24T11:20:58+02:00
Depend on libdoxia-core-java (>= 2.0)
- - - - -
abdccd15 by Emmanuel Bourg at 2024-10-24T11:22:07+02:00
No longer depend on plexus-component-metadata and plexus-container-default
- - - - -
88faa882 by Emmanuel Bourg at 2024-10-24T11:28:23+02:00
Depend on libmaven-reporting-api-java (>= 4.0.0)
- - - - -
e232dba1 by Emmanuel Bourg at 2024-10-24T11:29:22+02:00
Updated the Maven rules
- - - - -
6e4d55e8 by Emmanuel Bourg at 2024-10-24T11:29:29+02:00
Standards-Version updated to 4.7.0
- - - - -
68bf1493 by Emmanuel Bourg at 2024-10-24T12:44:47+02:00
Depend on libdoxia-sitetools-java (>= 2.0)
- - - - -
ff1f135b by Emmanuel Bourg at 2024-10-24T12:47:02+02:00
Upload to unstable
- - - - -
25 changed files:
- .asf.yaml
- .github/workflows/maven-verify.yml
- README.md
- debian/changelog
- debian/control
- debian/maven.rules
- pom.xml
- src/it/forked-lifecycle/pom.xml
- src/it/pluginManagement_dependencies/pom.xml
- src/it/pluginManagement_dependencies/verify.groovy
- src/it/reportConfig/invoker.properties
- src/it/reportConfig/pom.xml
- src/it/reportConfig/src/main/java/org/apache/maven/shared/it/ConfigurationReport.java
- src/it/reportConfig/verify.groovy
- src/main/java/org/apache/maven/reporting/exec/DefaultMavenPluginManagerHelper.java
- src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java
- src/main/java/org/apache/maven/reporting/exec/MavenPluginManagerHelper.java
- src/main/java/org/apache/maven/reporting/exec/MavenReportExecution.java
- src/main/java/org/apache/maven/reporting/exec/MavenReportExecutor.java
- src/main/java/org/apache/maven/reporting/exec/MavenReportExecutorRequest.java
- src/main/java/org/apache/maven/reporting/exec/ReportPlugin.java
- src/main/java/org/apache/maven/reporting/exec/ReportSet.java
- + src/main/java/org/codehaus/doxia/sink/Sink.java
- src/site/site.xml
- src/test/java/org/apache/maven/reporting/exec/TestDefaultMavenReportExecutor.java
Changes:
=====================================
.asf.yaml
=====================================
@@ -27,6 +27,8 @@ github:
squash: true
merge: false
rebase: true
+ autolink_jira:
+ - MSHARED
notifications:
commits: commits at maven.apache.org
issues: issues at maven.apache.org
=====================================
.github/workflows/maven-verify.yml
=====================================
@@ -24,6 +24,6 @@ on:
jobs:
build:
name: Verify
- uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml at v2
+ uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml at v4
with:
verify-fail-fast: false
=====================================
README.md
=====================================
@@ -20,7 +20,7 @@ Contributing to [Apache Maven Reporting Executor](https://maven.apache.org.repor
[![ASF Jira](https://img.shields.io/endpoint?url=https%3A%2F%2Fmaven.apache.org%2Fbadges%2Fasf_jira-MSHARED.json)][jira]
[![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license]
[![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.reporting/maven-reporting-exec.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.apache.maven.reporting/maven-reporting-exec)
-[![Reproducible Builds](https://img.shields.io/badge/Reproducible_Builds-ok-green?labelColor=blue)](https://github.com/jvm-repo-rebuild/reproducible-central#org.apache.maven.reporting:maven-reporting-exec)
+[![Reproducible Builds](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/jvm-repo-rebuild/reproducible-central/master/content/org/apache/maven/reporting/maven-reporting-exec/badge.json)](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/apache/maven/reporting/maven-reporting-exec/README.md)
[![Jenkins Status](https://img.shields.io/jenkins/s/https/ci-maven.apache.org/job/Maven/job/maven-box/job/maven-reporting-exec/job/master.svg)][build]
[![Jenkins tests](https://img.shields.io/jenkins/t/https/ci-maven.apache.org/job/Maven/job/maven-box/job/maven-reporting-exec/job/master.svg)][test-results]
=====================================
debian/changelog
=====================================
@@ -1,3 +1,14 @@
+maven-reporting-exec (2.0.0-1) unstable; urgency=medium
+
+ * New upstream release
+ - Depend on libdoxia-core-java and libdoxia-sitetools-java (>= 2.0)
+ - Depend on libmaven-reporting-api-java (>= 4.0.0)
+ - No longer depend on plexus-component-metadata and plexus-container-default
+ - Updated the Maven rules
+ * Standards-Version updated to 4.7.0
+
+ -- Emmanuel Bourg <ebourg at apache.org> Thu, 24 Oct 2024 12:46:56 +0200
+
maven-reporting-exec (1.6.0-1) unstable; urgency=medium
* New upstream release
=====================================
debian/control
=====================================
@@ -7,18 +7,17 @@ Build-Depends:
debhelper-compat (= 13),
default-jdk,
junit4,
- libdoxia-core-java,
+ libdoxia-core-java (>= 2.0),
+ libdoxia-sitetools-java (>= 2.0),
libeclipse-sisu-maven-plugin-java,
libmaven-parent-java,
- libmaven-reporting-api-java,
+ libmaven-reporting-api-java (>= 4.0.0),
libmaven-resolver-transport-http-java,
libmaven-shade-plugin-java,
libmaven3-core-java (>= 3.5.0),
libmodello-maven-plugin-java,
- libplexus-component-annotations-java,
- libplexus-component-metadata-java,
maven-debian-helper (>= 2.2)
-Standards-Version: 4.6.2
+Standards-Version: 4.7.0
Vcs-Git: https://salsa.debian.org/java-team/maven-reporting-exec.git
Vcs-Browser: https://salsa.debian.org/java-team/maven-reporting-exec
Homepage: http://maven.apache.org/shared/maven-reporting-exec/
=====================================
debian/maven.rules
=====================================
@@ -3,4 +3,3 @@ junit junit * s/.*/4.x/ * *
org.apache.maven maven-* * s/.*/3.x/ * *
org.apache.maven.reporting maven-reporting-api * s/.*/3.x/ * *
org.apache.maven.shared maven-shared-components pom s/.*/debian/ * *
-s/org.eclipse.aether/org.apache.maven.resolver/ s/aether-(.*)/maven-resolver-$1/ * s/.*/debian/ * *
=====================================
pom.xml
=====================================
@@ -1,4 +1,4 @@
-<?xml version='1.0' encoding='UTF-8'?>
+<?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
@@ -23,13 +23,13 @@
<parent>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-components</artifactId>
- <version>34</version>
+ <version>43</version>
<relativePath />
</parent>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-exec</artifactId>
- <version>1.6.0</version>
+ <version>2.0.0</version>
<name>Apache Maven Reporting Executor</name>
<description>Classes to manage report plugin executions with Maven 3.</description>
@@ -37,8 +37,8 @@
<scm>
<connection>scm:git:https://gitbox.apache.org/repos/asf/maven-reporting-exec.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-reporting-exec.git</developerConnection>
+ <tag>maven-reporting-exec-2.0.0</tag>
<url>https://github.com/apache/maven-reporting-exec/tree/${project.scm.tag}</url>
- <tag>maven-reporting-exec-1.6.0</tag>
</scm>
<issueManagement>
<system>jira</system>
@@ -46,7 +46,7 @@
</issueManagement>
<ciManagement>
<system>Jenkins</system>
- <url>https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven-reporting-exec/</url>
+ <url>https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-reporting-exec/</url>
</ciManagement>
<distributionManagement>
<site>
@@ -56,19 +56,20 @@
</distributionManagement>
<properties>
- <mavenVersion>3.2.5</mavenVersion>
- <aetherVersion>1.0.0.v20140518</aetherVersion>
- <javaVersion>7</javaVersion>
- <project.build.outputTimestamp>2022-02-10T08:19:29Z</project.build.outputTimestamp>
- <sitePluginVersion>3.10.0</sitePluginVersion>
- <projectInfoReportsPluginVersion>3.2.1</projectInfoReportsPluginVersion>
+ <javaVersion>8</javaVersion>
+ <mavenVersion>3.6.3</mavenVersion>
+ <resolverVersion>1.4.1</resolverVersion>
+ <slf4jVersion>1.7.36</slf4jVersion>
+ <sitePluginVersion>3.20.0</sitePluginVersion>
+ <projectInfoReportsPluginVersion>3.7.0</projectInfoReportsPluginVersion>
+ <project.build.outputTimestamp>2024-10-15T18:21:03Z</project.build.outputTimestamp>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
- <version>3.1.0</version>
+ <version>4.0.0</version>
</dependency>
<!-- Maven -->
@@ -76,59 +77,79 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>${mavenVersion}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</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-plugin-api</artifactId>
<version>${mavenVersion}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<version>${mavenVersion}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings-builder</artifactId>
<version>${mavenVersion}</version>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-shared-utils</artifactId>
- <version>3.3.4</version>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-annotations</artifactId>
- <scope>provided</scope>
+ <artifactId>plexus-xml</artifactId>
</dependency>
+
<dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>3.1.0</version><!-- do not upgrade to 3.2.0+ because it adds Xpp3Dom.getInputLocation(): see MSHARED-921 -->
+ <groupId>org.apache.maven.doxia</groupId>
+ <artifactId>doxia-sink-api</artifactId>
+ <version>2.0.0</version>
</dependency>
- <!-- Eclipse Aether for Maven 3.1+ -->
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-api</artifactId>
- <version>${aetherVersion}</version>
- <optional>true</optional>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4jVersion}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-util</artifactId>
- <version>${aetherVersion}</version>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-api</artifactId>
+ <version>${resolverVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-util</artifactId>
+ <version>${resolverVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-classworlds</artifactId>
+ <version>2.6.0</version>
</dependency>
<!-- test -->
@@ -153,123 +174,64 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
- <version>1.7.32</version>
+ <version>${slf4jVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
- <artifactId>maven-compat</artifactId>
+ <artifactId>maven-embedder</artifactId>
<version>${mavenVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
- <artifactId>maven-embedder</artifactId>
+ <artifactId>maven-compat</artifactId>
<version>${mavenVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
- <artifactId>maven-aether-provider</artifactId>
+ <artifactId>maven-resolver-provider</artifactId>
<version>${mavenVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-connector-basic</artifactId>
- <version>${aetherVersion}</version>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-connector-basic</artifactId>
+ <version>${resolverVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-transport-http</artifactId>
- <version>${aetherVersion}</version>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-transport-http</artifactId>
+ <version>${resolverVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
- <version>1.11.1</version>
+ <version>2.0.0</version>
<scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
- <version>0.3.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <!-- TODO remove once Maven parent POM will upgraded - MPOM-280 -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>3.3.1</version>
- <configuration>
- <detectLinks>false</detectLinks>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
<plugins>
- <plugin><!-- shade Xpp3DomUtils that does not require Xpp3Dom.getInputLocation(): see MSHARED-921 -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>3.2.4</version><!-- TODO remove version once parent POM upgraded to 35 -->
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <artifactSet>
- <includes>
- <include>org.codehaus.plexus:plexus-utils</include>
- </includes>
- </artifactSet>
- <filters>
- <filter>
- <artifact>org.codehaus.plexus:plexus-utils</artifact>
- <includes>
- <include>org/codehaus/plexus/util/xml/Xpp3DomUtils.class</include>
- </includes>
- </filter>
- </filters>
- <relocations>
- <relocation>
- <pattern>org.codehaus.plexus.util.xml.Xpp3DomUtils</pattern>
- <shadedPattern>org.apache.maven.reporting.exec.xml.Xpp3DomUtils</shadedPattern>
- </relocation>
- </relocations>
- </configuration>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<localRepository>${settings.localRepository}</localRepository>
- <mavenHome>${env.M2_HOME}</mavenHome>
</systemPropertyVariables>
<!--
<forkMode>none</forkMode>
@@ -277,39 +239,8 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-metadata</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>generate-metadata</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <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>
+ <groupId>org.eclipse.sisu</groupId>
+ <artifactId>sisu-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -329,8 +260,6 @@
<properties>
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
- <!-- e.g. ensure that Java7 picks up TLSv1.2 when connecting with Central -->
- <https.protocols>${https.protocols}</https.protocols>
</properties>
</configuration>
<executions>
=====================================
src/it/forked-lifecycle/pom.xml
=====================================
@@ -65,7 +65,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>3.3.1</version>
+ <version>3.10.1</version>
</plugin>
</plugins>
</reporting>
=====================================
src/it/pluginManagement_dependencies/pom.xml
=====================================
@@ -32,20 +32,7 @@ under the License.
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.10</version>
- <dependencies>
- <dependency>
- <groupId>com.puppycrawl.tools</groupId>
- <artifactId>checkstyle</artifactId>
- <version>5.8</version>
- <exclusions>
- <exclusion>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
+ <version>3.5.0</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
=====================================
src/it/pluginManagement_dependencies/verify.groovy
=====================================
@@ -21,6 +21,6 @@
content = new File( basedir, 'build.log' ).text;
assert !content.contains( 'com.puppycrawl.tools:checkstyle:jar:5.6' );
-assert content.contains( 'com.puppycrawl.tools:checkstyle:jar:5.8' );
+assert content.contains( 'com.puppycrawl.tools:checkstyle:jar:9.3' );
-return true;
\ No newline at end of file
+return true;
=====================================
src/it/reportConfig/invoker.properties
=====================================
@@ -5,9 +5,9 @@
# 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
@@ -19,4 +19,3 @@ invoker.goals.1 = clean install
invoker.debug.1 = false
invoker.goals.2 = -Preporting site
invoker.debug.2 = true
-invoker.maven.version = 3.0+
\ No newline at end of file
=====================================
src/it/reportConfig/pom.xml
=====================================
@@ -36,13 +36,26 @@ under the License.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <mavenPluginToolsVersion>3.15.0</mavenPluginToolsVersion>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
- <version>3.1.0</version>
+ <version>4.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>@mavenVersion@</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>${mavenPluginToolsVersion}</version>
+ <scope>provided</scope>
</dependency>
</dependencies>
@@ -61,6 +74,14 @@ under the License.
</dependency>
</dependencies>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>${mavenPluginToolsVersion}</version>
+ <configuration>
+ <goalPrefix>report-config</goalPrefix>
+ </configuration>
+ </plugin>
</plugins>
</pluginManagement>
</build>
=====================================
src/it/reportConfig/src/main/java/org/apache/maven/shared/it/ConfigurationReport.java
=====================================
@@ -20,8 +20,9 @@ package org.apache.maven.shared.it;
*/
import org.apache.maven.doxia.sink.Sink;
-import org.apache.maven.doxia.siterenderer.Renderer;
-import org.apache.maven.project.MavenProject;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.MavenReportException;
@@ -30,47 +31,40 @@ import java.util.Locale;
/**
* Report that displays effective parameter values: used to check how report values
* are inherited/overridden from build.pluginManagement and not build.plugins.
- *
- * @goal test
- * @phase site
*/
+ at Mojo( name = "test", defaultPhase = LifecyclePhase.SITE )
public class ConfigurationReport
extends AbstractMavenReport
{
/**
* Parameter with value defined in pluginManagement
- *
- * @parameter default-value="default"
*/
+ @Parameter( defaultValue = "${pluginManagement}" )
private String pluginManagement;
/**
* Parameter with value defined in build.plugins
- *
- * @parameter default-value="default"
*/
+ @Parameter( defaultValue = "${buildPlugin}" )
private String buildPlugin;
/**
* Parameter with value defined both in build.plugins and pluginManagement
- *
- * @parameter default-value="default"
*/
+ @Parameter( defaultValue = "${buildAndManagement}" )
private String buildAndManagement;
/**
* Parameter with value defined both in build.plugins, pluginManagement and reporting.plugin.
- *
- * @parameter default-value="default"
*/
+ @Parameter( defaultValue = "${reportingPlugin}" )
private String reportingPlugin;
/**
* Parameter with value defined both in build.plugins, pluginManagement, reporting.plugin and
* reporting.plugin.reportSet.
- *
- * @parameter default-value="default"
*/
+ @Parameter( defaultValue = "${reportingPluginReportSet}" )
private String reportingPluginReportSet;
public String getOutputName()
@@ -88,24 +82,6 @@ public class ConfigurationReport
return "Report Configuration";
}
- @Override
- protected Renderer getSiteRenderer()
- {
- return null;
- }
-
- @Override
- protected String getOutputDirectory()
- {
- return null;
- }
-
- @Override
- protected MavenProject getProject()
- {
- return null;
- }
-
@Override
protected void executeReport( Locale locale )
throws MavenReportException
=====================================
src/it/reportConfig/verify.groovy
=====================================
@@ -24,7 +24,7 @@ content = f.text;
// parameter merged from pluginManagement
assert content.contains( 'pluginManagement = pluginManagement' );
// parameter from build.plugin is not merged
-assert content.contains( 'buildPlugin = default' );
+assert content.contains( 'buildPlugin = null' );
// parameter from build.plugin is not merged but pluginManagement
assert content.contains( 'buildAndManagement = pluginManagement' );
// parameter from reporting.plugin wins over pluginManagement
@@ -32,4 +32,4 @@ assert content.contains( 'reportingPlugin = reporting.plugin' );
// parameter from reporting.plugin.reportSet wins over reporting.plugin and pluginManagement
assert content.contains( 'reportingPluginReportSet = reporting.plugin.reportSet' );
-return true;
\ No newline at end of file
+return true;
=====================================
src/main/java/org/apache/maven/reporting/exec/DefaultMavenPluginManagerHelper.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.reporting.exec;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,11 @@ package org.apache.maven.reporting.exec;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.reporting.exec;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
import java.util.List;
@@ -29,50 +32,51 @@ import org.apache.maven.plugin.PluginContainerException;
import org.apache.maven.plugin.PluginDescriptorParsingException;
import org.apache.maven.plugin.PluginResolutionException;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.logging.Logger;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.util.filter.ExclusionsDependencyFilter;
+import static java.util.Objects.requireNonNull;
+
/**
* <p>DefaultMavenPluginManagerHelper class.</p>
*/
- at Component( role = MavenPluginManagerHelper.class )
-public class DefaultMavenPluginManagerHelper
- implements MavenPluginManagerHelper
-{
- @Requirement
- private Logger logger;
+ at Singleton
+ at Named
+public class DefaultMavenPluginManagerHelper implements MavenPluginManagerHelper {
+ private final MavenPluginManager mavenPluginManager;
- @Requirement
- protected MavenPluginManager mavenPluginManager;
+ @Inject
+ public DefaultMavenPluginManagerHelper(MavenPluginManager mavenPluginManager) {
+ this.mavenPluginManager = requireNonNull(mavenPluginManager);
+ }
- private DependencyFilter createExclusionsDependencyFilter( List<String> artifactIdsList )
- {
- return new ExclusionsDependencyFilter( artifactIdsList );
+ private DependencyFilter createExclusionsDependencyFilter(List<String> artifactIdsList) {
+ return new ExclusionsDependencyFilter(artifactIdsList);
}
/** {@inheritDoc} */
@Override
- public PluginDescriptor getPluginDescriptor( Plugin plugin, MavenSession session )
- throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException
- {
+ public PluginDescriptor getPluginDescriptor(Plugin plugin, MavenSession session)
+ throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException {
RepositorySystemSession repositorySystemSession = session.getRepositorySession();
- List<RemoteRepository> remoteRepositories = session.getCurrentProject().getRemotePluginRepositories();
+ List<RemoteRepository> remotePluginRepositories =
+ session.getCurrentProject().getRemotePluginRepositories();
- return mavenPluginManager.getPluginDescriptor( plugin, remoteRepositories, repositorySystemSession );
+ return mavenPluginManager.getPluginDescriptor(plugin, remotePluginRepositories, repositorySystemSession);
}
/** {@inheritDoc} */
@Override
- public void setupPluginRealm( PluginDescriptor pluginDescriptor, MavenSession session, ClassLoader parent,
- List<String> imports, List<String> excludeArtifactIds )
- throws PluginResolutionException, PluginContainerException
- {
+ public void setupPluginRealm(
+ PluginDescriptor pluginDescriptor,
+ MavenSession session,
+ ClassLoader parent,
+ List<String> imports,
+ List<String> excludeArtifactIds)
+ throws PluginResolutionException, PluginContainerException {
mavenPluginManager.setupPluginRealm(
- pluginDescriptor, session, parent, imports, createExclusionsDependencyFilter( excludeArtifactIds ) );
+ pluginDescriptor, session, parent, imports, createExclusionsDependencyFilter(excludeArtifactIds));
}
}
=====================================
src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.reporting.exec;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,11 @@ package org.apache.maven.reporting.exec;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.reporting.exec;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
import java.util.ArrayList;
import java.util.Arrays;
@@ -46,13 +49,14 @@ import org.apache.maven.plugin.version.PluginVersionResolver;
import org.apache.maven.plugin.version.PluginVersionResult;
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.MavenReport;
-import org.apache.maven.shared.utils.StringUtils;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.configuration.PlexusConfiguration;
-import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.Xpp3DomUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static java.util.Objects.requireNonNull;
/**
* <p>
@@ -94,174 +98,167 @@ import org.codehaus.plexus.util.xml.Xpp3DomUtils;
*
* @author Olivier Lamy
*/
- at Component( role = MavenReportExecutor.class )
-public class DefaultMavenReportExecutor
- implements MavenReportExecutor
-{
- @Requirement
- private Logger logger;
-
- @Requirement
- protected MavenPluginManager mavenPluginManager;
-
- @Requirement
- protected MavenPluginManagerHelper mavenPluginManagerHelper;
-
- @Requirement
- protected LifecycleExecutor lifecycleExecutor;
-
- @Requirement
- protected PluginVersionResolver pluginVersionResolver;
-
- private static final List<String> IMPORTS = Arrays.asList( "org.apache.maven.reporting.MavenReport",
- "org.apache.maven.reporting.MavenMultiPageReport",
- "org.apache.maven.doxia.siterenderer.Renderer",
- "org.apache.maven.doxia.sink.SinkFactory",
- // TODO Will be removed with Doxia 2.0.0-M1
- "org.codehaus.doxia.sink.Sink",
- "org.apache.maven.doxia.sink.Sink",
- "org.apache.maven.doxia.sink.SinkEventAttributes",
- // TODO Will be removed with Doxia 2.0.0-M1
- "org.apache.maven.doxia.logging.LogEnabled",
- // TODO Will be removed with Doxia 2.0.0-M1
- "org.apache.maven.doxia.logging.Log" );
-
- private static final List<String> EXCLUDES = Arrays.asList( "doxia-site-renderer", "doxia-sink-api",
- "maven-reporting-api" );
+ at Singleton
+ at Named
+public class DefaultMavenReportExecutor implements MavenReportExecutor {
+ private static final Logger LOGGER = LoggerFactory.getLogger(DefaultMavenReportExecutor.class);
+
+ private final MavenPluginManager mavenPluginManager;
+
+ private final MavenPluginManagerHelper mavenPluginManagerHelper;
+
+ private final LifecycleExecutor lifecycleExecutor;
+
+ private final PluginVersionResolver pluginVersionResolver;
+
+ private static final List<String> IMPORTS = Arrays.asList(
+ "org.apache.maven.reporting.MavenReport",
+ "org.apache.maven.reporting.MavenMultiPageReport",
+ // TODO Will be removed after Doxia 2.0.0
+ "org.apache.maven.doxia.siterenderer.Renderer",
+ "org.apache.maven.doxia.siterenderer.SiteRenderer",
+ "org.apache.maven.doxia.sink.SinkFactory",
+ // TODO Will be removed after Doxia 2.0.0
+ "org.codehaus.doxia.sink.Sink",
+ "org.apache.maven.doxia.sink.Sink",
+ "org.apache.maven.doxia.sink.SinkEventAttributes",
+ // TODO Will be removed with Doxia 2.0.0
+ "org.apache.maven.doxia.logging.LogEnabled",
+ // TODO Will be removed with Doxia 2.0.0
+ "org.apache.maven.doxia.logging.Log");
+
+ private static final List<String> EXCLUDES =
+ Arrays.asList("doxia-site-renderer", "doxia-sink-api", "maven-reporting-api");
+
+ @Inject
+ public DefaultMavenReportExecutor(
+ MavenPluginManager mavenPluginManager,
+ MavenPluginManagerHelper mavenPluginManagerHelper,
+ LifecycleExecutor lifecycleExecutor,
+ PluginVersionResolver pluginVersionResolver) {
+ this.mavenPluginManager = requireNonNull(mavenPluginManager);
+ this.mavenPluginManagerHelper = requireNonNull(mavenPluginManagerHelper);
+ this.lifecycleExecutor = requireNonNull(lifecycleExecutor);
+ this.pluginVersionResolver = requireNonNull(pluginVersionResolver);
+ }
@Override
- public List<MavenReportExecution> buildMavenReports( MavenReportExecutorRequest mavenReportExecutorRequest )
- throws MojoExecutionException
- {
- if ( mavenReportExecutorRequest.getReportPlugins() == null )
- {
+ public List<MavenReportExecution> buildMavenReports(MavenReportExecutorRequest mavenReportExecutorRequest)
+ throws MojoExecutionException {
+ if (mavenReportExecutorRequest.getReportPlugins() == null) {
return Collections.emptyList();
}
- getLog().debug( "DefaultMavenReportExecutor.buildMavenReports()" );
Set<String> reportPluginKeys = new HashSet<>();
List<MavenReportExecution> reportExecutions = new ArrayList<>();
String pluginKey = "";
- try
- {
- for ( ReportPlugin reportPlugin : mavenReportExecutorRequest.getReportPlugins() )
- {
+ try {
+ for (ReportPlugin reportPlugin : mavenReportExecutorRequest.getReportPlugins()) {
pluginKey = reportPlugin.getGroupId() + ':' + reportPlugin.getArtifactId();
- if ( !reportPluginKeys.add( pluginKey ) )
- {
- logger.info( "plugin " + pluginKey + " will be executed more than one time" );
+ if (!reportPluginKeys.add(pluginKey)) {
+ LOGGER.info("Plugin {} will be executed more than one time", pluginKey);
}
- reportExecutions.addAll( buildReportPlugin( mavenReportExecutorRequest, reportPlugin ) );
+ reportExecutions.addAll(buildReportPlugin(mavenReportExecutorRequest, reportPlugin));
}
- }
- catch ( Exception e )
- {
- throw new MojoExecutionException( "failed to get report for " + pluginKey, e );
+ } catch (Exception e) {
+ throw new MojoExecutionException("Failed to get report for " + pluginKey, e);
}
return reportExecutions;
}
- protected List<MavenReportExecution> buildReportPlugin( MavenReportExecutorRequest mavenReportExecutorRequest,
- ReportPlugin reportPlugin )
- throws Exception
- {
+ protected List<MavenReportExecution> buildReportPlugin(
+ MavenReportExecutorRequest mavenReportExecutorRequest, ReportPlugin reportPlugin) throws Exception {
// step 1: prepare the plugin
Plugin plugin = new Plugin();
- plugin.setGroupId( reportPlugin.getGroupId() );
- plugin.setArtifactId( reportPlugin.getArtifactId() );
- plugin.setVersion( resolvePluginVersion( reportPlugin, mavenReportExecutorRequest ) );
- logger.info( "configuring report plugin " + plugin.getId() );
+ plugin.setGroupId(reportPlugin.getGroupId());
+ plugin.setArtifactId(reportPlugin.getArtifactId());
+ plugin.setVersion(resolvePluginVersion(reportPlugin, mavenReportExecutorRequest));
+ LOGGER.info("Configuring report plugin {}:{}", plugin.getArtifactId(), plugin.getVersion());
- mergePluginToReportPlugin( mavenReportExecutorRequest, plugin, reportPlugin );
+ mergePluginToReportPlugin(mavenReportExecutorRequest, plugin, reportPlugin);
PluginDescriptor pluginDescriptor =
- mavenPluginManagerHelper.getPluginDescriptor( plugin, mavenReportExecutorRequest.getMavenSession() );
+ mavenPluginManagerHelper.getPluginDescriptor(plugin, mavenReportExecutorRequest.getMavenSession());
// step 2: prepare the goals
List<GoalWithConf> goalsWithConfiguration = new ArrayList<>();
- boolean hasUserDefinedReports = prepareGoals( reportPlugin, pluginDescriptor, goalsWithConfiguration );
+ boolean hasUserDefinedReports = prepareGoals(reportPlugin, pluginDescriptor, goalsWithConfiguration);
// step 3: prepare the reports
- List<MavenReportExecution> reports = new ArrayList<>( goalsWithConfiguration.size() );
- for ( GoalWithConf report : goalsWithConfiguration )
- {
+ List<MavenReportExecution> reports = new ArrayList<>(goalsWithConfiguration.size());
+ for (GoalWithConf report : goalsWithConfiguration) {
MavenReportExecution mavenReportExecution =
- prepareReportExecution( mavenReportExecutorRequest, report, hasUserDefinedReports );
+ prepareReportExecution(mavenReportExecutorRequest, report, hasUserDefinedReports);
- if ( mavenReportExecution != null )
- {
+ if (mavenReportExecution != null) {
// ok, report is ready to generate
- reports.add( mavenReportExecution );
+ reports.add(mavenReportExecution);
}
}
- if ( !reports.isEmpty() )
- {
+ if (!reports.isEmpty()) {
// log reports, either configured or detected
StringBuilder buff = new StringBuilder();
- for ( MavenReportExecution mre : reports )
- {
- if ( buff.length() > 0 )
- {
- buff.append( ", " );
+ for (MavenReportExecution mre : reports) {
+ if (buff.length() > 0) {
+ buff.append(", ");
}
- buff.append( mre.getGoal() );
+ buff.append(mre.getGoal());
}
- logger.info( reports.size() + " report" + ( reports.size() > 1 ? "s" : "" ) + " "
- + ( hasUserDefinedReports ? "configured" : "detected" ) + " for " + plugin.getArtifactId() + ":"
- + plugin.getVersion() + ": " + buff );
+ LOGGER.info(
+ "{} {} report{} for {}:{}: {}",
+ (hasUserDefinedReports ? "Configured" : "Detected"),
+ reports.size(),
+ (reports.size() > 1 ? "s" : ""),
+ plugin.getArtifactId(),
+ plugin.getVersion(),
+ buff);
+ } else if (!hasUserDefinedReports) {
+ LOGGER.warn(
+ "Ignoring report plugin {}:{},"
+ + " it does not contain any report goals: should be removed from reporting configuration in POM",
+ plugin.getArtifactId(),
+ plugin.getVersion());
}
return reports;
}
- private boolean prepareGoals( ReportPlugin reportPlugin, PluginDescriptor pluginDescriptor,
- List<GoalWithConf> goalsWithConfiguration )
- {
- if ( reportPlugin.getReportSets().isEmpty() && reportPlugin.getReports().isEmpty() )
- {
- // by default, use every goal, which will be filtered later to only keep reporting goals
+ private boolean prepareGoals(
+ ReportPlugin reportPlugin, PluginDescriptor pluginDescriptor, List<GoalWithConf> goalsWithConfiguration) {
+ if (reportPlugin.getReportSets().isEmpty() && reportPlugin.getReports().isEmpty()) {
+ // by default, use every goal which will be filtered later to only keep reporting goals
List<MojoDescriptor> mojoDescriptors = pluginDescriptor.getMojos();
- for ( MojoDescriptor mojoDescriptor : mojoDescriptors )
- {
- goalsWithConfiguration.add( new GoalWithConf( reportPlugin, pluginDescriptor, mojoDescriptor.getGoal(),
- mojoDescriptor.getConfiguration() ) );
+ for (MojoDescriptor mojoDescriptor : mojoDescriptors) {
+ goalsWithConfiguration.add(new GoalWithConf(
+ reportPlugin, pluginDescriptor, mojoDescriptor.getGoal(), mojoDescriptor.getConfiguration()));
}
return false;
}
Set<String> goals = new HashSet<>();
- for ( String report : reportPlugin.getReports() )
- {
- if ( goals.add( report ) )
- {
- goalsWithConfiguration.add( new GoalWithConf( reportPlugin, pluginDescriptor, report,
- reportPlugin.getConfiguration() ) );
- }
- else
- {
- logger.warn( report + " report is declared twice in default reports" );
+ for (String report : reportPlugin.getReports()) {
+ if (goals.add(report)) {
+ goalsWithConfiguration.add(
+ new GoalWithConf(reportPlugin, pluginDescriptor, report, reportPlugin.getConfiguration()));
+ } else {
+ LOGGER.warn("{} report is declared twice in default reports", report);
}
}
- for ( ReportSet reportSet : reportPlugin.getReportSets() )
- {
+ for (ReportSet reportSet : reportPlugin.getReportSets()) {
goals = new HashSet<>();
- for ( String report : reportSet.getReports() )
- {
- if ( goals.add( report ) )
- {
- goalsWithConfiguration.add( new GoalWithConf( reportPlugin, pluginDescriptor, report,
- reportSet.getConfiguration() ) );
- }
- else
- {
- logger.warn( report + " report is declared twice in " + reportSet.getId() + " reportSet" );
+ for (String report : reportSet.getReports()) {
+ if (goals.add(report)) {
+ goalsWithConfiguration.add(
+ new GoalWithConf(reportPlugin, pluginDescriptor, report, reportSet.getConfiguration()));
+ } else {
+ LOGGER.warn("{} report is declared twice in {} reportSet", report, reportSet.getId());
}
}
}
@@ -269,203 +266,189 @@ public class DefaultMavenReportExecutor
return true;
}
- private MavenReportExecution prepareReportExecution( MavenReportExecutorRequest mavenReportExecutorRequest,
- GoalWithConf report, boolean hasUserDefinedReports )
- throws Exception
- {
+ private MavenReportExecution prepareReportExecution(
+ MavenReportExecutorRequest mavenReportExecutorRequest, GoalWithConf report, boolean userDefined)
+ throws Exception {
ReportPlugin reportPlugin = report.getReportPlugin();
PluginDescriptor pluginDescriptor = report.getPluginDescriptor();
- MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( report.getGoal() );
- if ( mojoDescriptor == null )
- {
- throw new MojoNotFoundException( report.getGoal(), pluginDescriptor );
+ MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo(report.getGoal());
+ if (mojoDescriptor == null) {
+ throw new MojoNotFoundException(report.getGoal(), pluginDescriptor);
}
MavenProject project = mavenReportExecutorRequest.getProject();
- if ( !hasUserDefinedReports && mojoDescriptor.isAggregator() && !canAggregate( project ) )
- {
+ if (!userDefined && mojoDescriptor.isAggregator() && !canAggregate(project)) {
// aggregator mojos automatically added from plugin are only run at execution root
return null;
}
- MojoExecution mojoExecution = new MojoExecution( pluginDescriptor.getPlugin(), report.getGoal(), null );
+ MojoExecution mojoExecution = new MojoExecution(
+ pluginDescriptor.getPlugin(), report.getGoal(), mavenReportExecutorRequest.getExecutionId());
- mojoExecution.setMojoDescriptor( mojoDescriptor );
+ mojoExecution.setMojoDescriptor(mojoDescriptor);
- mavenPluginManagerHelper.setupPluginRealm( pluginDescriptor, mavenReportExecutorRequest.getMavenSession(),
- Thread.currentThread().getContextClassLoader(), IMPORTS,
- EXCLUDES );
+ mavenPluginManagerHelper.setupPluginRealm(
+ pluginDescriptor,
+ mavenReportExecutorRequest.getMavenSession(),
+ Thread.currentThread().getContextClassLoader(),
+ IMPORTS,
+ EXCLUDES);
- if ( !isMavenReport( mojoExecution, pluginDescriptor ) )
- {
- if ( hasUserDefinedReports )
- {
+ if (!isMavenReport(mojoExecution, pluginDescriptor)) {
+ if (userDefined) {
// reports were explicitly written in the POM
- logger.warn( "ignoring " + mojoExecution.getPlugin().getId() + ':' + report.getGoal()
- + " goal since it is not a report: should be removed from reporting configuration in POM" );
+ LOGGER.warn(
+ "Ignoring {}:{}"
+ + " goal since it is not a report: should be removed from reporting configuration in POM",
+ mojoExecution.getPlugin().getId(),
+ report.getGoal());
+ } else {
+ LOGGER.debug(
+ "Ignoring {}:{} goal since it is not a report",
+ mojoExecution.getPlugin().getId(),
+ report.getGoal());
}
return null;
}
Xpp3Dom pluginMgmtConfiguration = null;
- if ( project.getBuild() != null && project.getBuild().getPluginManagement() != null )
- {
- Plugin pluginMgmt = find( reportPlugin, project.getBuild().getPluginManagement().getPlugins() );
+ if (project.getBuild() != null && project.getBuild().getPluginManagement() != null) {
+ Plugin pluginMgmt =
+ find(reportPlugin, project.getBuild().getPluginManagement().getPlugins());
- if ( pluginMgmt != null )
- {
+ if (pluginMgmt != null) {
pluginMgmtConfiguration = (Xpp3Dom) pluginMgmt.getConfiguration();
}
}
- mojoExecution.setConfiguration( mergeConfiguration( mojoDescriptor.getMojoConfiguration(),
- pluginMgmtConfiguration,
- reportPlugin.getConfiguration(),
- report.getConfiguration(),
- mojoDescriptor.getParameterMap().keySet() ) );
+ mojoExecution.setConfiguration(mergeConfiguration(
+ mojoDescriptor.getMojoConfiguration(),
+ pluginMgmtConfiguration,
+ reportPlugin.getConfiguration(),
+ report.getConfiguration(),
+ mojoDescriptor.getParameterMap().keySet()));
- MavenReport mavenReport =
- getConfiguredMavenReport( mojoExecution, pluginDescriptor, mavenReportExecutorRequest );
+ MavenReport mavenReport = getConfiguredMavenReport(mojoExecution, pluginDescriptor, mavenReportExecutorRequest);
- MavenReportExecution mavenReportExecution =
- new MavenReportExecution( report.getGoal(), mojoExecution.getPlugin(), mavenReport,
- pluginDescriptor.getClassRealm() );
+ MavenReportExecution mavenReportExecution = new MavenReportExecution(
+ report.getGoal(),
+ mojoExecution.getPlugin(),
+ mavenReport,
+ pluginDescriptor.getClassRealm(),
+ userDefined);
- lifecycleExecutor.calculateForkedExecutions( mojoExecution,
- mavenReportExecutorRequest.getMavenSession() );
+ lifecycleExecutor.calculateForkedExecutions(mojoExecution, mavenReportExecutorRequest.getMavenSession());
- if ( !mojoExecution.getForkedExecutions().isEmpty() )
- {
+ if (!mojoExecution.getForkedExecutions().isEmpty()) {
String reportDescription = pluginDescriptor.getArtifactId() + ":" + report.getGoal() + " report";
String execution;
- if ( StringUtils.isNotEmpty( mojoDescriptor.getExecutePhase() ) )
- {
+ if (StringUtils.isNotEmpty(mojoDescriptor.getExecutePhase())) {
// forked phase
execution = "'"
- + ( StringUtils.isEmpty( mojoDescriptor.getExecuteLifecycle() ) ? ""
- : ( '[' + mojoDescriptor.getExecuteLifecycle() + ']' ) )
- + mojoDescriptor.getExecutePhase() + "' forked phase execution";
- }
- else
- {
+ + (StringUtils.isEmpty(mojoDescriptor.getExecuteLifecycle())
+ ? ""
+ : ('[' + mojoDescriptor.getExecuteLifecycle() + ']'))
+ + mojoDescriptor.getExecutePhase() + "' forked phase execution";
+ } else {
// forked goal
execution = "'" + mojoDescriptor.getExecuteGoal() + "' forked goal execution";
}
- logger.info( "preparing " + reportDescription + " requires " + execution );
+ LOGGER.info("Preparing {} requires {}", reportDescription, execution);
- lifecycleExecutor.executeForkedExecutions( mojoExecution,
- mavenReportExecutorRequest.getMavenSession() );
+ lifecycleExecutor.executeForkedExecutions(mojoExecution, mavenReportExecutorRequest.getMavenSession());
- logger.info( execution + " for " + reportDescription + " preparation done" );
+ LOGGER.info("{} for {} preparation done", execution, reportDescription);
}
return mavenReportExecution;
}
- private boolean canAggregate( MavenProject project )
- {
- return project.isExecutionRoot() && "pom".equals( project.getPackaging() ) && ( project.getModules() != null )
- && !project.getModules().isEmpty();
+ private boolean canAggregate(MavenProject project) {
+ return project.isExecutionRoot()
+ && "pom".equals(project.getPackaging())
+ && (project.getModules() != null)
+ && !project.getModules().isEmpty();
}
- private MavenReport getConfiguredMavenReport( MojoExecution mojoExecution, PluginDescriptor pluginDescriptor,
- MavenReportExecutorRequest mavenReportExecutorRequest )
- throws PluginContainerException, PluginConfigurationException
- {
- try
- {
- Mojo mojo =
- mavenPluginManager.getConfiguredMojo( Mojo.class, mavenReportExecutorRequest.getMavenSession(),
- mojoExecution );
+ private MavenReport getConfiguredMavenReport(
+ MojoExecution mojoExecution,
+ PluginDescriptor pluginDescriptor,
+ MavenReportExecutorRequest mavenReportExecutorRequest)
+ throws PluginContainerException, PluginConfigurationException {
+ try {
+ Mojo mojo = mavenPluginManager.getConfiguredMojo(
+ Mojo.class, mavenReportExecutorRequest.getMavenSession(), mojoExecution);
return (MavenReport) mojo;
- }
- catch ( ClassCastException e )
- {
- getLog().warn( "skip ClassCastException " + e.getMessage() );
- return null;
- }
- catch ( PluginContainerException e )
- {
- /*
- * ignore old plugin which are using removed PluginRegistry [INFO] Caused by:
- * java.lang.NoClassDefFoundError: org/apache/maven/plugin/registry/PluginRegistry
- */
- if ( e.getCause() != null && e.getCause() instanceof NoClassDefFoundError
- && e.getMessage().contains( "PluginRegistry" ) )
- {
- getLog().warn( "skip NoClassDefFoundError with PluginRegistry " );
- // too noisy, only in debug mode + e.getMessage() );
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( e.getMessage(), e );
- }
- return null;
+ } catch (ClassCastException e) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.warn("Skipping ClassCastException", e);
+ } else {
+ LOGGER.warn("Skipping ClassCastException");
}
- throw e;
+ return null;
}
}
- private boolean isMavenReport( MojoExecution mojoExecution, PluginDescriptor pluginDescriptor )
- {
+ private boolean isMavenReport(MojoExecution mojoExecution, PluginDescriptor pluginDescriptor) {
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
// get the plugin's goal Mojo class
Class<?> mojoClass;
- try
- {
- Thread.currentThread().setContextClassLoader( mojoExecution.getMojoDescriptor().getRealm() );
-
- mojoClass =
- pluginDescriptor.getClassRealm().loadClass( mojoExecution.getMojoDescriptor().getImplementation() );
- }
- catch ( ClassNotFoundException e )
- {
- getLog().warn( "skip ClassNotFoundException mojoExecution.goal '" + mojoExecution.getGoal() + "': "
- + e.getMessage(), e );
+ try {
+ Thread.currentThread()
+ .setContextClassLoader(mojoExecution.getMojoDescriptor().getRealm());
+
+ mojoClass = pluginDescriptor
+ .getClassRealm()
+ .loadClass(mojoExecution.getMojoDescriptor().getImplementation());
+ } catch (ClassNotFoundException e) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.warn("Skipping ClassNotFoundException mojoExecution.goal {}", mojoExecution.getGoal(), e);
+ } else {
+ LOGGER.warn("Skipping ClassNotFoundException mojoExecution.goal {}", mojoExecution.getGoal());
+ }
return false;
- }
- finally
- {
- Thread.currentThread().setContextClassLoader( originalClassLoader );
+ } finally {
+ Thread.currentThread().setContextClassLoader(originalClassLoader);
}
// check if it is a report
- try
- {
- Thread.currentThread().setContextClassLoader( mojoExecution.getMojoDescriptor().getRealm() );
- MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( mojoExecution.getGoal() );
-
- boolean isMavenReport = MavenReport.class.isAssignableFrom( mojoClass );
-
- if ( getLog().isDebugEnabled() )
- {
- if ( mojoDescriptor != null && mojoDescriptor.getImplementationClass() != null )
- {
- getLog().debug( "class " + mojoDescriptor.getImplementationClass().getName() + " isMavenReport: "
- + isMavenReport );
+ try {
+ Thread.currentThread()
+ .setContextClassLoader(mojoExecution.getMojoDescriptor().getRealm());
+ MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo(mojoExecution.getGoal());
+
+ boolean isMavenReport = MavenReport.class.isAssignableFrom(mojoClass);
+
+ if (LOGGER.isDebugEnabled()) {
+ if (mojoDescriptor != null && mojoDescriptor.getImplementationClass() != null) {
+ LOGGER.debug(
+ "Class {} is {}a MavenReport",
+ mojoDescriptor.getImplementationClass().getName(),
+ isMavenReport ? "" : "NOT ");
}
- if ( !isMavenReport )
- {
- getLog().debug( "skip non MavenReport " + mojoExecution.getMojoDescriptor().getId() );
+ if (!isMavenReport) {
+ LOGGER.debug(
+ "Skipping non-MavenReport {}",
+ mojoExecution.getMojoDescriptor().getId());
}
}
return isMavenReport;
- }
- catch ( LinkageError e )
- {
- getLog().warn( "skip LinkageError mojoExecution.goal '" + mojoExecution.getGoal() + "': " + e.getMessage(),
- e );
+ } catch (LinkageError e) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.warn("Skipping LinkageError mojoExecution.goal {}", mojoExecution.getGoal(), e);
+ } else {
+ LOGGER.warn("Skipping LinkageError mojoExecution.goal {}", mojoExecution.getGoal());
+ }
return false;
- }
- finally
- {
- Thread.currentThread().setContextClassLoader( originalClassLoader );
+ } finally {
+ Thread.currentThread().setContextClassLoader(originalClassLoader);
}
}
@@ -480,32 +463,30 @@ public class DefaultMavenReportExecutor
* @param parameters set of supported parameters: any other parameter will be removed
* @return the effective configuration to be used
*/
- private Xpp3Dom mergeConfiguration( PlexusConfiguration mojoConf, Xpp3Dom pluginMgmtConfig,
- PlexusConfiguration pluginConf, PlexusConfiguration reportSetConf,
- Set<String> parameters )
- {
- Xpp3Dom mojoConfig = ( mojoConf != null ) ? convert( mojoConf ) : new Xpp3Dom( "configuration" );
+ private Xpp3Dom mergeConfiguration(
+ PlexusConfiguration mojoConf,
+ Xpp3Dom pluginMgmtConfig,
+ PlexusConfiguration pluginConf,
+ PlexusConfiguration reportSetConf,
+ Set<String> parameters) {
+ Xpp3Dom mojoConfig = (mojoConf != null) ? convert(mojoConf) : new Xpp3Dom("configuration");
- if ( pluginMgmtConfig != null || pluginConf != null || reportSetConf != null )
- {
- Xpp3Dom pluginConfig = ( pluginConf == null ) ? new Xpp3Dom( "fake" ) : convert( pluginConf );
+ if (pluginMgmtConfig != null || pluginConf != null || reportSetConf != null) {
+ Xpp3Dom pluginConfig = (pluginConf == null) ? new Xpp3Dom("fake") : convert(pluginConf);
// merge pluginConf into reportSetConf
- Xpp3Dom mergedConfig = Xpp3DomUtils.mergeXpp3Dom( convert( reportSetConf ), pluginConfig );
+ Xpp3Dom mergedConfig = Xpp3DomUtils.mergeXpp3Dom(convert(reportSetConf), pluginConfig);
// then merge pluginMgmtConfig
- mergedConfig = Xpp3DomUtils.mergeXpp3Dom( mergedConfig, pluginMgmtConfig );
+ mergedConfig = Xpp3DomUtils.mergeXpp3Dom(mergedConfig, pluginMgmtConfig);
// then merge mojoConf
- mergedConfig = Xpp3DomUtils.mergeXpp3Dom( mergedConfig, mojoConfig );
+ mergedConfig = Xpp3DomUtils.mergeXpp3Dom(mergedConfig, mojoConfig);
// clean result
- Xpp3Dom cleanedConfig = new Xpp3Dom( "configuration" );
- if ( mergedConfig.getChildren() != null )
- {
- for ( Xpp3Dom parameter : mergedConfig.getChildren() )
- {
- if ( parameters.contains( parameter.getName() ) )
- {
- cleanedConfig.addChild( parameter );
+ Xpp3Dom cleanedConfig = new Xpp3Dom("configuration");
+ if (mergedConfig.getChildren() != null) {
+ for (Xpp3Dom parameter : mergedConfig.getChildren()) {
+ if (parameters.contains(parameter.getName())) {
+ cleanedConfig.addChild(parameter);
}
}
}
@@ -516,34 +497,25 @@ public class DefaultMavenReportExecutor
return mojoConfig;
}
- private Xpp3Dom convert( PlexusConfiguration config )
- {
- if ( config == null )
- {
+ private Xpp3Dom convert(PlexusConfiguration config) {
+ if (config == null) {
return null;
}
- Xpp3Dom dom = new Xpp3Dom( config.getName() );
- dom.setValue( config.getValue( null ) );
+ Xpp3Dom dom = new Xpp3Dom(config.getName());
+ dom.setValue(config.getValue(null));
- for ( String attrib : config.getAttributeNames() )
- {
- dom.setAttribute( attrib, config.getAttribute( attrib, null ) );
+ for (String attrib : config.getAttributeNames()) {
+ dom.setAttribute(attrib, config.getAttribute(attrib, null));
}
- for ( int n = config.getChildCount(), i = 0; i < n; i++ )
- {
- dom.addChild( convert( config.getChild( i ) ) );
+ for (int n = config.getChildCount(), i = 0; i < n; i++) {
+ dom.addChild(convert(config.getChild(i)));
}
return dom;
}
- private Logger getLog()
- {
- return logger;
- }
-
/**
* Resolve report plugin version. Steps to find a plugin version stop after each step if a non <code>null</code>
* value has been found:
@@ -560,81 +532,65 @@ public class DefaultMavenReportExecutor
* @return the report plugin version
* @throws PluginVersionResolutionException on plugin version resolution issue
*/
- protected String resolvePluginVersion( ReportPlugin reportPlugin,
- MavenReportExecutorRequest mavenReportExecutorRequest )
- throws PluginVersionResolutionException
- {
+ protected String resolvePluginVersion(
+ ReportPlugin reportPlugin, MavenReportExecutorRequest mavenReportExecutorRequest)
+ throws PluginVersionResolutionException {
String reportPluginKey = reportPlugin.getGroupId() + ':' + reportPlugin.getArtifactId();
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( "resolving version for " + reportPluginKey );
- }
+ LOGGER.debug("Resolving version for {}", reportPluginKey);
// look for version defined in the reportPlugin configuration
- if ( reportPlugin.getVersion() != null )
- {
- if ( getLog().isDebugEnabled() )
- {
- logger.debug( "resolved " + reportPluginKey + " version from the reporting.plugins section: "
- + reportPlugin.getVersion() );
- }
+ if (reportPlugin.getVersion() != null) {
+ LOGGER.debug(
+ "Resolved {} version from the reporting.plugins section: {}",
+ reportPluginKey,
+ reportPlugin.getVersion());
return reportPlugin.getVersion();
}
MavenProject project = mavenReportExecutorRequest.getProject();
// search in the build section
- if ( project.getBuild() != null )
- {
- Plugin plugin = find( reportPlugin, project.getBuild().getPlugins() );
-
- if ( plugin != null && plugin.getVersion() != null )
- {
- if ( getLog().isDebugEnabled() )
- {
- logger.debug( "resolved " + reportPluginKey + " version from the build.plugins section: "
- + plugin.getVersion() );
- }
+ if (project.getBuild() != null) {
+ Plugin plugin = find(reportPlugin, project.getBuild().getPlugins());
+
+ if (plugin != null && plugin.getVersion() != null) {
+ LOGGER.debug(
+ "Resolved {} version from the build.plugins section: {}", reportPluginKey, plugin.getVersion());
return plugin.getVersion();
}
}
// search in pluginManagement section
- if ( project.getBuild() != null && project.getBuild().getPluginManagement() != null )
- {
- Plugin plugin = find( reportPlugin, project.getBuild().getPluginManagement().getPlugins() );
-
- if ( plugin != null && plugin.getVersion() != null )
- {
- if ( getLog().isDebugEnabled() )
- {
- logger.debug( "resolved " + reportPluginKey
- + " version from the build.pluginManagement.plugins section: " + plugin.getVersion() );
- }
+ if (project.getBuild() != null && project.getBuild().getPluginManagement() != null) {
+ Plugin plugin =
+ find(reportPlugin, project.getBuild().getPluginManagement().getPlugins());
+
+ if (plugin != null && plugin.getVersion() != null) {
+ LOGGER.debug(
+ "Resolved {} version from the build.pluginManagement.plugins section: {}",
+ reportPluginKey,
+ plugin.getVersion());
return plugin.getVersion();
}
}
- logger.warn( "Report plugin " + reportPluginKey + " has an empty version." );
- logger.warn( "" );
- logger.warn( "It is highly recommended to fix these problems"
- + " because they threaten the stability of your build." );
- logger.warn( "" );
- logger.warn( "For this reason, future Maven versions might no"
- + " longer support building such malformed projects." );
+ LOGGER.warn("Report plugin {} has an empty version.", reportPluginKey);
+ LOGGER.warn("");
+ LOGGER.warn("It is highly recommended to fix these problems"
+ + " because they threaten the stability of your build.");
+ LOGGER.warn("");
+ LOGGER.warn("For this reason, future Maven versions might no"
+ + " longer support building such malformed projects.");
Plugin plugin = new Plugin();
- plugin.setGroupId( reportPlugin.getGroupId() );
- plugin.setArtifactId( reportPlugin.getArtifactId() );
+ plugin.setGroupId(reportPlugin.getGroupId());
+ plugin.setArtifactId(reportPlugin.getArtifactId());
PluginVersionRequest pluginVersionRequest =
- new DefaultPluginVersionRequest( plugin, mavenReportExecutorRequest.getMavenSession() );
+ new DefaultPluginVersionRequest(plugin, mavenReportExecutorRequest.getMavenSession());
- PluginVersionResult result = pluginVersionResolver.resolve( pluginVersionRequest );
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( "resolved " + reportPluginKey + " version from repository: " + result.getVersion() );
- }
+ PluginVersionResult result = pluginVersionResolver.resolve(pluginVersionRequest);
+ LOGGER.debug("Resolved {} version from repository: {}", reportPluginKey, result.getVersion());
return result.getVersion();
}
@@ -645,17 +601,13 @@ public class DefaultMavenReportExecutor
* @param plugins the candidate plugins
* @return the first similar plugin
*/
- private Plugin find( ReportPlugin reportPlugin, List<Plugin> plugins )
- {
- if ( plugins == null )
- {
+ private Plugin find(ReportPlugin reportPlugin, List<Plugin> plugins) {
+ if (plugins == null) {
return null;
}
- for ( Plugin plugin : plugins )
- {
- if ( Objects.equals( plugin.getArtifactId(), reportPlugin.getArtifactId() )
- && Objects.equals( plugin.getGroupId(), reportPlugin.getGroupId() ) )
- {
+ for (Plugin plugin : plugins) {
+ if (Objects.equals(plugin.getArtifactId(), reportPlugin.getArtifactId())
+ && Objects.equals(plugin.getGroupId(), reportPlugin.getGroupId())) {
return plugin;
}
}
@@ -677,26 +629,21 @@ public class DefaultMavenReportExecutor
* @param buildPlugin
* @param reportPlugin
*/
- private void mergePluginToReportPlugin( MavenReportExecutorRequest mavenReportExecutorRequest, Plugin buildPlugin,
- ReportPlugin reportPlugin )
- {
+ private void mergePluginToReportPlugin(
+ MavenReportExecutorRequest mavenReportExecutorRequest, Plugin buildPlugin, ReportPlugin reportPlugin) {
Build build = mavenReportExecutorRequest.getProject().getBuild();
- Plugin configuredPlugin = find( reportPlugin, build.getPlugins() );
- if ( configuredPlugin == null && build.getPluginManagement() != null )
- {
- configuredPlugin = find( reportPlugin, build.getPluginManagement().getPlugins() );
+ Plugin configuredPlugin = find(reportPlugin, build.getPlugins());
+ if (configuredPlugin == null && build.getPluginManagement() != null) {
+ configuredPlugin = find(reportPlugin, build.getPluginManagement().getPlugins());
}
- if ( configuredPlugin != null )
- {
- if ( !configuredPlugin.getDependencies().isEmpty() )
- {
- buildPlugin.getDependencies().addAll( configuredPlugin.getDependencies() );
+ if (configuredPlugin != null) {
+ if (!configuredPlugin.getDependencies().isEmpty()) {
+ buildPlugin.getDependencies().addAll(configuredPlugin.getDependencies());
}
}
}
- private static class GoalWithConf
- {
+ private static class GoalWithConf {
private final String goal;
private final PlexusConfiguration configuration;
@@ -705,32 +652,30 @@ public class DefaultMavenReportExecutor
private final PluginDescriptor pluginDescriptor;
- GoalWithConf( ReportPlugin reportPlugin, PluginDescriptor pluginDescriptor, String goal,
- PlexusConfiguration configuration )
- {
+ GoalWithConf(
+ ReportPlugin reportPlugin,
+ PluginDescriptor pluginDescriptor,
+ String goal,
+ PlexusConfiguration configuration) {
this.reportPlugin = reportPlugin;
this.pluginDescriptor = pluginDescriptor;
this.goal = goal;
this.configuration = configuration;
}
- public ReportPlugin getReportPlugin()
- {
+ public ReportPlugin getReportPlugin() {
return reportPlugin;
}
- public PluginDescriptor getPluginDescriptor()
- {
+ public PluginDescriptor getPluginDescriptor() {
return pluginDescriptor;
}
- public String getGoal()
- {
+ public String getGoal() {
return goal;
}
- public PlexusConfiguration getConfiguration()
- {
+ public PlexusConfiguration getConfiguration() {
return configuration;
}
}
=====================================
src/main/java/org/apache/maven/reporting/exec/MavenPluginManagerHelper.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.reporting.exec;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.reporting.exec;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.reporting.exec;
import java.util.List;
@@ -33,16 +32,15 @@ import org.apache.maven.plugin.descriptor.PluginDescriptor;
* {@link org.apache.maven.plugin.MavenPluginManager} helper to deal with API changes between Maven 3.0.x and 3.1.x, ie
* switch from Sonatype Aether (in <code>org.sonatype.aether</code> package) to Eclipse Aether (in
* <code>org.eclipse.aether</code> package) for some parameters.
- *
+ *
* @author Hervé Boutemy
* @since 1.1
*/
-public interface MavenPluginManagerHelper
-{
+public interface MavenPluginManagerHelper {
/**
* Helper for {@link org.apache.maven.plugin.MavenPluginManager#getPluginDescriptor
* MavenPluginManager#getPluginDescriptor(Plugin, List, xxx.aether.RepositorySystemSession)}
- *
+ *
* @param plugin the plugin
* @param session the session
* @return the plugin descriptor
@@ -50,13 +48,13 @@ public interface MavenPluginManagerHelper
* @throws PluginDescriptorParsingException on descriptor parsing issue
* @throws InvalidPluginDescriptorException on invalid descriptor
*/
- PluginDescriptor getPluginDescriptor( Plugin plugin, MavenSession session )
- throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException;
+ PluginDescriptor getPluginDescriptor(Plugin plugin, MavenSession session)
+ throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException;
/**
* Helper for {@link org.apache.maven.plugin.MavenPluginManager#setupPluginRealm
* MavenPluginManager#setupPluginRealm(PluginDescriptor, ..., List, xxx.aether.graph.DependencyFilter)}
- *
+ *
* @param pluginDescriptor the plugin descriptor
* @param session the session
* @param parent the parent classloader
@@ -65,7 +63,11 @@ public interface MavenPluginManagerHelper
* @throws PluginResolutionException on resolution issue
* @throws PluginContainerException on issue with configuration
*/
- void setupPluginRealm( PluginDescriptor pluginDescriptor, MavenSession session, ClassLoader parent,
- List<String> imports, List<String> excludeArtifactIds )
- throws PluginResolutionException, PluginContainerException;
+ void setupPluginRealm(
+ PluginDescriptor pluginDescriptor,
+ MavenSession session,
+ ClassLoader parent,
+ List<String> imports,
+ List<String> excludeArtifactIds)
+ throws PluginResolutionException, PluginContainerException;
}
=====================================
src/main/java/org/apache/maven/reporting/exec/MavenReportExecution.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.reporting.exec;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,9 +16,11 @@ package org.apache.maven.reporting.exec;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.reporting.exec;
import org.apache.maven.model.Plugin;
import org.apache.maven.reporting.MavenReport;
+import org.apache.maven.reporting.MavenReportException;
/**
* <p>
@@ -32,7 +32,7 @@ import org.apache.maven.reporting.MavenReport;
* <li>the goal name associated to the report,</li>
* <li>the associated {@link ClassLoader} for the report generation,</li>
* <li>the {@link Plugin} associated to the {@link MavenReport}.</li>
- * </ul>
+ * </ul>
* <p>
* With this bean, a plugin wanting to generate a report (= <i>"execute"</i> the report) has to call the
* {@link MavenReport#generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)}
@@ -41,94 +41,90 @@ import org.apache.maven.reporting.MavenReport;
* <p>
* This bean is instantiated by {@link MavenReportExecutor}.
* </p>
- *
+ *
* @author Olivier Lamy
*/
-public class MavenReportExecution
-{
+public class MavenReportExecution {
+ private final String goal;
+
+ private Plugin plugin;
+
private MavenReport mavenReport;
private ClassLoader classLoader;
- private Plugin plugin;
+ private boolean userDefined;
- private final String goal;
-
- public MavenReportExecution( String goal, Plugin plugin, MavenReport mavenReport, ClassLoader classLoader )
- {
+ public MavenReportExecution(
+ String goal, Plugin plugin, MavenReport mavenReport, ClassLoader classLoader, boolean userDefined) {
this.goal = goal;
- this.setPlugin( plugin );
+ this.setPlugin(plugin);
this.mavenReport = mavenReport;
this.classLoader = classLoader;
+ this.userDefined = userDefined;
}
- public MavenReportExecution( Plugin plugin, MavenReport mavenReport, ClassLoader classLoader )
- {
- this( null, plugin, mavenReport, classLoader );
+ public MavenReportExecution(Plugin plugin, MavenReport mavenReport, ClassLoader classLoader, boolean userDefined) {
+ this(null, plugin, mavenReport, classLoader, userDefined);
}
- public MavenReportExecution( MavenReport mavenReport )
- {
- this( null, null, mavenReport, null );
+ public MavenReportExecution(MavenReport mavenReport) {
+ this(null, null, mavenReport, null, false);
}
/**
* execute Maven Report's <code>canGenerate()</code> with adequate classloader.
* @return Maven Report's <code>canGenerate()</code> result
+ * @throws MavenReportException if any
*/
- public boolean canGenerateReport()
- {
+ public boolean canGenerateReport() throws MavenReportException {
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- if ( classLoader != null )
- {
- Thread.currentThread().setContextClassLoader( classLoader );
+ try {
+ if (classLoader != null) {
+ Thread.currentThread().setContextClassLoader(classLoader);
}
return mavenReport.canGenerateReport();
- }
- finally
- {
- if ( classLoader != null )
- {
- Thread.currentThread().setContextClassLoader( originalClassLoader );
+ } finally {
+ if (classLoader != null) {
+ Thread.currentThread().setContextClassLoader(originalClassLoader);
}
- }
+ }
}
- public MavenReport getMavenReport()
- {
+ public MavenReport getMavenReport() {
return mavenReport;
}
- public void setMavenReport( MavenReport mavenReport )
- {
+ public void setMavenReport(MavenReport mavenReport) {
this.mavenReport = mavenReport;
}
- public ClassLoader getClassLoader()
- {
+ public ClassLoader getClassLoader() {
return classLoader;
}
- public void setClassLoader( ClassLoader classLoader )
- {
+ public void setClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
- public void setPlugin( Plugin plugin )
- {
+ public void setPlugin(Plugin plugin) {
this.plugin = plugin;
}
- public Plugin getPlugin()
- {
+ public Plugin getPlugin() {
return plugin;
}
- public String getGoal()
- {
+ public String getGoal() {
return goal;
}
+
+ public boolean isUserDefined() {
+ return userDefined;
+ }
+
+ public void setUserDefined(boolean userDefined) {
+ this.userDefined = userDefined;
+ }
}
=====================================
src/main/java/org/apache/maven/reporting/exec/MavenReportExecutor.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.reporting.exec;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.reporting.exec;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.reporting.exec;
import java.util.List;
@@ -34,15 +33,14 @@ import org.apache.maven.plugin.MojoExecutionException;
*
* @author Olivier Lamy
*/
-public interface MavenReportExecutor
-{
+public interface MavenReportExecutor {
/**
- * Build the {@link org.apache.maven.reporting.MavenReport}s, with associated forked executions if necessary.
- *
+ * Build the {@link org.apache.maven.reporting.MavenReport}s, with associated forked executions if necessary.
+ *
* @param mavenReportExecutorRequest the request
* @return a list or prepared Maven report executions
* @throws MojoExecutionException on report execution issue
*/
- List<MavenReportExecution> buildMavenReports( MavenReportExecutorRequest mavenReportExecutorRequest )
- throws MojoExecutionException;
+ List<MavenReportExecution> buildMavenReports(MavenReportExecutorRequest mavenReportExecutorRequest)
+ throws MojoExecutionException;
}
=====================================
src/main/java/org/apache/maven/reporting/exec/MavenReportExecutorRequest.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.reporting.exec;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.reporting.exec;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.reporting.exec;
import java.util.ArrayList;
import java.util.List;
@@ -29,59 +28,63 @@ import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
import org.codehaus.plexus.util.xml.Xpp3Dom;
/**
- * Bean which contains necessary informations to build {@link MavenReportExecution} with {@link MavenReportExecutor}:
+ * Bean which contains necessary informations to build {@link MavenReportExecution} with {@link MavenReportExecutor}:
* the intent is to store some informations regarding the current Maven execution.
- *
+ *
* @author Olivier Lamy
- * @version $Id$
*/
-public class MavenReportExecutorRequest
-{
+public class MavenReportExecutorRequest {
+
+ @Deprecated
private ArtifactRepository localRepository;
private MavenSession mavenSession;
+ private String executionId;
+
private MavenProject project;
private ReportPlugin[] reportPlugins;
- public ArtifactRepository getLocalRepository()
- {
+ @Deprecated
+ public ArtifactRepository getLocalRepository() {
return localRepository;
}
- public void setLocalRepository( ArtifactRepository localRepository )
- {
+ @Deprecated
+ public void setLocalRepository(ArtifactRepository localRepository) {
this.localRepository = localRepository;
}
- public MavenSession getMavenSession()
- {
+ public MavenSession getMavenSession() {
return mavenSession;
}
- public void setMavenSession( MavenSession mavenSession )
- {
+ public void setMavenSession(MavenSession mavenSession) {
this.mavenSession = mavenSession;
}
- public MavenProject getProject()
- {
+ public String getExecutionId() {
+ return executionId;
+ }
+
+ public void setExecutionId(String executionId) {
+ this.executionId = executionId;
+ }
+
+ public MavenProject getProject() {
return project;
}
- public void setProject( MavenProject project )
- {
+ public void setProject(MavenProject project) {
this.project = project;
}
- public ReportPlugin[] getReportPlugins()
- {
+ public ReportPlugin[] getReportPlugins() {
return reportPlugins;
}
- public void setReportPlugins( ReportPlugin[] reportPlugins )
- {
+ public void setReportPlugins(ReportPlugin[] reportPlugins) {
this.reportPlugins = reportPlugins;
}
@@ -91,35 +94,30 @@ public class MavenReportExecutorRequest
* @param reportPlugins the report plugins from <code><reporting></code> section
* @since 1.4
*/
- public void setReportPlugins( org.apache.maven.model.ReportPlugin[] reportPlugins )
- {
- setReportPlugins( new ReportPlugin[reportPlugins.length] );
+ public void setReportPlugins(org.apache.maven.model.ReportPlugin[] reportPlugins) {
+ setReportPlugins(new ReportPlugin[reportPlugins.length]);
int i = 0;
- for ( org.apache.maven.model.ReportPlugin r : reportPlugins )
- {
+ for (org.apache.maven.model.ReportPlugin r : reportPlugins) {
ReportPlugin p = new ReportPlugin();
- p.setGroupId( r.getGroupId() );
- p.setArtifactId( r.getArtifactId() );
- p.setVersion( r.getVersion() );
- if ( r.getConfiguration() != null )
- {
- p.setConfiguration( new XmlPlexusConfiguration( (Xpp3Dom) r.getConfiguration() ) );
+ p.setGroupId(r.getGroupId());
+ p.setArtifactId(r.getArtifactId());
+ p.setVersion(r.getVersion());
+ if (r.getConfiguration() != null) {
+ p.setConfiguration(new XmlPlexusConfiguration((Xpp3Dom) r.getConfiguration()));
}
List<ReportSet> prs = new ArrayList<>();
- for ( org.apache.maven.model.ReportSet rs : r.getReportSets() )
- {
+ for (org.apache.maven.model.ReportSet rs : r.getReportSets()) {
ReportSet ps = new ReportSet();
- ps.setId( rs.getId() );
- ps.setReports( rs.getReports() );
- if ( rs.getConfiguration() != null )
- {
- ps.setConfiguration( new XmlPlexusConfiguration( (Xpp3Dom) rs.getConfiguration() ) );
+ ps.setId(rs.getId());
+ ps.setReports(rs.getReports());
+ if (rs.getConfiguration() != null) {
+ ps.setConfiguration(new XmlPlexusConfiguration((Xpp3Dom) rs.getConfiguration()));
}
- prs.add( ps );
+ prs.add(ps);
}
- p.setReportSets( prs );
+ p.setReportSets(prs);
this.reportPlugins[i++] = p;
}
=====================================
src/main/java/org/apache/maven/reporting/exec/ReportPlugin.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.reporting.exec;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.reporting.exec;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.reporting.exec;
import java.util.ArrayList;
import java.util.Collections;
@@ -31,8 +30,7 @@ import org.codehaus.plexus.configuration.PlexusConfiguration;
* some values are copied.
* @see org.apache.maven.model.ReportPlugin
*/
-class ReportPlugin
-{
+class ReportPlugin {
private String groupId = "org.apache.maven.plugins";
private String artifactId;
@@ -42,78 +40,64 @@ class ReportPlugin
private PlexusConfiguration configuration;
private List<ReportSet> reportSets;
-
+
private List<String> reports;
- public String getGroupId()
- {
+ public String getGroupId() {
return this.groupId;
}
- public void setGroupId( String groupId )
- {
+ public void setGroupId(String groupId) {
this.groupId = groupId;
}
- public String getArtifactId()
- {
+ public String getArtifactId() {
return this.artifactId;
}
- public void setArtifactId( String artifactId )
- {
+ public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}
- public String getVersion()
- {
+ public String getVersion() {
return this.version;
}
- public void setVersion( String version )
- {
+ public void setVersion(String version) {
this.version = version;
}
- public PlexusConfiguration getConfiguration()
- {
+ public PlexusConfiguration getConfiguration() {
return this.configuration;
}
- public void setConfiguration( PlexusConfiguration configuration )
- {
+ public void setConfiguration(PlexusConfiguration configuration) {
this.configuration = configuration;
}
- public List<ReportSet> getReportSets()
- {
- if ( this.reportSets == null )
- {
+ public List<ReportSet> getReportSets() {
+ if (this.reportSets == null) {
this.reportSets = new ArrayList<>();
}
return this.reportSets;
}
- public void setReportSets( List<ReportSet> reportSets )
- {
+ public void setReportSets(List<ReportSet> reportSets) {
this.reportSets = reportSets;
}
- public List<String> getReports()
- {
+ public List<String> getReports() {
return reports == null ? Collections.<String>emptyList() : reports;
}
- public void setReports( List<String> reports )
- {
+ public void setReports(List<String> reports) {
this.reports = reports;
}
@Override
- public String toString()
- {
- return "ReportPlugin(" + artifactId + "){version='" + version + "', reports=" + reports
- + ", reportSets=" + reportSets + "}";
+ public String toString() {
+ return "ReportPlugin(" + artifactId + "){version='" + version + "', reports=" + reports + ", reportSets="
+ + reportSets + "}";
}
}
=====================================
src/main/java/org/apache/maven/reporting/exec/ReportSet.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.reporting.exec;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.reporting.exec;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.reporting.exec;
import java.util.ArrayList;
import java.util.List;
@@ -28,8 +27,7 @@ import org.codehaus.plexus.configuration.PlexusConfiguration;
* Represents a set of reports and a configuration to be used to generate them.
* @see org.apache.maven.model.ReportSet
*/
-class ReportSet
-{
+class ReportSet {
private String id = "default";
@@ -37,45 +35,36 @@ class ReportSet
private List<String> reports;
- public String getId()
- {
+ public String getId() {
return this.id;
}
- public void setId( String id )
- {
+ public void setId(String id) {
this.id = id;
}
- public PlexusConfiguration getConfiguration()
- {
+ public PlexusConfiguration getConfiguration() {
return this.configuration;
}
- public void setConfiguration( PlexusConfiguration configuration )
- {
+ public void setConfiguration(PlexusConfiguration configuration) {
this.configuration = configuration;
}
- public List<String> getReports()
- {
- if ( this.reports == null )
- {
+ public List<String> getReports() {
+ if (this.reports == null) {
this.reports = new ArrayList<>();
}
return this.reports;
}
- public void setReports( List<String> reports )
- {
+ public void setReports(List<String> reports) {
this.reports = reports;
}
@Override
- public String toString()
- {
+ public String toString() {
return "ReportSet{id='" + getId() + "', reports=" + reports + "}";
}
-
}
=====================================
src/main/java/org/codehaus/doxia/sink/Sink.java
=====================================
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+package org.codehaus.doxia.sink;
+
+/**
+ * Generic document processing interface.
+ *
+ * @deprecated use {@link org.apache.maven.doxia.sink.Sink} instead (since 1.0-alpha-6).
+ */
+public interface Sink extends org.apache.maven.doxia.sink.Sink {
+ // nop
+}
=====================================
src/site/site.xml
=====================================
@@ -25,7 +25,7 @@ under the License.
<body>
<menu name="Overview">
<item name="Introduction" href="index.html"/>
- <item name="JavaDocs" href="apidocs/index.html"/>
+ <item name="Javadoc" href="apidocs/index.html"/>
<item name="Source Xref" href="xref/index.html"/>
<!--item name="FAQ" href="faq.html"/-->
<!-- According to https://issues.apache.org/jira/browse/MNGSITE-152 -->
=====================================
src/test/java/org/apache/maven/reporting/exec/TestDefaultMavenReportExecutor.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.reporting.exec;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,12 +16,23 @@ package org.apache.maven.reporting.exec;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.reporting.exec;
+
+import java.io.File;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import org.apache.maven.DefaultMaven;
import org.apache.maven.Maven;
import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.cli.MavenCli;
+import org.apache.maven.cli.configuration.SettingsXmlConfigurationProcessor;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.DefaultMavenExecutionResult;
import org.apache.maven.execution.MavenExecutionRequest;
@@ -36,8 +45,6 @@ import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginManagement;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
import org.apache.maven.project.MavenProject;
-import org.apache.maven.repository.RepositorySystem;
-import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.building.DefaultSettingsBuildingRequest;
import org.apache.maven.settings.building.SettingsBuilder;
@@ -48,336 +55,293 @@ import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.logging.Logger;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.WorkspaceReader;
import org.eclipse.aether.repository.WorkspaceRepository;
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
/**
* @author Olivier Lamy
*/
-public class TestDefaultMavenReportExecutor
- extends PlexusTestCase
-{
+public class TestDefaultMavenReportExecutor extends PlexusTestCase {
@Override
- protected void customizeContainerConfiguration( @SuppressWarnings( "unused" ) final ContainerConfiguration configuration )
- {
- super.customizeContainerConfiguration( configuration );
- configuration.setAutoWiring( true ).setClassPathScanning( PlexusConstants.SCANNING_CACHE );
+ protected void customizeContainerConfiguration(
+ @SuppressWarnings("unused") final ContainerConfiguration configuration) {
+ super.customizeContainerConfiguration(configuration);
+ configuration.setAutoWiring(true).setClassPathScanning(PlexusConstants.SCANNING_CACHE);
}
MavenExecutionRequest request = null;
ArtifactRepository localArtifactRepository;
- public void testSimpleLookup()
- throws Exception
- {
- MavenReportExecutor mavenReportExecutor = lookup( MavenReportExecutor.class );
- assertNotNull( mavenReportExecutor );
+ public void testSimpleLookup() throws Exception {
+ MavenReportExecutor mavenReportExecutor = lookup(MavenReportExecutor.class);
+ assertNotNull(mavenReportExecutor);
}
- public void testSimpleBuildReports()
- throws Exception
- {
+ public void testSimpleBuildReports() throws Exception {
ReportSet reportSet = new ReportSet();
- reportSet.getReports().add( "test-javadoc" );
- reportSet.getReports().add( "javadoc" );
+ reportSet.getReports().add("test-javadoc");
+ reportSet.getReports().add("javadoc");
MavenProject mavenProject = getMavenProject();
- List<MavenReportExecution> mavenReportExecutions = buildReports( mavenProject, reportSet );
-
- assertNotNull( mavenReportExecutions );
- assertEquals( 2, mavenReportExecutions.size() );
- assertEquals( "testapidocs/index", mavenReportExecutions.get( 0 ).getMavenReport().getOutputName() );
- assertEquals( "apidocs/index", mavenReportExecutions.get( 1 ).getMavenReport().getOutputName() );
+ List<MavenReportExecution> mavenReportExecutions = buildReports(mavenProject, reportSet);
+
+ assertNotNull(mavenReportExecutions);
+ assertEquals(2, mavenReportExecutions.size());
+ assertEquals(
+ "testapidocs/index",
+ mavenReportExecutions.get(0).getMavenReport().getOutputName());
+ assertEquals(
+ "apidocs/index", mavenReportExecutions.get(1).getMavenReport().getOutputName());
}
- public void testMultipleReportSets()
- throws Exception
- {
+ public void testMultipleReportSets() throws Exception {
ReportSet reportSet = new ReportSet();
- reportSet.getReports().add( "javadoc" );
+ reportSet.getReports().add("javadoc");
ReportSet reportSet2 = new ReportSet();
- reportSet2.getReports().add( "test-javadoc" );
- reportSet2.getReports().add( "javadoc" );
+ reportSet2.getReports().add("test-javadoc");
+ reportSet2.getReports().add("javadoc");
MavenProject mavenProject = getMavenProject();
- List<MavenReportExecution> mavenReportExecutions = buildReports( mavenProject, reportSet, reportSet2 );
-
- assertNotNull( mavenReportExecutions );
- assertEquals( 3, mavenReportExecutions.size() );
- assertEquals( "apidocs/index", mavenReportExecutions.get( 0 ).getMavenReport().getOutputName() );
- assertEquals( "testapidocs/index", mavenReportExecutions.get( 1 ).getMavenReport().getOutputName() );
- assertEquals( "apidocs/index", mavenReportExecutions.get( 2 ).getMavenReport().getOutputName() );
+ List<MavenReportExecution> mavenReportExecutions = buildReports(mavenProject, reportSet, reportSet2);
+
+ assertNotNull(mavenReportExecutions);
+ assertEquals(3, mavenReportExecutions.size());
+ assertEquals(
+ "apidocs/index", mavenReportExecutions.get(0).getMavenReport().getOutputName());
+ assertEquals(
+ "testapidocs/index",
+ mavenReportExecutions.get(1).getMavenReport().getOutputName());
+ assertEquals(
+ "apidocs/index", mavenReportExecutions.get(2).getMavenReport().getOutputName());
}
- public void testReportingPluginWithDependenciesInPluginManagement()
- throws Exception
- {
+ public void testReportingPluginWithDependenciesInPluginManagement() throws Exception {
ReportSet reportSet = new ReportSet();
- reportSet.getReports().add( "javadoc" );
+ reportSet.getReports().add("javadoc");
MavenProject mavenProject = getMavenProject();
Plugin plugin = new Plugin();
- plugin.setGroupId( "org.apache.maven.plugins" );
- plugin.setArtifactId( "maven-javadoc-plugin" );
- plugin.setVersion( "3.0.0-M1" );
+ plugin.setGroupId("org.apache.maven.plugins");
+ plugin.setArtifactId("maven-javadoc-plugin");
+ plugin.setVersion("3.4.0");
Dependency dependency = new Dependency();
- dependency.setGroupId( "commons-lang" );
- dependency.setArtifactId( "commons-lang" );
- dependency.setVersion( "2.6" );
- plugin.getDependencies().add( dependency );
- mavenProject.getBuild().setPluginManagement( new PluginManagement() );
- mavenProject.getBuild().getPluginManagement().addPlugin( plugin );
- List<MavenReportExecution> mavenReportExecutions = buildReports( mavenProject, reportSet );
-
- assertNotNull( mavenReportExecutions );
- assertEquals( 1, mavenReportExecutions.size() );
- List<Dependency> dependencies = mavenReportExecutions.get( 0 ).getPlugin().getDependencies();
- assertEquals( 1, dependencies.size() );
- assertEquals( "commons-lang", dependencies.get( 0 ).getGroupId() );
- assertEquals( "2.6", dependencies.get( 0 ).getVersion() );
+ dependency.setGroupId("commons-lang");
+ dependency.setArtifactId("commons-lang");
+ dependency.setVersion("2.6");
+ plugin.getDependencies().add(dependency);
+ mavenProject.getBuild().setPluginManagement(new PluginManagement());
+ mavenProject.getBuild().getPluginManagement().addPlugin(plugin);
+ List<MavenReportExecution> mavenReportExecutions = buildReports(mavenProject, reportSet);
+
+ assertNotNull(mavenReportExecutions);
+ assertEquals(1, mavenReportExecutions.size());
+ List<Dependency> dependencies = mavenReportExecutions.get(0).getPlugin().getDependencies();
+ assertEquals(1, dependencies.size());
+ assertEquals("commons-lang", dependencies.get(0).getGroupId());
+ assertEquals("2.6", dependencies.get(0).getVersion());
}
- private List<MavenReportExecution> buildReports( MavenProject mavenProject, ReportSet... javadocReportSets )
- throws Exception
- {
+ private List<MavenReportExecution> buildReports(MavenProject mavenProject, ReportSet... javadocReportSets)
+ throws Exception {
ClassLoader orig = Thread.currentThread().getContextClassLoader();
ClassRealm realm = getContainer().getContainerRealm();
- Thread.currentThread().setContextClassLoader( realm );
- try
- {
+ Thread.currentThread().setContextClassLoader(realm);
+ try {
MavenReportExecutorRequest mavenReportExecutorRequest = new MavenReportExecutorRequest();
- mavenReportExecutorRequest.setLocalRepository( getLocalArtifactRepository() );
+ mavenReportExecutorRequest.setLocalRepository(getLocalRepo());
- mavenReportExecutorRequest.setProject( mavenProject );
+ mavenReportExecutorRequest.setProject(mavenProject);
- MavenSession mavenSession = getMavenSession( getLocalArtifactRepository(), mavenProject );
- mavenSession.setCurrentProject( mavenProject );
- mavenSession.setProjects( Arrays.asList( mavenProject ) );
- mavenReportExecutorRequest.setMavenSession( mavenSession );
+ MavenSession mavenSession = getMavenSession(getLocalRepo(), mavenProject);
+ mavenSession.setCurrentProject(mavenProject);
+ mavenSession.setProjects(Arrays.asList(mavenProject));
+ mavenReportExecutorRequest.setMavenSession(mavenSession);
ReportPlugin reportPlugin = new ReportPlugin();
- reportPlugin.setGroupId( "org.apache.maven.plugins" );
- reportPlugin.setArtifactId( "maven-javadoc-plugin" );
- reportPlugin.setVersion( "3.0.0-M1" );
+ reportPlugin.setGroupId("org.apache.maven.plugins");
+ reportPlugin.setArtifactId("maven-javadoc-plugin");
+ reportPlugin.setVersion("3.4.0");
- for ( ReportSet reportSet : javadocReportSets )
- {
- reportPlugin.getReportSets().add( reportSet );
+ for (ReportSet reportSet : javadocReportSets) {
+ reportPlugin.getReportSets().add(reportSet);
}
- List<ReportPlugin> reportPlugins = Arrays.asList( reportPlugin );
+ List<ReportPlugin> reportPlugins = Arrays.asList(reportPlugin);
- mavenReportExecutorRequest.setReportPlugins( reportPlugins.toArray( new ReportPlugin[1] ) );
+ mavenReportExecutorRequest.setReportPlugins(reportPlugins.toArray(new ReportPlugin[1]));
- MavenReportExecutor mavenReportExecutor = lookup( MavenReportExecutor.class );
+ MavenReportExecutor mavenReportExecutor = lookup(MavenReportExecutor.class);
- return mavenReportExecutor.buildMavenReports( mavenReportExecutorRequest );
- }
- finally
- {
- Thread.currentThread().setContextClassLoader( orig );
+ return mavenReportExecutor.buildMavenReports(mavenReportExecutorRequest);
+ } finally {
+ Thread.currentThread().setContextClassLoader(orig);
}
}
- protected MavenSession getMavenSession( ArtifactRepository localRepository, final MavenProject mavenProject )
- throws Exception
- {
+ protected MavenSession getMavenSession(ArtifactRepository localRepository, final MavenProject mavenProject)
+ throws Exception {
request = new DefaultMavenExecutionRequest();
- request.setLocalRepository( localRepository );
+ request.setLocalRepository(localRepository);
- request.setWorkspaceReader( new WorkspaceReader()
- {
+ request.setWorkspaceReader(new WorkspaceReader() {
@Override
- public WorkspaceRepository getRepository()
- {
+ public WorkspaceRepository getRepository() {
return new WorkspaceRepository();
}
@Override
- public File findArtifact( Artifact artifact )
- {
+ public File findArtifact(Artifact artifact) {
return null;
}
@Override
- public List<String> findVersions( Artifact artifact )
- {
+ public List<String> findVersions(Artifact artifact) {
return Collections.emptyList();
}
- } );
+ });
final Settings settings = getSettings();
- Mirror centralMirror = new Mirror();
- centralMirror.setId("httpsCentral");
- centralMirror.setMirrorOf( "central" );
- centralMirror.setUrl( "https://repo.maven.apache.org/maven2" );
- request.setMirrors( Collections.singletonList( centralMirror ) );
-
- getContainer().lookup( MavenExecutionRequestPopulator.class ).populateFromSettings( request, settings );
-
- getContainer().lookup( MavenExecutionRequestPopulator.class ).populateDefaults( request );
+ getContainer().lookup(MavenExecutionRequestPopulator.class).populateFromSettings(request, settings);
- request.setLocalRepository( getLocalArtifactRepository() );
- request.setLocalRepositoryPath( getLocalArtifactRepository().getBasedir() );
- request.setCacheNotFound( false );
+ getContainer().lookup(MavenExecutionRequestPopulator.class).populateDefaults(request);
- request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_INFO );
- getContainer().lookup( Logger.class ).setThreshold( 1 );
+ request.setLocalRepository(getLocalRepo());
+ request.setLocalRepositoryPath(getLocalRepo().getBasedir());
+ request.setCacheNotFound(false);
- request.setSystemProperties( System.getProperties() );
+ request.setSystemProperties(System.getProperties());
MavenExecutionResult result = new DefaultMavenExecutionResult();
- RepositorySystemSession repositorySystemSession = buildRepositorySystemSession( request );
+ RepositorySystemSession repositorySystemSession = buildRepositorySystemSession(request);
- return new MavenSession( getContainer(), repositorySystemSession, request, result )
- {
+ return new MavenSession(getContainer(), repositorySystemSession, request, result) {
@Override
- public MavenProject getTopLevelProject()
- {
+ public MavenProject getTopLevelProject() {
return mavenProject;
}
@Override
- public Settings getSettings()
- {
+ public Settings getSettings() {
return settings;
}
@Override
- public List<MavenProject> getProjects()
- {
- return Arrays.asList( mavenProject );
+ public List<MavenProject> getProjects() {
+ return Arrays.asList(mavenProject);
}
@Override
- public MavenProject getCurrentProject()
- {
+ public MavenProject getCurrentProject() {
return mavenProject;
}
-
};
}
- private ArtifactRepository getLocalArtifactRepository()
- throws Exception
- {
- if ( localArtifactRepository != null )
- {
- return localArtifactRepository;
- }
+ private ArtifactRepository getLocalRepo() throws Exception {
+ ArtifactRepositoryFactory artifactRepositoryFactory = lookup(ArtifactRepositoryFactory.class);
+ ArtifactRepositoryLayout defaultArtifactRepositoryLayout = lookup(ArtifactRepositoryLayout.class, "default");
+ String updatePolicyFlag = ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS;
+ String checksumPolicyFlag = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
+ ArtifactRepositoryPolicy snapshotsPolicy =
+ new ArtifactRepositoryPolicy(true, updatePolicyFlag, checksumPolicyFlag);
+ ArtifactRepositoryPolicy releasesPolicy =
+ new ArtifactRepositoryPolicy(true, updatePolicyFlag, checksumPolicyFlag);
String localRepoPath =
- System.getProperty( "localRepository", MavenCli.userMavenConfigurationHome.getPath() + "/repository" );
-
- localArtifactRepository = lookup( RepositorySystem.class ).createLocalRepository( new File( localRepoPath ) );
- return localArtifactRepository;
+ System.getProperty("localRepository", MavenCli.USER_MAVEN_CONFIGURATION_HOME.getPath() + "/repository");
+ return artifactRepositoryFactory.createArtifactRepository(
+ "local",
+ Paths.get(localRepoPath).toUri().toASCIIString(),
+ defaultArtifactRepositoryLayout,
+ snapshotsPolicy,
+ releasesPolicy);
}
- public Settings getSettings()
- throws ComponentLookupException, SettingsBuildingException
- {
+ public Settings getSettings() throws ComponentLookupException, SettingsBuildingException {
SettingsBuildingRequest settingsBuildingRequest = new DefaultSettingsBuildingRequest();
- settingsBuildingRequest.setGlobalSettingsFile( MavenCli.DEFAULT_GLOBAL_SETTINGS_FILE );
+ settingsBuildingRequest.setGlobalSettingsFile(SettingsXmlConfigurationProcessor.DEFAULT_GLOBAL_SETTINGS_FILE);
- settingsBuildingRequest.setUserSettingsFile( MavenCli.DEFAULT_USER_SETTINGS_FILE );
+ settingsBuildingRequest.setUserSettingsFile(SettingsXmlConfigurationProcessor.DEFAULT_USER_SETTINGS_FILE);
- settingsBuildingRequest.getSystemProperties().putAll( System.getProperties() );
-
- return getContainer().lookup( SettingsBuilder.class )
- .build( settingsBuildingRequest ).getEffectiveSettings();
+ settingsBuildingRequest.getSystemProperties().putAll(System.getProperties());
+ return getContainer()
+ .lookup(SettingsBuilder.class)
+ .build(settingsBuildingRequest)
+ .getEffectiveSettings();
}
- protected MavenProject getMavenProject()
- {
- MavenProjectStub mavenProjectStub = new MavenProjectStub()
- {
+ protected MavenProject getMavenProject() {
+ MavenProjectStub mavenProjectStub = new MavenProjectStub() {
@Override
- public List<RemoteRepository> getRemotePluginRepositories()
- {
- if ( super.getRemotePluginRepositories() == null )
- {
- return RepositoryUtils.toRepos( request.getRemoteRepositories() );
+ public List<RemoteRepository> getRemotePluginRepositories() {
+ if (super.getRemotePluginRepositories() == null) {
+ return RepositoryUtils.toRepos(request.getRemoteRepositories());
}
return super.getRemotePluginRepositories();
}
@Override
- public List<ArtifactRepository> getRemoteArtifactRepositories()
- {
- if ( super.getRemotePluginRepositories() == null )
- {
+ public List<ArtifactRepository> getRemoteArtifactRepositories() {
+ if (super.getRemotePluginRepositories() == null) {
return request.getRemoteRepositories();
}
return super.getRemoteArtifactRepositories();
}
@Override
- public String getName()
- {
+ public String getName() {
return "foo";
}
@Override
- public String getVersion()
- {
+ public String getVersion() {
return "1.0-SNAPSHOT";
}
@Override
- public boolean isExecutionRoot()
- {
+ public boolean isExecutionRoot() {
return true;
}
@Override
- public List<String> getCompileSourceRoots()
- {
- return Arrays.asList( "src/main/java" );
+ public List<String> getCompileSourceRoots() {
+ return Arrays.asList("src/main/java");
}
@Override
- public List<String> getTestCompileSourceRoots()
- {
- return Arrays.asList( "src/test/java" );
+ public List<String> getTestCompileSourceRoots() {
+ return Arrays.asList("src/test/java");
}
};
- mavenProjectStub.setPackaging( "jar" );
+ mavenProjectStub.setPackaging("jar");
Build build = new Build();
- build.setOutputDirectory( "target" );
+ build.setOutputDirectory("target");
- build.setSourceDirectory( "src/main/java" );
+ build.setSourceDirectory("src/main/java");
- build.setTestSourceDirectory( "src/test/java" );
+ build.setTestSourceDirectory("src/test/java");
- mavenProjectStub.setBuild( build );
+ mavenProjectStub.setBuild(build);
return mavenProjectStub;
}
- private RepositorySystemSession buildRepositorySystemSession( MavenExecutionRequest request )
- throws ComponentLookupException
- {
- DefaultMaven defaultMaven = (DefaultMaven) getContainer().lookup( Maven.class );
+ private RepositorySystemSession buildRepositorySystemSession(MavenExecutionRequest request)
+ throws ComponentLookupException {
+ DefaultMaven defaultMaven = (DefaultMaven) getContainer().lookup(Maven.class);
- return defaultMaven.newRepositorySession( request );
+ return defaultMaven.newRepositorySession(request);
}
-
}
View it on GitLab: https://salsa.debian.org/java-team/maven-reporting-exec/-/compare/2965869b3d6570631c2a2844004da9e719808eb5...ff1f135bf16220354bbf5a96b72dff5e4c1aa1e5
--
View it on GitLab: https://salsa.debian.org/java-team/maven-reporting-exec/-/compare/2965869b3d6570631c2a2844004da9e719808eb5...ff1f135bf16220354bbf5a96b72dff5e4c1aa1e5
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20241024/fc25ab2f/attachment.htm>
More information about the pkg-java-commits
mailing list