Upgrade parent to 39 - reformat
diff --git a/pom.xml b/pom.xml
index 55d2bf8..ffe180c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,15 +10,14 @@
WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the
License for the ~ specific language governing permissions and limitations
~ under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven</groupId>
<artifactId>maven-parent</artifactId>
<version>39</version>
- <relativePath/>
+ <relativePath />
</parent>
<groupId>org.apache.maven.dist.tools</groupId>
@@ -38,8 +37,8 @@
<scm>
<connection>scm:git:https://gitbox.apache.org/repos/asf/maven-dist-tool.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-dist-tool.git</developerConnection>
- <url>https://github.com/apache/maven-dist-tool/tree/${project.scm.tag}</url>
<tag>HEAD</tag>
+ <url>https://github.com/apache/maven-dist-tool/tree/${project.scm.tag}</url>
</scm>
<issueManagement>
<system>jira</system>
@@ -207,10 +206,10 @@
<executions>
<execution>
<id>unpack</id>
- <phase>pre-site</phase>
<goals>
<goal>unpack</goal>
</goals>
+ <phase>pre-site</phase>
<configuration>
<artifactItems>
<artifactItem>
@@ -230,8 +229,10 @@
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes combine.children="append">
- <exclude>.repository/**</exclude> <!-- jenkins with local maven repository -->
- <exclude>src/test/resources/**/*.html</exclude> <!-- sample HTML -->
+ <exclude>.repository/**</exclude>
+ <!-- jenkins with local maven repository -->
+ <exclude>src/test/resources/**/*.html</exclude>
+ <!-- sample HTML -->
</excludes>
</configuration>
</plugin>
@@ -267,7 +268,8 @@
</ignoreSiteFailures>
<ignoreDistFailures>
<ignoreDistFailure>doxia-linkcheck:1.2</ignoreDistFailure>
- <ignoreDistFailure>apache-maven:3.0.5</ignoreDistFailure><!-- unexpected missing sha1 on 1 CDN node used by ASF Jenkins -->
+ <ignoreDistFailure>apache-maven:3.0.5</ignoreDistFailure>
+ <!-- unexpected missing sha1 on 1 CDN node used by ASF Jenkins -->
<ignoreDistFailure>maven-docck-plugin:1.0</ignoreDistFailure>
<ignoreDistFailure>maven-reactor-plugin:1.0</ignoreDistFailure>
<ignoreDistFailure>file-management:1.2.1</ignoreDistFailure>
diff --git a/src/main/java/org/apache/maven/dist/tools/AbstractCheckResult.java b/src/main/java/org/apache/maven/dist/tools/AbstractCheckResult.java
index 77c10c9..2711de1 100644
--- a/src/main/java/org/apache/maven/dist/tools/AbstractCheckResult.java
+++ b/src/main/java/org/apache/maven/dist/tools/AbstractCheckResult.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,14 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools;
/**
* <p>AbstractCheckResult class.</p>
*
* @author skygo
*/
-public class AbstractCheckResult
-{
+public class AbstractCheckResult {
private final ConfigurationLineInfo configLine;
private final String version;
@@ -36,8 +34,7 @@
* @param r a {@link org.apache.maven.dist.tools.ConfigurationLineInfo} object
* @param version a {@link java.lang.String} object
*/
- public AbstractCheckResult( ConfigurationLineInfo r, String version )
- {
+ public AbstractCheckResult(ConfigurationLineInfo r, String version) {
this.configLine = r;
this.version = version;
}
@@ -47,8 +44,7 @@
*
* @return the request
*/
- public ConfigurationLineInfo getConfigurationLine()
- {
+ public ConfigurationLineInfo getConfigurationLine() {
return configLine;
}
@@ -57,8 +53,7 @@
*
* @return the version
*/
- public String getVersion()
- {
+ public String getVersion() {
return version;
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/AbstractDistCheckReport.java b/src/main/java/org/apache/maven/dist/tools/AbstractDistCheckReport.java
index 9ce37cc..287ebd3 100644
--- a/src/main/java/org/apache/maven/dist/tools/AbstractDistCheckReport.java
+++ b/src/main/java/org/apache/maven/dist/tools/AbstractDistCheckReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
@@ -55,36 +54,32 @@
*
* @author skygo
*/
-public abstract class AbstractDistCheckReport
- extends AbstractMavenReport
-{
+public abstract class AbstractDistCheckReport extends AbstractMavenReport {
private static final String CONF = "dist-tool.conf";
- private static final String EOL = System.getProperty( "line.separator" );
+ private static final String EOL = System.getProperty("line.separator");
/**
* Abstract Dist Check Report.
*/
- public AbstractDistCheckReport()
- {
- }
+ public AbstractDistCheckReport() {}
/**
- * URL of repository where artifacts are stored.
+ * URL of repository where artifacts are stored.
*/
- @Parameter( property = "repositoryUrl", defaultValue = "https://repo.maven.apache.org/maven2/" )
+ @Parameter(property = "repositoryUrl", defaultValue = "https://repo.maven.apache.org/maven2/")
protected String repoBaseUrl;
/**
* List of configuration line for specific inspection.
*/
- @Parameter( property = "configurationLines", defaultValue = "" )
+ @Parameter(property = "configurationLines", defaultValue = "")
private List<String> configurationLines;
/**
* Failures directory.
*/
- @Parameter( defaultValue = "${project.build.directory}/dist-tool" )
+ @Parameter(defaultValue = "${project.build.directory}/dist-tool")
protected File failuresDirectory;
/**
@@ -98,14 +93,14 @@
protected String distributionAreaUrl;
/**
- * Path in index page mapping, when path is not the classical /artifact-id/
+ * Path in index page mapping, when path is not the classical /artifact-id/
* The configuration in <code>dist-tool.conf</code> looks like this:
* <pre>artifact-id index-path = /directory/</pre>
*/
protected Map<String, String> paths = new HashMap<String, String>();
/**
- * Site url mapping, when site url read in pom doesn't get the expected value
+ * Site url mapping, when site url read in pom doesn't get the expected value
* The configuration in <code>dist-tool.conf</code> looks like this:
* <pre>artifact-id site = site url
*artifact-id:version site = site url</pre>
@@ -120,7 +115,7 @@
* @return if it is a index page check.
*/
protected abstract boolean isIndexPageCheck();
-
+
/**
* <p>checkArtifact.</p>
*
@@ -128,8 +123,7 @@
* @param repoBase a {@link java.lang.String} object
* @throws org.apache.maven.plugin.MojoExecutionException if any.
*/
- protected abstract void checkArtifact( ConfigurationLineInfo request, String repoBase )
- throws MojoExecutionException;
+ protected abstract void checkArtifact(ConfigurationLineInfo request, String repoBase) throws MojoExecutionException;
/**
* <p>getFailuresFilename.</p>
@@ -140,231 +134,183 @@
/** {@inheritDoc} */
@Override
- public String getOutputName()
- {
- return "dist-tool-" + getFailuresFilename().replace( ".log", "" );
+ public String getOutputName() {
+ return "dist-tool-" + getFailuresFilename().replace(".log", "");
}
- private void loadConfiguration()
- throws MojoExecutionException
- {
- URL configuration = Thread.currentThread().getContextClassLoader().getResource( CONF );
- try ( BufferedReader in = new BufferedReader( new InputStreamReader( configuration.openStream() ) ) )
- {
+ private void loadConfiguration() throws MojoExecutionException {
+ URL configuration = Thread.currentThread().getContextClassLoader().getResource(CONF);
+ try (BufferedReader in = new BufferedReader(new InputStreamReader(configuration.openStream()))) {
String text;
- while ( ( text = in.readLine() ) != null )
- {
- configurationLines.add( text );
+ while ((text = in.readLine()) != null) {
+ configurationLines.add(text);
}
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "error while reading " + configuration, e );
+ } catch (IOException e) {
+ throw new MojoExecutionException("error while reading " + configuration, e);
}
}
- private ArtifactRepositoryPolicy newArtifactRepositoryPolicy( boolean enabled )
- {
- return new ArtifactRepositoryPolicy( enabled, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
- ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
+ private ArtifactRepositoryPolicy newArtifactRepositoryPolicy(boolean enabled) {
+ return new ArtifactRepositoryPolicy(
+ enabled, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN);
}
/** {@inheritDoc} */
@Override
- public void execute()
- throws MojoExecutionException
- {
- ArtifactRepository aa =
- new MavenArtifactRepository( "central", repoBaseUrl, new DefaultRepositoryLayout(),
- newArtifactRepositoryPolicy( false ), newArtifactRepositoryPolicy( true ) );
- artifactRepositories.add( aa );
+ public void execute() throws MojoExecutionException {
+ ArtifactRepository aa = new MavenArtifactRepository(
+ "central",
+ repoBaseUrl,
+ new DefaultRepositoryLayout(),
+ newArtifactRepositoryPolicy(false),
+ newArtifactRepositoryPolicy(true));
+ artifactRepositories.add(aa);
- if ( configurationLines.isEmpty() )
- {
+ if (configurationLines.isEmpty()) {
loadConfiguration();
}
File failures = getFailuresFile();
- if ( failures.exists() )
- {
+ if (failures.exists()) {
failures.delete();
- }
- else
- {
+ } else {
failuresDirectory.mkdirs();
}
ConfigurationLineInfo currentGroup = null;
- for ( String line : configurationLines )
- {
+ for (String line : configurationLines) {
ConfigurationLineInfo aLine = null;
String trim = line.trim();
- if ( "".equals( trim ) || trim.startsWith( "##" ) )
- {
+ if ("".equals(trim) || trim.startsWith("##")) {
// empty line or comment: ignore
continue;
}
- getLog().info( line );
+ getLog().info(line);
line = trim;
- if ( line.startsWith( ">" ) )
- {
+ if (line.startsWith(">")) {
// parameter
- int index = line.indexOf( '=' );
- if ( index < 0 )
- {
- throw new MojoExecutionException( "unparseable configuration line, missing '=': " + line );
+ int index = line.indexOf('=');
+ if (index < 0) {
+ throw new MojoExecutionException("unparseable configuration line, missing '=': " + line);
}
- String param = line.substring( 1, index ).trim();
- String value = line.substring( index + 1 ).trim();
+ String param = line.substring(1, index).trim();
+ String value = line.substring(index + 1).trim();
- if ( "dist-area".equals( param ) )
- {
+ if ("dist-area".equals(param)) {
distributionAreaUrl = value;
- }
- else if ( param.contains( " " ) )
- {
+ } else if (param.contains(" ")) {
// parameter for an artifactId
- index = param.indexOf( ' ' );
- String artifactId = param.substring( 0, index );
- param = param.substring( index ).trim();
+ index = param.indexOf(' ');
+ String artifactId = param.substring(0, index);
+ param = param.substring(index).trim();
- if ( "index-path".equals( param ) )
- {
- paths.put( artifactId, value );
+ if ("index-path".equals(param)) {
+ paths.put(artifactId, value);
+ } else if ("site".equals(param)) {
+ sites.put(artifactId, value);
+ } else {
+ throw new MojoExecutionException(
+ "unknown artifact parameter '" + param + "' in configuration line: " + line);
}
- else if ( "site".equals( param ) )
- {
- sites.put( artifactId, value );
- }
- else
- {
- throw new MojoExecutionException( "unknown artifact parameter '" + param
- + "' in configuration line: " + line );
- }
- }
- else
- {
- throw new MojoExecutionException( "unparseable configuration line: " + line );
+ } else {
+ throw new MojoExecutionException("unparseable configuration line: " + line);
}
continue;
- }
- else if ( line.startsWith( "/" ) )
- {
+ } else if (line.startsWith("/")) {
// definition of a group, in a dist-area directory
- currentGroup = new ConfigurationLineInfo( line.split( " " ) );
+ currentGroup = new ConfigurationLineInfo(line.split(" "));
- if ( currentGroup.getArtifactId() == null )
- {
+ if (currentGroup.getArtifactId() == null) {
continue;
}
// check group's parent pom artifact
aLine = currentGroup;
- }
- else
- {
+ } else {
// artifact definition
- if ( line.startsWith( "*" ) )
- {
+ if (line.startsWith("*")) {
// special artifact
- if ( !isIndexPageCheck() )
- {
+ if (!isIndexPageCheck()) {
// not check-index-page mojo, so ignore this artifact
continue;
}
// remove the asterisk before running the check
- line = line.substring( 1 ).trim();
+ line = line.substring(1).trim();
}
- try
- {
- aLine = new ConfigurationLineInfo( currentGroup, line.split( " " ) );
- }
- catch ( InvalidVersionSpecificationException e )
- {
- throw new MojoExecutionException( e.getMessage() );
+ try {
+ aLine = new ConfigurationLineInfo(currentGroup, line.split(" "));
+ } catch (InvalidVersionSpecificationException e) {
+ throw new MojoExecutionException(e.getMessage());
}
}
- checkArtifact( aLine, getVersion( aLine ) );
+ checkArtifact(aLine, getVersion(aLine));
}
- getLog().info( "" );
+ getLog().info("");
}
- private String getVersion( ConfigurationLineInfo aLine )
- throws MojoExecutionException
- {
- String metadataUrl = aLine.getMetadataFileURL( repoBaseUrl );
- try ( InputStream input = new BufferedInputStream( new URL( metadataUrl ).openStream() ) )
- {
+ private String getVersion(ConfigurationLineInfo aLine) throws MojoExecutionException {
+ String metadataUrl = aLine.getMetadataFileURL(repoBaseUrl);
+ try (InputStream input = new BufferedInputStream(new URL(metadataUrl).openStream())) {
MetadataXpp3Reader metadataReader = new MetadataXpp3Reader();
- Metadata metadata = metadataReader.read( input );
+ Metadata metadata = metadataReader.read(input);
- aLine.setMetadata( metadata );
+ aLine.setMetadata(metadata);
String version;
- if ( aLine.getVersionRange() != null )
- {
- if ( aLine.getVersionRange().hasRestrictions() )
- {
+ if (aLine.getVersionRange() != null) {
+ if (aLine.getVersionRange().hasRestrictions()) {
List<ArtifactVersion> artifactVersions = new ArrayList<>();
- for ( String versioningVersion : metadata.getVersioning().getVersions() )
- {
- artifactVersions.add( new DefaultArtifactVersion( versioningVersion ) );
+ for (String versioningVersion : metadata.getVersioning().getVersions()) {
+ artifactVersions.add(new DefaultArtifactVersion(versioningVersion));
}
- version = aLine.getVersionRange().matchVersion( artifactVersions ).toString();
- }
- else
- {
+ version = aLine.getVersionRange()
+ .matchVersion(artifactVersions)
+ .toString();
+ } else {
version = aLine.getVersionRange().getRecommendedVersion().toString();
}
- aLine.setForceVersion( version );
- }
- else
- {
+ aLine.setForceVersion(version);
+ } else {
version = metadata.getVersioning().getLatest();
}
-
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( " available versions in repository " + repoBaseUrl );
+
+ if (getLog().isDebugEnabled()) {
+ getLog().debug(" available versions in repository " + repoBaseUrl);
// revert sort versions (not handling alpha and
// complex version schemes but more useful versions are displayed left side)
- Collections.sort( metadata.getVersioning().getVersions(), Collections.reverseOrder() );
- getLog().debug( " " + metadata.getVersioning().getVersions() );
+ Collections.sort(metadata.getVersioning().getVersions(), Collections.reverseOrder());
+ getLog().debug(" " + metadata.getVersioning().getVersions());
}
- if ( aLine.getForcedVersion() != null )
- {
- if ( aLine.getVersionRange().hasRestrictions() )
- {
- getLog().debug( aLine.getGroupId() + ":" + aLine.getArtifactId()
- + " metadata latest version value is " + metadata.getVersioning().getLatest()
- + " but check was restricted to " + aLine.getVersionRange()
- + " which selected " + aLine.getForcedVersion() );
- }
- else
- {
- getLog().info( aLine.getGroupId() + ":" + aLine.getArtifactId()
- + " metadata latest version value is " + metadata.getVersioning().getLatest()
- + " but check was manually set to " + aLine.getForcedVersion() );
+ if (aLine.getForcedVersion() != null) {
+ if (aLine.getVersionRange().hasRestrictions()) {
+ getLog().debug(aLine.getGroupId() + ":" + aLine.getArtifactId()
+ + " metadata latest version value is "
+ + metadata.getVersioning().getLatest()
+ + " but check was restricted to " + aLine.getVersionRange()
+ + " which selected " + aLine.getForcedVersion());
+ } else {
+ getLog().info(aLine.getGroupId() + ":" + aLine.getArtifactId()
+ + " metadata latest version value is "
+ + metadata.getVersioning().getLatest()
+ + " but check was manually set to " + aLine.getForcedVersion());
}
}
-
+
return version;
- }
- catch ( IOException | XmlPullParserException ex )
- {
- throw new MojoExecutionException( "error while reading " + metadataUrl, ex );
+ } catch (IOException | XmlPullParserException ex) {
+ throw new MojoExecutionException("error while reading " + metadataUrl, ex);
}
}
@@ -373,29 +319,26 @@
*
* @param sink doxiasink
*/
- public static void iconError( Sink sink )
- {
- icon( sink, "icon_error_sml" );
+ public static void iconError(Sink sink) {
+ icon(sink, "icon_error_sml");
}
-
+
/**
* add a warning icon.
*
* @param sink doxiasink
*/
- public static void iconWarning( Sink sink )
- {
- icon( sink, "icon_warning_sml" );
+ public static void iconWarning(Sink sink) {
+ icon(sink, "icon_warning_sml");
}
-
+
/**
* add an success icon.
*
* @param sink doxiasink
*/
- public static void iconSuccess( Sink sink )
- {
- icon( sink, "icon_success_sml" );
+ public static void iconSuccess(Sink sink) {
+ icon(sink, "icon_success_sml");
}
/**
@@ -403,16 +346,14 @@
*
* @param sink doxiasink
*/
- protected static void iconRemove( Sink sink )
- {
- icon( sink, "remove" );
+ protected static void iconRemove(Sink sink) {
+ icon(sink, "remove");
}
- private static void icon( Sink sink, String level )
- {
- sink.figureGraphics( "images/" + level + ".gif" );
+ private static void icon(Sink sink, String level) {
+ sink.figureGraphics("images/" + level + ".gif");
}
-
+
/**
* Log and add Error line to logs.txt if not configured to ignore the artifact+version
*
@@ -422,30 +363,24 @@
* @param message The message.
* @return true if real error, or false if ignored
*/
- protected boolean addErrorLine( ConfigurationLineInfo cli, String version, List<String> ignore, String message )
- {
- if ( ( ignore != null )
- && ( ignore.contains( cli.getArtifactId() + ':' + version ) || ignore.contains( cli.getArtifactId() ) ) )
- {
- getLog().warn( message );
+ protected boolean addErrorLine(ConfigurationLineInfo cli, String version, List<String> ignore, String message) {
+ if ((ignore != null)
+ && (ignore.contains(cli.getArtifactId() + ':' + version) || ignore.contains(cli.getArtifactId()))) {
+ getLog().warn(message);
return false;
}
- getLog().error( message );
+ getLog().error(message);
- try ( PrintWriter output = new PrintWriter( new FileWriter( getFailuresFile(), true ) ) )
- {
- output.printf( "%s%s", message, EOL );
- }
- catch ( Exception e )
- {
- getLog().error( "Cannot append to " + getFailuresFilename() );
+ try (PrintWriter output = new PrintWriter(new FileWriter(getFailuresFile(), true))) {
+ output.printf("%s%s", message, EOL);
+ } catch (Exception e) {
+ getLog().error("Cannot append to " + getFailuresFilename());
}
return true;
}
- private File getFailuresFile()
- {
- return new File( failuresDirectory, getFailuresFilename() );
+ private File getFailuresFile() {
+ return new File(failuresDirectory, getFailuresFilename());
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/ConfigurationLineInfo.java b/src/main/java/org/apache/maven/dist/tools/ConfigurationLineInfo.java
index 5d7a458..9906122 100644
--- a/src/main/java/org/apache/maven/dist/tools/ConfigurationLineInfo.java
+++ b/src/main/java/org/apache/maven/dist/tools/ConfigurationLineInfo.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
@@ -32,8 +31,7 @@
*
* @author skygo
*/
-public class ConfigurationLineInfo
-{
+public class ConfigurationLineInfo {
private static final String URLSEP = "/";
private final String directory;
@@ -43,7 +41,7 @@
private final String artifactId;
private final VersionRange versionRange;
-
+
private String forceVersion;
private String indexPageUrl;
private Metadata metadata;
@@ -53,16 +51,15 @@
*
* @param infos an array of {@link java.lang.String} objects
*/
- public ConfigurationLineInfo( String[] infos )
- {
- this.directory = infos[0].replace( '/', ' ' ).replace( ':', ' ' ).trim();
+ public ConfigurationLineInfo(String[] infos) {
+ this.directory = infos[0].replace('/', ' ').replace(':', ' ').trim();
String g = infos[1];
- int index = g.indexOf( ':' );
- this.groupId = ( index < 0 ) ? g : g.substring( 0, index );
- this.srcBin = ( infos.length > 2 ) && "src+bin".equals( infos[2] );
- this.groupIndexPageUrl = ( !srcBin && ( infos.length > 2 ) ) ? infos[2] : null;
+ int index = g.indexOf(':');
+ this.groupId = (index < 0) ? g : g.substring(0, index);
+ this.srcBin = (infos.length > 2) && "src+bin".equals(infos[2]);
+ this.groupIndexPageUrl = (!srcBin && (infos.length > 2)) ? infos[2] : null;
- this.artifactId = ( index < 0 ) ? null : g.substring( index + 1 );
+ this.artifactId = (index < 0) ? null : g.substring(index + 1);
this.versionRange = null;
this.indexPageUrl = DistCheckIndexPageReport.POMS_INDEX_URL; // in case of group parent pom artifact
}
@@ -74,16 +71,15 @@
* @param infos an array of {@link java.lang.String} objects
* @throws org.apache.maven.artifact.versioning.InvalidVersionSpecificationException if any.
*/
- public ConfigurationLineInfo( ConfigurationLineInfo group, String[] infos )
- throws InvalidVersionSpecificationException
- {
+ public ConfigurationLineInfo(ConfigurationLineInfo group, String[] infos)
+ throws InvalidVersionSpecificationException {
this.directory = group.getDirectory();
this.groupId = group.getGroupId();
this.srcBin = group.isSrcBin();
this.groupIndexPageUrl = group.groupIndexPageUrl;
this.artifactId = infos[0];
- this.versionRange = ( infos.length > 1 ) ? VersionRange.createFromVersionSpec( infos[1] ) : null;
+ this.versionRange = (infos.length > 1) ? VersionRange.createFromVersionSpec(infos[1]) : null;
this.indexPageUrl = group.groupIndexPageUrl;
}
@@ -92,38 +88,34 @@
*
* @return a {@link java.lang.String} object
*/
- public String getIndexPageUrl()
- {
+ public String getIndexPageUrl() {
return indexPageUrl;
}
-
+
/**
* <p>getForcedVersion.</p>
*
* @return a {@link java.lang.String} object
*/
- public String getForcedVersion()
- {
+ public String getForcedVersion() {
return forceVersion;
}
-
+
/**
* <p>Setter for the field <code>forceVersion</code>.</p>
*
* @param forceVersion a {@link java.lang.String} object
*/
- public void setForceVersion( String forceVersion )
- {
+ public void setForceVersion(String forceVersion) {
this.forceVersion = forceVersion;
}
-
+
/**
* <p>Getter for the field <code>versionRange</code>.</p>
*
* @return a {@link org.apache.maven.artifact.versioning.VersionRange} object
*/
- public VersionRange getVersionRange()
- {
+ public VersionRange getVersionRange() {
return versionRange;
}
@@ -132,8 +124,7 @@
*
* @return the groupId
*/
- public String getGroupId()
- {
+ public String getGroupId() {
return groupId;
}
@@ -142,8 +133,7 @@
*
* @return the artifactId
*/
- public String getArtifactId()
- {
+ public String getArtifactId() {
return artifactId;
}
@@ -152,8 +142,7 @@
*
* @return the directory
*/
- public String getDirectory()
- {
+ public String getDirectory() {
return directory;
}
@@ -162,8 +151,7 @@
*
* @return a boolean
*/
- public boolean isSrcBin()
- {
+ public boolean isSrcBin() {
return srcBin;
}
@@ -174,9 +162,8 @@
* @param folder a {@link java.lang.String} object
* @return a {@link java.lang.String} object
*/
- public String getBaseURL( String repoBaseUrl, String folder )
- {
- return repoBaseUrl + groupId.replaceAll( "\\.", URLSEP ) + URLSEP + artifactId + URLSEP + folder;
+ public String getBaseURL(String repoBaseUrl, String folder) {
+ return repoBaseUrl + groupId.replaceAll("\\.", URLSEP) + URLSEP + artifactId + URLSEP + folder;
}
/**
@@ -185,9 +172,8 @@
* @param repoBaseUrl a {@link java.lang.String} object
* @return a {@link java.lang.String} object
*/
- public String getMetadataFileURL( String repoBaseUrl )
- {
- return getBaseURL( repoBaseUrl, "maven-metadata.xml" );
+ public String getMetadataFileURL(String repoBaseUrl) {
+ return getBaseURL(repoBaseUrl, "maven-metadata.xml");
}
/**
@@ -197,18 +183,15 @@
* @param version a {@link java.lang.String} object
* @return a {@link java.lang.String} object
*/
- public String getVersionnedFolderURL( String repoBaseUrl, String version )
- {
- return getBaseURL( repoBaseUrl, version ) + '/';
+ public String getVersionnedFolderURL(String repoBaseUrl, String version) {
+ return getBaseURL(repoBaseUrl, version) + '/';
}
- String getVersionnedPomFileURL( String repoBaseUrl, String version )
- {
- return getBaseURL( repoBaseUrl, version + URLSEP + artifactId + "-" + version + ".pom" );
+ String getVersionnedPomFileURL(String repoBaseUrl, String version) {
+ return getBaseURL(repoBaseUrl, version + URLSEP + artifactId + "-" + version + ".pom");
}
- void setMetadata( Metadata aMetadata )
- {
+ void setMetadata(Metadata aMetadata) {
this.metadata = aMetadata;
}
@@ -217,13 +200,12 @@
*
* @return a {@link java.lang.String} object
*/
- public String getReleaseDateFromMetadata()
- {
- DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern( "yyyyMMddkkmmss" );
- TemporalAccessor ta = dateFormatter.parse( metadata.getVersioning().getLastUpdated() );
+ public String getReleaseDateFromMetadata() {
+ DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyyMMddkkmmss");
+ TemporalAccessor ta = dateFormatter.parse(metadata.getVersioning().getLastUpdated());
// inverted for index page check
- return DateTimeFormatter.ISO_LOCAL_DATE.format( ta );
+ return DateTimeFormatter.ISO_LOCAL_DATE.format(ta);
}
/**
@@ -233,9 +215,8 @@
* @param dist a boolean
* @return a {@link java.lang.String} object
*/
- public String getSourceReleaseFilename( String version, boolean dist )
- {
+ public String getSourceReleaseFilename(String version, boolean dist) {
return artifactId + "-" + version
- + ( srcBin && ( dist || !"maven-ant-tasks".equals( artifactId ) ) ? "-src" : "-source-release" ) + ".zip";
+ + (srcBin && (dist || !"maven-ant-tasks".equals(artifactId)) ? "-src" : "-source-release") + ".zip";
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/DistCheckErrorsReport.java b/src/main/java/org/apache/maven/dist/tools/DistCheckErrorsReport.java
index dc30375..14b2084 100644
--- a/src/main/java/org/apache/maven/dist/tools/DistCheckErrorsReport.java
+++ b/src/main/java/org/apache/maven/dist/tools/DistCheckErrorsReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools;
import java.io.File;
import java.io.IOException;
@@ -38,100 +37,81 @@
*
* @author skygo
*/
-@Mojo( name = "check-errors", requiresProject = false )
-public class DistCheckErrorsReport
- extends AbstractDistCheckReport
-{
- private static final String[] FAILURES_FILENAMES = { DistCheckSourceReleaseReport.FAILURES_FILENAME,
- DistCheckSiteReport.FAILURES_FILENAME, DistCheckIndexPageReport.FAILURES_FILENAME,
- CheckPgpKeysReport.FAILURES_FILENAME };
+@Mojo(name = "check-errors", requiresProject = false)
+public class DistCheckErrorsReport extends AbstractDistCheckReport {
+ private static final String[] FAILURES_FILENAMES = {
+ DistCheckSourceReleaseReport.FAILURES_FILENAME,
+ DistCheckSiteReport.FAILURES_FILENAME,
+ DistCheckIndexPageReport.FAILURES_FILENAME,
+ CheckPgpKeysReport.FAILURES_FILENAME
+ };
- private static final String EOL = System.getProperty( "line.separator" );
+ private static final String EOL = System.getProperty("line.separator");
/**
* Dist Check Errors Report.
*/
- public DistCheckErrorsReport()
- {
- }
+ public DistCheckErrorsReport() {}
/** {@inheritDoc} */
@Override
- protected boolean isIndexPageCheck()
- {
+ protected boolean isIndexPageCheck() {
return false;
}
- boolean isDummyFailure()
- {
+ boolean isDummyFailure() {
return false;
}
- private boolean checkError( String failuresFilename )
- throws MavenReportException
- {
- File failureFile = new File( failuresDirectory, failuresFilename );
+ private boolean checkError(String failuresFilename) throws MavenReportException {
+ File failureFile = new File(failuresDirectory, failuresFilename);
- try
- {
- if ( failureFile.exists() )
- {
- String content = FileUtils.fileRead( failureFile );
+ try {
+ if (failureFile.exists()) {
+ String content = FileUtils.fileRead(failureFile);
- if ( isDummyFailure() )
- {
- getLog().error( failuresFilename + " error log not empty:" + EOL + content );
- }
- else
- {
- String failure = failuresFilename.substring( 0, failuresFilename.length() - 4 );
+ if (isDummyFailure()) {
+ getLog().error(failuresFilename + " error log not empty:" + EOL + content);
+ } else {
+ String failure = failuresFilename.substring(0, failuresFilename.length() - 4);
getSink().section2();
getSink().sectionTitle2();
- getSink().link( "dist-tool-" + failure + ".html" );
- getSink().text( failure );
+ getSink().link("dist-tool-" + failure + ".html");
+ getSink().text(failure);
getSink().link_();
getSink().sectionTitle2_();
- getSink().verbatim( SinkEventAttributeSet.BOXED );
- getSink().rawText( content );
+ getSink().verbatim(SinkEventAttributeSet.BOXED);
+ getSink().rawText(content);
getSink().verbatim_();
getSink().section2_();
}
}
return failureFile.exists();
- }
- catch ( IOException ioe )
- {
- throw new MavenReportException( "Cannot read " + failureFile, ioe );
+ } catch (IOException ioe) {
+ throw new MavenReportException("Cannot read " + failureFile, ioe);
}
}
/** {@inheritDoc} */
@Override
- protected void executeReport( Locale locale )
- throws MavenReportException
- {
+ protected void executeReport(Locale locale) throws MavenReportException {
boolean failure = false;
// if failures log file is present, throw exception to fail build
- for ( String failuresFilename : FAILURES_FILENAMES )
- {
- failure |= checkError( failuresFilename );
+ for (String failuresFilename : FAILURES_FILENAMES) {
+ failure |= checkError(failuresFilename);
}
- if ( failure )
- {
- if ( isDummyFailure() )
- {
+ if (failure) {
+ if (isDummyFailure()) {
throw new MavenReportException(
"Dist Tool> Checks found inconsistencies in some released artifacts, see "
- + "https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-dist-tool/job/master/site/"
- + "dist-tool-check-errors.html for more information" );
+ + "https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-dist-tool/job/master/site/"
+ + "dist-tool-check-errors.html for more information");
}
- }
- else
- {
+ } else {
getSink().paragraph();
- getSink().text( "No issue found." );
+ getSink().text("No issue found.");
getSink().paragraph_();
}
}
@@ -141,36 +121,29 @@
*
* @return a {@link java.lang.String} object
*/
- protected String getFailuresFilename()
- {
+ protected String getFailuresFilename() {
return "dummy";
}
/** {@inheritDoc} */
@Override
- public String getOutputName()
- {
+ public String getOutputName() {
return "dist-tool-check-errors";
}
/** {@inheritDoc} */
@Override
- public String getName( Locale locale )
- {
+ public String getName(Locale locale) {
return "Dist Tool> Check Errors";
}
/** {@inheritDoc} */
@Override
- public String getDescription( Locale locale )
- {
+ public String getDescription(Locale locale) {
return "Dist Tool report to display inconsistencies found by any check report";
}
/** {@inheritDoc} */
@Override
- protected void checkArtifact( ConfigurationLineInfo request, String repoBase )
- throws MojoExecutionException
- {
- }
+ protected void checkArtifact(ConfigurationLineInfo request, String repoBase) throws MojoExecutionException {}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/DummyFailureReport.java b/src/main/java/org/apache/maven/dist/tools/DummyFailureReport.java
index c9453d1..022418b 100644
--- a/src/main/java/org/apache/maven/dist/tools/DummyFailureReport.java
+++ b/src/main/java/org/apache/maven/dist/tools/DummyFailureReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools;
import java.util.Locale;
@@ -28,20 +27,15 @@
*
* @author skygo
*/
-@Mojo( name = "failure-report", requiresProject = false )
-public class DummyFailureReport
- extends DistCheckErrorsReport
-{
+@Mojo(name = "failure-report", requiresProject = false)
+public class DummyFailureReport extends DistCheckErrorsReport {
/**
* Dummy
*/
- public DummyFailureReport()
- {
- }
+ public DummyFailureReport() {}
@Override
- boolean isDummyFailure()
- {
+ boolean isDummyFailure() {
return true;
}
@@ -50,29 +44,25 @@
*
* @return a {@link java.lang.String} object
*/
- protected String getFailuresFilename()
- {
+ protected String getFailuresFilename() {
return "dummy";
}
/** {@inheritDoc} */
@Override
- public String getOutputName()
- {
+ public String getOutputName() {
return "dist-tool-failure";
}
/** {@inheritDoc} */
@Override
- public String getName( Locale locale )
- {
+ public String getName(Locale locale) {
return "Dist Tool> Failure Hack";
}
/** {@inheritDoc} */
@Override
- public String getDescription( Locale locale )
- {
+ public String getDescription(Locale locale) {
return "Dist Tool report to fail the build in case of inconsistency found by any check reports";
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/JsoupRetry.java b/src/main/java/org/apache/maven/dist/tools/JsoupRetry.java
index df6f255..f8366e5 100644
--- a/src/main/java/org/apache/maven/dist/tools/JsoupRetry.java
+++ b/src/main/java/org/apache/maven/dist/tools/JsoupRetry.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools;
import java.io.IOException;
@@ -27,8 +26,7 @@
/**
* Reads a url with Jsoup, retrying multiple times in case of IOException.
*/
-public class JsoupRetry
-{
+public class JsoupRetry {
/** Constant <code>MAX_RETRY=3</code> */
public static final int MAX_RETRY = 3;
@@ -38,9 +36,7 @@
/**
* JsoupRetry constructor.
*/
- public JsoupRetry()
- {
- }
+ public JsoupRetry() {}
/**
* <p>get.</p>
@@ -49,35 +45,25 @@
* @return a {@link org.jsoup.nodes.Document} object
* @throws java.io.IOException if any.
*/
- public static Document get( String url )
- throws IOException
- {
- for ( int i = 1; i <= MAX_RETRY; i++ )
- {
- try
- {
- return Jsoup.connect( url )
- .userAgent( "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0" )
- .maxBodySize( 0 )
+ public static Document get(String url) throws IOException {
+ for (int i = 1; i <= MAX_RETRY; i++) {
+ try {
+ return Jsoup.connect(url)
+ .userAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0")
+ .maxBodySize(0)
.get();
- }
- catch ( IOException ioe )
- {
- System.err.println( "IOException try " + i + " while reading " + url + ": " + ioe.getClass() + " "
- + ioe.getMessage() );
+ } catch (IOException ioe) {
+ System.err.println("IOException try " + i + " while reading " + url + ": " + ioe.getClass() + " "
+ + ioe.getMessage());
- if ( i == MAX_RETRY )
- {
- throw new IOException( "IOException while reading " + url, ioe );
+ if (i == MAX_RETRY) {
+ throw new IOException("IOException while reading " + url, ioe);
}
}
- try
- {
- Thread.sleep( WAIT_RETRY_SECONDS * 1000 );
- }
- catch ( InterruptedException e )
- {
+ try {
+ Thread.sleep(WAIT_RETRY_SECONDS * 1000);
+ } catch (InterruptedException e) {
// not expected to happen
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/branches/ListBranchesReport.java b/src/main/java/org/apache/maven/dist/tools/branches/ListBranchesReport.java
index 0e6744a..3cc2c80 100644
--- a/src/main/java/org/apache/maven/dist/tools/branches/ListBranchesReport.java
+++ b/src/main/java/org/apache/maven/dist/tools/branches/ListBranchesReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.branches;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.branches;
import java.io.IOException;
import java.net.HttpURLConnection;
@@ -51,196 +50,181 @@
*
* @author Robert Scholte
*/
-@Mojo( name = "list-branches", requiresProject = false )
-public class ListBranchesReport extends AbstractMavenReport
-{
+@Mojo(name = "list-branches", requiresProject = false)
+public class ListBranchesReport extends AbstractMavenReport {
private static final String JIRA_BASE_URL = "https://issues.apache.org/jira/projects/";
private static final String GITBOX_URL = "https://gitbox.apache.org/repos/asf";
private static final String MAVENBOX_JOBS_BASE_URL = "https://ci-maven.apache.org/job/Maven/job/maven-box/job/";
-
+
private static final String GITHUB_URL = "https://github.com/apache/";
-
+
private static final String DEPENDABOT_CONFIG = ".github/dependabot.yml";
- private static final Collection<String> EXCLUDED = Arrays.asList( "maven-integration-testing",
+ private static final Collection<String> EXCLUDED = Arrays.asList(
+ "maven-integration-testing",
"maven-jenkins-env",
"maven-jenkins-lib",
"maven-sources",
"maven-studies",
"maven-mvnd",
"maven-metric-extension",
- "maven-gh-actions-shared" );
+ "maven-gh-actions-shared");
private static final Map<String, String> JIRAPROJECTS = new HashMap<>();
-
- static
- {
- JIRAPROJECTS.put( "maven", "MNG" );
- JIRAPROJECTS.put( "maven-acr-plugin", "MACR" );
- JIRAPROJECTS.put( "maven-antrun-plugin", "MANTRUN" );
- JIRAPROJECTS.put( "maven-apache-parent", "MPOM" );
- JIRAPROJECTS.put( "maven-archetype", "ARCHETYPE" );
- JIRAPROJECTS.put( "maven-archetypes", "ARCHETYPE" );
- JIRAPROJECTS.put( "maven-archiver", "MSHARED" );
- JIRAPROJECTS.put( "maven-artifact-plugin", "MARTIFACT" );
- JIRAPROJECTS.put( "maven-artifact-transfer", "MSHARED" );
- JIRAPROJECTS.put( "maven-assembly-plugin", "MASSEMBLY" );
- JIRAPROJECTS.put( "maven-build-cache-extension", "MBUILDCACHE" );
- JIRAPROJECTS.put( "maven-changelog-plugin", "MCHANGELOG" );
- JIRAPROJECTS.put( "maven-changes-plugin", "MCHANGES" );
- JIRAPROJECTS.put( "maven-checkstyle-plugin", "MCHECKSTYLE" );
- JIRAPROJECTS.put( "maven-clean-plugin", "MCLEAN" );
- JIRAPROJECTS.put( "maven-common-artifact-filters", "MSHARED" );
- JIRAPROJECTS.put( "maven-compiler-plugin", "MCOMPILER" );
- JIRAPROJECTS.put( "maven-default-skin", "MSKINS" );
- JIRAPROJECTS.put( "maven-dependency-analyzer", "MSHARED" );
- JIRAPROJECTS.put( "maven-dependency-plugin", "MDEP" );
- JIRAPROJECTS.put( "maven-dependency-tree", "MSHARED" );
- JIRAPROJECTS.put( "maven-deploy-plugin", "MDEPLOY" );
- JIRAPROJECTS.put( "maven-doap-plugin", "MDOAP" );
- JIRAPROJECTS.put( "maven-docck-plugin", "MDOCCK" );
- JIRAPROJECTS.put( "maven-doxia", "DOXIA" );
- JIRAPROJECTS.put( "maven-doxia-book-maven-plugin", "DOXIA" );
- JIRAPROJECTS.put( "maven-doxia-book-renderer", "DOXIA" );
- JIRAPROJECTS.put( "maven-doxia-converter", "DOXIATOOLS" );
- JIRAPROJECTS.put( "maven-doxia-linkcheck", "DOXIATOOLS" );
- JIRAPROJECTS.put( "maven-doxia-site", "DOXIA" );
- JIRAPROJECTS.put( "maven-doxia-sitetools", "DOXIASITETOOLS" );
- JIRAPROJECTS.put( "maven-ear-plugin", "MEAR" );
- JIRAPROJECTS.put( "maven-ejb-plugin", "MEJB" );
- JIRAPROJECTS.put( "maven-enforcer", "MENFORCER" );
- JIRAPROJECTS.put( "maven-file-management", "MSHARED" );
- JIRAPROJECTS.put( "maven-filtering", "MSHARED" );
- JIRAPROJECTS.put( "maven-fluido-skin", "MSKINS" );
- JIRAPROJECTS.put( "maven-gpg-plugin", "MGPG" );
- JIRAPROJECTS.put( "maven-help-plugin", "MHELP" );
- JIRAPROJECTS.put( "maven-indexer", "MINDEXER" );
- JIRAPROJECTS.put( "maven-install-plugin", "MINSTALL" );
- JIRAPROJECTS.put( "maven-integration-testing", "MNG" );
- JIRAPROJECTS.put( "maven-invoker", "MSHARED" );
- JIRAPROJECTS.put( "maven-invoker-plugin", "MINVOKER" );
- JIRAPROJECTS.put( "maven-jar-plugin", "MJAR" );
- JIRAPROJECTS.put( "maven-jarsigner", "MSHARED" );
- JIRAPROJECTS.put( "maven-jarsigner-plugin", "MJARSIGNER" );
- JIRAPROJECTS.put( "maven-javadoc-plugin", "MJAVADOC" );
- JIRAPROJECTS.put( "maven-jdeprscan-plugin", "MJDEPRSCAN" );
- JIRAPROJECTS.put( "maven-jdeps-plugin", "MJDEPS" );
- JIRAPROJECTS.put( "maven-jlink-plugin", "MJLINK" );
- JIRAPROJECTS.put( "maven-jmod-plugin", "MJMOD" );
- JIRAPROJECTS.put( "maven-jxr", "JXR" );
- JIRAPROJECTS.put( "maven-linkcheck-plugin", "MLINKCHECK" );
- JIRAPROJECTS.put( "maven-mapping", "MSHARED" );
- JIRAPROJECTS.put( "maven-parent", "MPOM" );
- JIRAPROJECTS.put( "maven-patch-plugin", "MPATCH" );
- JIRAPROJECTS.put( "maven-pdf-plugin", "MPDF" );
- JIRAPROJECTS.put( "maven-plugin-testing", "MPLUGINTESTING" );
- JIRAPROJECTS.put( "maven-plugin-tools", "MPLUGIN" );
- JIRAPROJECTS.put( "maven-pmd-plugin", "MPMD" );
- JIRAPROJECTS.put( "maven-project-info-reports-plugin", "MPIR" );
- JIRAPROJECTS.put( "maven-project-utils", "MSHARED" );
- JIRAPROJECTS.put( "maven-rar-plugin", "MRAR" );
- JIRAPROJECTS.put( "maven-release", "MRELEASE" );
- JIRAPROJECTS.put( "maven-remote-resources-plugin", "MRRESOURCES" );
- JIRAPROJECTS.put( "maven-reporting-api", "MSHARED" );
- JIRAPROJECTS.put( "maven-reporting-exec", "MSHARED" );
- JIRAPROJECTS.put( "maven-reporting-impl", "MSHARED" );
- JIRAPROJECTS.put( "maven-resolver", "MRESOLVER" );
- JIRAPROJECTS.put( "maven-resolver-ant-tasks", "MRESOLVER" );
- JIRAPROJECTS.put( "maven-resources-plugin", "MRESOURCES" );
- JIRAPROJECTS.put( "maven-scm", "SCM" );
- JIRAPROJECTS.put( "maven-scm-publish-plugin", "MSCMPUB" );
- JIRAPROJECTS.put( "maven-script-interpreter", "MSHARED" );
- JIRAPROJECTS.put( "maven-scripting-plugin", "MSCRIPTING" );
- JIRAPROJECTS.put( "maven-shade-plugin", "MSHADE" );
- JIRAPROJECTS.put( "maven-shared-incremental", "MSHARED" );
- JIRAPROJECTS.put( "maven-shared-io", "MSHARED" );
- JIRAPROJECTS.put( "maven-shared-jar", "MSHARED" );
- JIRAPROJECTS.put( "maven-shared-resources", "MSHARED" );
- JIRAPROJECTS.put( "maven-shared-utils", "MSHARED" );
- JIRAPROJECTS.put( "maven-site", "MNGSITE" );
- JIRAPROJECTS.put( "maven-site-plugin", "MSITE" );
- JIRAPROJECTS.put( "maven-source-plugin", "MSOURCES" );
- JIRAPROJECTS.put( "maven-stage-plugin", "MSTAGE" );
- JIRAPROJECTS.put( "maven-surefire", "SUREFIRE" );
- JIRAPROJECTS.put( "maven-toolchains-plugin", "MTOOLCHAINS" );
- JIRAPROJECTS.put( "maven-verifier", "MSHARED" );
- JIRAPROJECTS.put( "maven-verifier-plugin", "MVERIFIER" );
- JIRAPROJECTS.put( "maven-wagon", "WAGON" );
- JIRAPROJECTS.put( "maven-war-plugin", "MWAR" );
- JIRAPROJECTS.put( "maven-wrapper", "MWRAPPER" );
+
+ static {
+ JIRAPROJECTS.put("maven", "MNG");
+ JIRAPROJECTS.put("maven-acr-plugin", "MACR");
+ JIRAPROJECTS.put("maven-antrun-plugin", "MANTRUN");
+ JIRAPROJECTS.put("maven-apache-parent", "MPOM");
+ JIRAPROJECTS.put("maven-archetype", "ARCHETYPE");
+ JIRAPROJECTS.put("maven-archetypes", "ARCHETYPE");
+ JIRAPROJECTS.put("maven-archiver", "MSHARED");
+ JIRAPROJECTS.put("maven-artifact-plugin", "MARTIFACT");
+ JIRAPROJECTS.put("maven-artifact-transfer", "MSHARED");
+ JIRAPROJECTS.put("maven-assembly-plugin", "MASSEMBLY");
+ JIRAPROJECTS.put("maven-build-cache-extension", "MBUILDCACHE");
+ JIRAPROJECTS.put("maven-changelog-plugin", "MCHANGELOG");
+ JIRAPROJECTS.put("maven-changes-plugin", "MCHANGES");
+ JIRAPROJECTS.put("maven-checkstyle-plugin", "MCHECKSTYLE");
+ JIRAPROJECTS.put("maven-clean-plugin", "MCLEAN");
+ JIRAPROJECTS.put("maven-common-artifact-filters", "MSHARED");
+ JIRAPROJECTS.put("maven-compiler-plugin", "MCOMPILER");
+ JIRAPROJECTS.put("maven-default-skin", "MSKINS");
+ JIRAPROJECTS.put("maven-dependency-analyzer", "MSHARED");
+ JIRAPROJECTS.put("maven-dependency-plugin", "MDEP");
+ JIRAPROJECTS.put("maven-dependency-tree", "MSHARED");
+ JIRAPROJECTS.put("maven-deploy-plugin", "MDEPLOY");
+ JIRAPROJECTS.put("maven-doap-plugin", "MDOAP");
+ JIRAPROJECTS.put("maven-docck-plugin", "MDOCCK");
+ JIRAPROJECTS.put("maven-doxia", "DOXIA");
+ JIRAPROJECTS.put("maven-doxia-book-maven-plugin", "DOXIA");
+ JIRAPROJECTS.put("maven-doxia-book-renderer", "DOXIA");
+ JIRAPROJECTS.put("maven-doxia-converter", "DOXIATOOLS");
+ JIRAPROJECTS.put("maven-doxia-linkcheck", "DOXIATOOLS");
+ JIRAPROJECTS.put("maven-doxia-site", "DOXIA");
+ JIRAPROJECTS.put("maven-doxia-sitetools", "DOXIASITETOOLS");
+ JIRAPROJECTS.put("maven-ear-plugin", "MEAR");
+ JIRAPROJECTS.put("maven-ejb-plugin", "MEJB");
+ JIRAPROJECTS.put("maven-enforcer", "MENFORCER");
+ JIRAPROJECTS.put("maven-file-management", "MSHARED");
+ JIRAPROJECTS.put("maven-filtering", "MSHARED");
+ JIRAPROJECTS.put("maven-fluido-skin", "MSKINS");
+ JIRAPROJECTS.put("maven-gpg-plugin", "MGPG");
+ JIRAPROJECTS.put("maven-help-plugin", "MHELP");
+ JIRAPROJECTS.put("maven-indexer", "MINDEXER");
+ JIRAPROJECTS.put("maven-install-plugin", "MINSTALL");
+ JIRAPROJECTS.put("maven-integration-testing", "MNG");
+ JIRAPROJECTS.put("maven-invoker", "MSHARED");
+ JIRAPROJECTS.put("maven-invoker-plugin", "MINVOKER");
+ JIRAPROJECTS.put("maven-jar-plugin", "MJAR");
+ JIRAPROJECTS.put("maven-jarsigner", "MSHARED");
+ JIRAPROJECTS.put("maven-jarsigner-plugin", "MJARSIGNER");
+ JIRAPROJECTS.put("maven-javadoc-plugin", "MJAVADOC");
+ JIRAPROJECTS.put("maven-jdeprscan-plugin", "MJDEPRSCAN");
+ JIRAPROJECTS.put("maven-jdeps-plugin", "MJDEPS");
+ JIRAPROJECTS.put("maven-jlink-plugin", "MJLINK");
+ JIRAPROJECTS.put("maven-jmod-plugin", "MJMOD");
+ JIRAPROJECTS.put("maven-jxr", "JXR");
+ JIRAPROJECTS.put("maven-linkcheck-plugin", "MLINKCHECK");
+ JIRAPROJECTS.put("maven-mapping", "MSHARED");
+ JIRAPROJECTS.put("maven-parent", "MPOM");
+ JIRAPROJECTS.put("maven-patch-plugin", "MPATCH");
+ JIRAPROJECTS.put("maven-pdf-plugin", "MPDF");
+ JIRAPROJECTS.put("maven-plugin-testing", "MPLUGINTESTING");
+ JIRAPROJECTS.put("maven-plugin-tools", "MPLUGIN");
+ JIRAPROJECTS.put("maven-pmd-plugin", "MPMD");
+ JIRAPROJECTS.put("maven-project-info-reports-plugin", "MPIR");
+ JIRAPROJECTS.put("maven-project-utils", "MSHARED");
+ JIRAPROJECTS.put("maven-rar-plugin", "MRAR");
+ JIRAPROJECTS.put("maven-release", "MRELEASE");
+ JIRAPROJECTS.put("maven-remote-resources-plugin", "MRRESOURCES");
+ JIRAPROJECTS.put("maven-reporting-api", "MSHARED");
+ JIRAPROJECTS.put("maven-reporting-exec", "MSHARED");
+ JIRAPROJECTS.put("maven-reporting-impl", "MSHARED");
+ JIRAPROJECTS.put("maven-resolver", "MRESOLVER");
+ JIRAPROJECTS.put("maven-resolver-ant-tasks", "MRESOLVER");
+ JIRAPROJECTS.put("maven-resources-plugin", "MRESOURCES");
+ JIRAPROJECTS.put("maven-scm", "SCM");
+ JIRAPROJECTS.put("maven-scm-publish-plugin", "MSCMPUB");
+ JIRAPROJECTS.put("maven-script-interpreter", "MSHARED");
+ JIRAPROJECTS.put("maven-scripting-plugin", "MSCRIPTING");
+ JIRAPROJECTS.put("maven-shade-plugin", "MSHADE");
+ JIRAPROJECTS.put("maven-shared-incremental", "MSHARED");
+ JIRAPROJECTS.put("maven-shared-io", "MSHARED");
+ JIRAPROJECTS.put("maven-shared-jar", "MSHARED");
+ JIRAPROJECTS.put("maven-shared-resources", "MSHARED");
+ JIRAPROJECTS.put("maven-shared-utils", "MSHARED");
+ JIRAPROJECTS.put("maven-site", "MNGSITE");
+ JIRAPROJECTS.put("maven-site-plugin", "MSITE");
+ JIRAPROJECTS.put("maven-source-plugin", "MSOURCES");
+ JIRAPROJECTS.put("maven-stage-plugin", "MSTAGE");
+ JIRAPROJECTS.put("maven-surefire", "SUREFIRE");
+ JIRAPROJECTS.put("maven-toolchains-plugin", "MTOOLCHAINS");
+ JIRAPROJECTS.put("maven-verifier", "MSHARED");
+ JIRAPROJECTS.put("maven-verifier-plugin", "MVERIFIER");
+ JIRAPROJECTS.put("maven-wagon", "WAGON");
+ JIRAPROJECTS.put("maven-war-plugin", "MWAR");
+ JIRAPROJECTS.put("maven-wrapper", "MWRAPPER");
}
/**
* List Branches Constructor.
*/
- public ListBranchesReport()
- {
- }
+ public ListBranchesReport() {}
/** {@inheritDoc} */
@Override
- public String getOutputName()
- {
+ public String getOutputName() {
return "dist-tool-branches";
}
/** {@inheritDoc} */
@Override
- public String getName( Locale locale )
- {
+ public String getName(Locale locale) {
return "Dist Tool> List Branches";
}
/** {@inheritDoc} */
@Override
- public String getDescription( Locale locale )
- {
+ public String getDescription(Locale locale) {
return "Shows the list of branches of every Git repository on one page";
}
/** {@inheritDoc} */
@Override
- protected void executeReport( Locale locale )
- throws MavenReportException
- {
+ protected void executeReport(Locale locale) throws MavenReportException {
Collection<String> repositoryNames;
- try
- {
+ try {
repositoryNames = repositoryNames();
+ } catch (IOException e) {
+ throw new MavenReportException("Failed to extract repositorynames from Gitbox", e);
}
- catch ( IOException e )
- {
- throw new MavenReportException( "Failed to extract repositorynames from Gitbox", e );
- }
-
- List<Result> repoStatus = new ArrayList<>( repositoryNames.size() );
-
- Collection<String> included = repositoryNames.stream()
- .filter( s -> !EXCLUDED.contains( s ) )
- .collect( Collectors.toList() );
-
- for ( String repository : included )
- {
- final String gitboxHeadsUrl = getGitboxHeadsUrl( repository );
+
+ List<Result> repoStatus = new ArrayList<>(repositoryNames.size());
+
+ Collection<String> included =
+ repositoryNames.stream().filter(s -> !EXCLUDED.contains(s)).collect(Collectors.toList());
+
+ for (String repository : included) {
+ final String gitboxHeadsUrl = getGitboxHeadsUrl(repository);
final String repositoryJobUrl = MAVENBOX_JOBS_BASE_URL + repository;
- try
- {
- Document gitboxHeadsDoc = JsoupRetry.get( gitboxHeadsUrl );
-
- Element headsTable = gitboxHeadsDoc.selectFirst( "table.heads" );
-
- if ( headsTable == null )
- {
- getLog().warn( "Ignoring " + repository );
+ try {
+ Document gitboxHeadsDoc = JsoupRetry.get(gitboxHeadsUrl);
+
+ Element headsTable = gitboxHeadsDoc.selectFirst("table.heads");
+
+ if (headsTable == null) {
+ getLog().warn("Ignoring " + repository);
continue;
}
-
- Document jenkinsBranchesDoc = JsoupRetry.get( repositoryJobUrl );
- Result result = new Result( repository, repositoryJobUrl );
+ Document jenkinsBranchesDoc = JsoupRetry.get(repositoryJobUrl);
+
+ Result result = new Result(repository, repositoryJobUrl);
int masterBranchesGit = 0;
int masterBranchesJenkins = 0;
Collection<String> jiraBranchesGit = new ArrayList<>();
@@ -249,73 +233,57 @@
Collection<String> dependabotBranchesJenkins = new ArrayList<>();
Collection<String> restGit = new ArrayList<>();
Collection<String> restJenkins = new ArrayList<>();
-
- for ( Element tableRow : headsTable.select( "tr" ) )
- {
- String name = tableRow.selectFirst( "a.name" ).text();
- if ( "master".equals( name ) )
- {
+ for (Element tableRow : headsTable.select("tr")) {
+ String name = tableRow.selectFirst("a.name").text();
+
+ if ("master".equals(name)) {
masterBranchesGit++;
-
- if ( jenkinsBranchesDoc.getElementById( "job_master" ) != null )
- {
+
+ if (jenkinsBranchesDoc.getElementById("job_master") != null) {
masterBranchesJenkins++;
}
- }
- else if ( JIRAPROJECTS.containsKey( repository )
- && name.toUpperCase().startsWith( JIRAPROJECTS.get( repository ) + '-' ) )
- {
- jiraBranchesGit.add( name );
- if ( jenkinsBranchesDoc.getElementById( URLEncoder.encode( "job_" + name, "UTF-8" ) ) != null )
- {
- jiraBranchesJenkins.add( name );
+ } else if (JIRAPROJECTS.containsKey(repository)
+ && name.toUpperCase().startsWith(JIRAPROJECTS.get(repository) + '-')) {
+ jiraBranchesGit.add(name);
+ if (jenkinsBranchesDoc.getElementById(URLEncoder.encode("job_" + name, "UTF-8")) != null) {
+ jiraBranchesJenkins.add(name);
}
- }
- else if ( name.startsWith( "dependabot/" ) )
- {
- dependabotBranchesGit.add( name );
- if ( jenkinsBranchesDoc.getElementById( URLEncoder.encode( "job_" + name, "UTF-8" ) ) != null )
- {
- dependabotBranchesJenkins.add( name );
+ } else if (name.startsWith("dependabot/")) {
+ dependabotBranchesGit.add(name);
+ if (jenkinsBranchesDoc.getElementById(URLEncoder.encode("job_" + name, "UTF-8")) != null) {
+ dependabotBranchesJenkins.add(name);
}
- }
- else
- {
- restGit.add( name );
- if ( jenkinsBranchesDoc.getElementById( URLEncoder.encode( "job_" + name, "UTF-8" ) ) != null )
- {
- restJenkins.add( name );
+ } else {
+ restGit.add(name);
+ if (jenkinsBranchesDoc.getElementById(URLEncoder.encode("job_" + name, "UTF-8")) != null) {
+ restJenkins.add(name);
}
}
}
- result.setMasterBranchesGit( masterBranchesGit );
- result.setMasterBranchesJenkins( masterBranchesJenkins );
- result.setJiraBranchesGit( jiraBranchesGit );
- result.setJiraBranchesJenkins( jiraBranchesJenkins );
- result.setDependabotBranchesGit( dependabotBranchesGit );
- result.setDependabotBranchesJenkins( dependabotBranchesJenkins );
- result.setRestGit( restGit );
- result.setRestJenkins( restJenkins );
+ result.setMasterBranchesGit(masterBranchesGit);
+ result.setMasterBranchesJenkins(masterBranchesJenkins);
+ result.setJiraBranchesGit(jiraBranchesGit);
+ result.setJiraBranchesJenkins(jiraBranchesJenkins);
+ result.setDependabotBranchesGit(dependabotBranchesGit);
+ result.setDependabotBranchesJenkins(dependabotBranchesJenkins);
+ result.setRestGit(restGit);
+ result.setRestJenkins(restJenkins);
- repoStatus.add( result );
- }
- catch ( IOException e )
- {
- getLog().warn( "Failed to read status for " + repository + " Jenkins job " + repositoryJobUrl );
+ repoStatus.add(result);
+ } catch (IOException e) {
+ getLog().warn("Failed to read status for " + repository + " Jenkins job " + repositoryJobUrl);
}
}
-
- generateReport( repoStatus );
+
+ generateReport(repoStatus);
}
- private String getGitboxHeadsUrl( String repository )
- {
+ private String getGitboxHeadsUrl(String repository) {
return GITBOX_URL + "?p=" + repository + ".git;a=heads";
}
-
- private void generateReport( List<Result> repoStatus )
- {
+
+ private void generateReport(List<Result> repoStatus) {
AtomicInteger masterJenkinsTotal = new AtomicInteger();
AtomicInteger masterGitTotal = new AtomicInteger();
AtomicInteger jiraJenkinsTotal = new AtomicInteger();
@@ -324,203 +292,196 @@
AtomicInteger dependabotGitTotal = new AtomicInteger();
AtomicInteger restJenkinsTotal = new AtomicInteger();
AtomicInteger restGitTotal = new AtomicInteger();
-
+
Sink sink = getSink();
-
+
sink.head();
sink.title();
- sink.text( "List Branches" );
+ sink.text("List Branches");
sink.title_();
sink.head_();
-
+
sink.body();
sink.paragraph();
- sink.rawText( "Values are shown as <code>jenkinsBranches / gitBranches</code>, "
- + "because not all branches end up in Jenkins, this depends on the existence of the JenkinsFile.<br>" );
- sink.rawText( "Hover over the values to see branch names, values link to its URL to Jenkins or Gitbox</br>" );
- sink.rawText( "For Dependabot an empty field means there's no <code>" + DEPENDABOT_CONFIG + "</code>" );
-
+ sink.rawText("Values are shown as <code>jenkinsBranches / gitBranches</code>, "
+ + "because not all branches end up in Jenkins, this depends on the existence of the JenkinsFile.<br>");
+ sink.rawText("Hover over the values to see branch names, values link to its URL to Jenkins or Gitbox</br>");
+ sink.rawText("For Dependabot an empty field means there's no <code>" + DEPENDABOT_CONFIG + "</code>");
+
sink.paragraph();
sink.table();
sink.tableRow();
sink.tableHeaderCell();
- sink.text( "Repository" );
+ sink.text("Repository");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.text( "JIRA" );
+ sink.text("JIRA");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.text( "Branches:" );
+ sink.text("Branches:");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.text( "master" );
+ sink.text("master");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.text( "JIRA" );
+ sink.text("JIRA");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.text( "Dependabot" );
+ sink.text("Dependabot");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.text( "Rest" );
+ sink.text("Rest");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.text( "Total" );
+ sink.text("Total");
sink.tableHeaderCell_();
sink.tableRow_();
-
+
repoStatus.stream()
- .sorted( Comparator.comparing( Result::getTotalJenkins ).thenComparing( Result::getTotalGit ).reversed() )
- .forEach( r ->
- {
- sink.tableRow();
+ .sorted(Comparator.comparing(Result::getTotalJenkins)
+ .thenComparing(Result::getTotalGit)
+ .reversed())
+ .forEach(r -> {
+ sink.tableRow();
- // GitHub
- sink.tableCell();
- sink.text( r.getRepositoryName() );
- sink.tableCell_();
+ // GitHub
+ sink.tableCell();
+ sink.text(r.getRepositoryName());
+ sink.tableCell_();
- // Jira
- sink.tableCell();
- String jiraId = JIRAPROJECTS.get( r.getRepositoryName() );
- if ( jiraId != null )
- {
- sink.link( JIRA_BASE_URL + jiraId );
- sink.rawText( jiraId );
- sink.link_();
- }
- sink.tableCell_();
+ // Jira
+ sink.tableCell();
+ String jiraId = JIRAPROJECTS.get(r.getRepositoryName());
+ if (jiraId != null) {
+ sink.link(JIRA_BASE_URL + jiraId);
+ sink.rawText(jiraId);
+ sink.link_();
+ }
+ sink.tableCell_();
- // branches:
- sink.tableCell();
- sink.tableCell_();
+ // branches:
+ sink.tableCell();
+ sink.tableCell_();
- // master
- sink.tableCell();
- sink.text( r.getMasterBranchesJenkins() + " / " + r.getMasterBranchesGit() );
- sink.tableCell_();
- masterJenkinsTotal.addAndGet( r.getMasterBranchesJenkins() );
- masterGitTotal.addAndGet( r.getMasterBranchesGit() );
+ // master
+ sink.tableCell();
+ sink.text(r.getMasterBranchesJenkins() + " / " + r.getMasterBranchesGit());
+ sink.tableCell_();
+ masterJenkinsTotal.addAndGet(r.getMasterBranchesJenkins());
+ masterGitTotal.addAndGet(r.getMasterBranchesGit());
- //jira branches
- sink.tableCell();
- if ( r.getJiraBranchesGit().isEmpty() )
- {
- sink.text( "-" );
- }
- else
- {
- SinkEventAttributes jiraLinkAttributes = new SinkEventAttributeSet();
- jiraLinkAttributes.addAttribute( SinkEventAttributes.TITLE,
- r.getJiraBranchesJenkins().stream().collect( Collectors.joining( "\n" ) ) );
+ // jira branches
+ sink.tableCell();
+ if (r.getJiraBranchesGit().isEmpty()) {
+ sink.text("-");
+ } else {
+ SinkEventAttributes jiraLinkAttributes = new SinkEventAttributeSet();
+ jiraLinkAttributes.addAttribute(
+ SinkEventAttributes.TITLE,
+ r.getJiraBranchesJenkins().stream().collect(Collectors.joining("\n")));
- SinkEventAttributes gitLinkAttributes = new SinkEventAttributeSet();
- r.getJiraBranchesGit().stream()
- .filter( n -> !r.getJiraBranchesJenkins().contains( n ) )
- .reduce( ( n1, n2 ) -> n1 + "\n" + n2 )
- .ifPresent( t -> gitLinkAttributes.addAttribute( SinkEventAttributes.TITLE,
- "-- non-Jenkins branches --\n" + t ) );
-
- sink.bold();
- sink.link( r.getBuildUrl(), jiraLinkAttributes );
- sink.rawText( String.valueOf( r.getJiraBranchesJenkins().size() ) );
- sink.link_();
- sink.text( " / " );
- sink.link( getGitboxHeadsUrl( r.getRepositoryName() ), gitLinkAttributes );
- sink.rawText( String.valueOf( r.getJiraBranchesGit().size() ) );
- sink.link_();
- sink.bold_();
-
- jiraJenkinsTotal.addAndGet( r.getJiraBranchesJenkins().size() );
- jiraGitTotal.addAndGet( r.getJiraBranchesGit().size() );
- }
- sink.tableCell_();
+ SinkEventAttributes gitLinkAttributes = new SinkEventAttributeSet();
+ r.getJiraBranchesGit().stream()
+ .filter(n -> !r.getJiraBranchesJenkins().contains(n))
+ .reduce((n1, n2) -> n1 + "\n" + n2)
+ .ifPresent(t -> gitLinkAttributes.addAttribute(
+ SinkEventAttributes.TITLE, "-- non-Jenkins branches --\n" + t));
- // dependabot branches
- sink.tableCell();
- if ( r.getDependabotBranchesGit().isEmpty() )
- {
- try
- {
- if ( hasDependabotYml( r.getRepositoryName() ) )
- {
- sink.text( "-" );
+ sink.bold();
+ sink.link(r.getBuildUrl(), jiraLinkAttributes);
+ sink.rawText(String.valueOf(r.getJiraBranchesJenkins().size()));
+ sink.link_();
+ sink.text(" / ");
+ sink.link(getGitboxHeadsUrl(r.getRepositoryName()), gitLinkAttributes);
+ sink.rawText(String.valueOf(r.getJiraBranchesGit().size()));
+ sink.link_();
+ sink.bold_();
+
+ jiraJenkinsTotal.addAndGet(r.getJiraBranchesJenkins().size());
+ jiraGitTotal.addAndGet(r.getJiraBranchesGit().size());
+ }
+ sink.tableCell_();
+
+ // dependabot branches
+ sink.tableCell();
+ if (r.getDependabotBranchesGit().isEmpty()) {
+ try {
+ if (hasDependabotYml(r.getRepositoryName())) {
+ sink.text("-");
+ }
+ } catch (IOException e) {
+ sink.text("_");
}
+ } else {
+ SinkEventAttributes jenkinsLinkAttributes = new SinkEventAttributeSet();
+ jenkinsLinkAttributes.addAttribute(
+ SinkEventAttributes.TITLE,
+ r.getDependabotBranchesJenkins().stream().collect(Collectors.joining("\n")));
+
+ SinkEventAttributes gitLinkAttributes = new SinkEventAttributeSet();
+ r.getDependabotBranchesGit().stream()
+ .filter(n -> !r.getDependabotBranchesJenkins().contains(n))
+ .reduce((n1, n2) -> n1 + "\n" + n2)
+ .ifPresent(t -> gitLinkAttributes.addAttribute(
+ SinkEventAttributes.TITLE, "-- non-Jenkins branches --\n" + t));
+
+ sink.bold();
+ sink.link(r.getBuildUrl(), jenkinsLinkAttributes);
+ sink.rawText(
+ String.valueOf(r.getDependabotBranchesJenkins().size()));
+ sink.link_();
+ sink.text(" / ");
+ sink.link(getGitboxHeadsUrl(r.getRepositoryName()), gitLinkAttributes);
+ sink.rawText(String.valueOf(r.getDependabotBranchesGit().size()));
+ sink.link_();
+
+ dependabotJenkinsTotal.addAndGet(
+ r.getDependabotBranchesJenkins().size());
+ dependabotGitTotal.addAndGet(
+ r.getDependabotBranchesGit().size());
}
- catch ( IOException e )
- {
- sink.text( "_" );
+ sink.tableCell_();
+
+ // rest
+ sink.tableCell();
+ if (r.getRestGit().isEmpty()) {
+ sink.text("-");
+ } else {
+ SinkEventAttributes restLinkAttributes = new SinkEventAttributeSet();
+ restLinkAttributes.addAttribute(
+ SinkEventAttributes.TITLE,
+ r.getRestJenkins().stream().collect(Collectors.joining("\n")));
+
+ SinkEventAttributes gitLinkAttributes = new SinkEventAttributeSet();
+ r.getRestGit().stream()
+ .filter(n -> !r.getRestJenkins().contains(n))
+ .reduce((n1, n2) -> n1 + "\n" + n2)
+ .ifPresent(t -> gitLinkAttributes.addAttribute(
+ SinkEventAttributes.TITLE, "-- non-Jenkins branches --\n" + t));
+
+ sink.bold();
+ sink.link(r.getBuildUrl(), restLinkAttributes);
+ sink.rawText(String.valueOf(r.getRestJenkins().size()));
+ sink.link_();
+ sink.text(" / ");
+ sink.link(getGitboxHeadsUrl(r.getRepositoryName()), gitLinkAttributes);
+ sink.rawText(String.valueOf(r.getRestGit().size()));
+ sink.link_();
+
+ restJenkinsTotal.addAndGet(r.getRestJenkins().size());
+ restGitTotal.addAndGet(r.getRestGit().size());
}
- }
- else
- {
- SinkEventAttributes jenkinsLinkAttributes = new SinkEventAttributeSet();
- jenkinsLinkAttributes.addAttribute( SinkEventAttributes.TITLE,
- r.getDependabotBranchesJenkins().stream().collect( Collectors.joining( "\n" ) ) );
+ sink.tableCell_();
- SinkEventAttributes gitLinkAttributes = new SinkEventAttributeSet();
- r.getDependabotBranchesGit().stream()
- .filter( n -> !r.getDependabotBranchesJenkins().contains( n ) )
- .reduce( ( n1, n2 ) -> n1 + "\n" + n2 )
- .ifPresent( t -> gitLinkAttributes.addAttribute( SinkEventAttributes.TITLE,
- "-- non-Jenkins branches --\n" + t ) );
-
- sink.bold();
- sink.link( r.getBuildUrl(), jenkinsLinkAttributes );
- sink.rawText( String.valueOf( r.getDependabotBranchesJenkins().size() ) );
- sink.link_();
- sink.text( " / " );
- sink.link( getGitboxHeadsUrl( r.getRepositoryName() ), gitLinkAttributes );
- sink.rawText( String.valueOf( r.getDependabotBranchesGit().size() ) );
- sink.link_();
-
- dependabotJenkinsTotal.addAndGet( r.getDependabotBranchesJenkins().size() );
- dependabotGitTotal.addAndGet( r.getDependabotBranchesGit().size() );
- }
- sink.tableCell_();
+ // total
+ sink.tableCell();
+ sink.text(r.getTotalJenkins() + " / " + r.getTotalGit());
+ sink.tableCell_();
- // rest
- sink.tableCell();
- if ( r.getRestGit().isEmpty() )
- {
- sink.text( "-" );
- }
- else
- {
- SinkEventAttributes restLinkAttributes = new SinkEventAttributeSet();
- restLinkAttributes.addAttribute( SinkEventAttributes.TITLE,
- r.getRestJenkins().stream().collect( Collectors.joining( "\n" ) ) );
+ sink.tableRow_();
+ });
- SinkEventAttributes gitLinkAttributes = new SinkEventAttributeSet();
- r.getRestGit().stream()
- .filter( n -> !r.getRestJenkins().contains( n ) )
- .reduce( ( n1, n2 ) -> n1 + "\n" + n2 )
- .ifPresent( t -> gitLinkAttributes.addAttribute( SinkEventAttributes.TITLE,
- "-- non-Jenkins branches --\n" + t ) );
-
- sink.bold();
- sink.link( r.getBuildUrl(), restLinkAttributes );
- sink.rawText( String.valueOf( r.getRestJenkins().size() ) );
- sink.link_();
- sink.text( " / " );
- sink.link( getGitboxHeadsUrl( r.getRepositoryName() ), gitLinkAttributes );
- sink.rawText( String.valueOf( r.getRestGit().size() ) );
- sink.link_();
-
- restJenkinsTotal.addAndGet( r.getRestJenkins().size() );
- restGitTotal.addAndGet( r.getRestGit().size() );
- }
- sink.tableCell_();
-
- // total
- sink.tableCell();
- sink.text( r.getTotalJenkins() + " / " + r.getTotalGit() );
- sink.tableCell_();
-
- sink.tableRow_();
- } );
-
sink.tableRow();
sink.tableHeaderCell();
sink.tableHeaderCell_();
@@ -528,28 +489,30 @@
sink.tableHeaderCell_();
// branches:
sink.tableCell();
- sink.text( "Total" );
+ sink.text("Total");
sink.tableCell_();
sink.tableHeaderCell();
- sink.text( masterJenkinsTotal.get() + " / " + masterGitTotal.get() );
+ sink.text(masterJenkinsTotal.get() + " / " + masterGitTotal.get());
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.text( jiraJenkinsTotal.get() + " / " + jiraGitTotal.get() );
+ sink.text(jiraJenkinsTotal.get() + " / " + jiraGitTotal.get());
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.text( dependabotJenkinsTotal.get() + " / " + dependabotGitTotal.get() );
+ sink.text(dependabotJenkinsTotal.get() + " / " + dependabotGitTotal.get());
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.text( restJenkinsTotal.get() + " / " + restGitTotal.get() );
+ sink.text(restJenkinsTotal.get() + " / " + restGitTotal.get());
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.text(
- ( masterJenkinsTotal.get() + jiraJenkinsTotal.get() + dependabotJenkinsTotal.get() + restJenkinsTotal.get() )
- + " / "
- + ( masterGitTotal.get() + jiraGitTotal.get() + dependabotGitTotal.get() + restGitTotal.get() ) );
+ sink.text((masterJenkinsTotal.get()
+ + jiraJenkinsTotal.get()
+ + dependabotJenkinsTotal.get()
+ + restJenkinsTotal.get())
+ + " / "
+ + (masterGitTotal.get() + jiraGitTotal.get() + dependabotGitTotal.get() + restGitTotal.get()));
sink.tableHeaderCell_();
sink.tableRow_();
-
+
sink.table_();
sink.body_();
}
@@ -561,24 +524,22 @@
* @return the list of repository names (without ".git")
* @throws java.io.IOException problem with reading repository index
*/
- protected Collection<String> repositoryNames()
- throws IOException
- {
- List<String> names = new ArrayList<>( 100 );
- Document doc = JsoupRetry.get( GITBOX_URL );
+ protected Collection<String> repositoryNames() throws IOException {
+ List<String> names = new ArrayList<>(100);
+ Document doc = JsoupRetry.get(GITBOX_URL);
// find Apache Maven table
- Element apacheMavenTable = doc.getElementById( "maven" );
+ Element apacheMavenTable = doc.getElementById("maven");
- Elements gitRepo = apacheMavenTable.select( "tbody tr" ).not( "tr.disabled" ).select( "td:first-child a" );
+ Elements gitRepo =
+ apacheMavenTable.select("tbody tr").not("tr.disabled").select("td:first-child a");
- for ( Element element : gitRepo )
- {
- names.add( element.text().split( "\\.git" )[0] );
+ for (Element element : gitRepo) {
+ names.add(element.text().split("\\.git")[0]);
}
return names;
}
-
+
/**
* <p>hasDependabotYml.</p>
*
@@ -586,13 +547,11 @@
* @return a boolean
* @throws java.io.IOException if any.
*/
- protected static boolean hasDependabotYml( String repositoryName )
- throws IOException
- {
- URL url = new URL( GITHUB_URL + repositoryName + "/blob/master/" + DEPENDABOT_CONFIG );
+ protected static boolean hasDependabotYml(String repositoryName) throws IOException {
+ URL url = new URL(GITHUB_URL + repositoryName + "/blob/master/" + DEPENDABOT_CONFIG);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
- con.setRequestMethod( "HEAD" );
+ con.setRequestMethod("HEAD");
return con.getResponseCode() == HttpURLConnection.HTTP_OK;
}
diff --git a/src/main/java/org/apache/maven/dist/tools/branches/Result.java b/src/main/java/org/apache/maven/dist/tools/branches/Result.java
index c6e44c4..35c62fa 100644
--- a/src/main/java/org/apache/maven/dist/tools/branches/Result.java
+++ b/src/main/java/org/apache/maven/dist/tools/branches/Result.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.branches;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.branches;
import java.util.Collection;
@@ -26,32 +25,30 @@
*
* @author Robert Scholte
*/
-public class Result
-{
+public class Result {
private final String repositoryName;
private final String buildUrl;
-
+
private int masterBranchesGit;
private int masterBranchesJenkins;
-
+
private Collection<String> jiraBranchesGit;
private Collection<String> jiraBranchesJenkins;
-
+
private Collection<String> dependabotBranchesGit;
private Collection<String> dependabotBranchesJenkins;
-
+
private Collection<String> restGit;
private Collection<String> restJenkins;
-
+
/**
* <p>Constructor for Result.</p>
*
* @param repositoryName a {@link java.lang.String} object
* @param buildUrl a {@link java.lang.String} object
*/
- public Result( String repositoryName, String buildUrl )
- {
+ public Result(String repositoryName, String buildUrl) {
this.repositoryName = repositoryName;
this.buildUrl = buildUrl;
}
@@ -61,8 +58,7 @@
*
* @return a int
*/
- public int getMasterBranchesGit()
- {
+ public int getMasterBranchesGit() {
return masterBranchesGit;
}
@@ -71,8 +67,7 @@
*
* @param masterBranches a int
*/
- public void setMasterBranchesGit( int masterBranches )
- {
+ public void setMasterBranchesGit(int masterBranches) {
this.masterBranchesGit = masterBranches;
}
@@ -81,18 +76,16 @@
*
* @return a int
*/
- public int getMasterBranchesJenkins()
- {
+ public int getMasterBranchesJenkins() {
return masterBranchesJenkins;
}
-
+
/**
* <p>Setter for the field <code>masterBranchesJenkins</code>.</p>
*
* @param masterBranchesJenkins a int
*/
- public void setMasterBranchesJenkins( int masterBranchesJenkins )
- {
+ public void setMasterBranchesJenkins(int masterBranchesJenkins) {
this.masterBranchesJenkins = masterBranchesJenkins;
}
@@ -101,8 +94,7 @@
*
* @return a {@link java.util.Collection} object
*/
- public Collection<String> getJiraBranchesGit()
- {
+ public Collection<String> getJiraBranchesGit() {
return jiraBranchesGit;
}
@@ -111,8 +103,7 @@
*
* @param jiraBranches a {@link java.util.Collection} object
*/
- public void setJiraBranchesGit( Collection<String> jiraBranches )
- {
+ public void setJiraBranchesGit(Collection<String> jiraBranches) {
this.jiraBranchesGit = jiraBranches;
}
@@ -121,28 +112,25 @@
*
* @return a {@link java.util.Collection} object
*/
- public Collection<String> getJiraBranchesJenkins()
- {
+ public Collection<String> getJiraBranchesJenkins() {
return jiraBranchesJenkins;
}
-
+
/**
* <p>Setter for the field <code>jiraBranchesJenkins</code>.</p>
*
* @param jiraBranchesJenkins a {@link java.util.Collection} object
*/
- public void setJiraBranchesJenkins( Collection<String> jiraBranchesJenkins )
- {
+ public void setJiraBranchesJenkins(Collection<String> jiraBranchesJenkins) {
this.jiraBranchesJenkins = jiraBranchesJenkins;
}
-
+
/**
* <p>Getter for the field <code>dependabotBranchesGit</code>.</p>
*
* @return a {@link java.util.Collection} object
*/
- public Collection<String> getDependabotBranchesGit()
- {
+ public Collection<String> getDependabotBranchesGit() {
return dependabotBranchesGit;
}
@@ -151,28 +139,25 @@
*
* @param dependabotBranches a {@link java.util.Collection} object
*/
- public void setDependabotBranchesGit( Collection<String> dependabotBranches )
- {
+ public void setDependabotBranchesGit(Collection<String> dependabotBranches) {
this.dependabotBranchesGit = dependabotBranches;
}
-
+
/**
* <p>Getter for the field <code>dependabotBranchesJenkins</code>.</p>
*
* @return a {@link java.util.Collection} object
*/
- public Collection<String> getDependabotBranchesJenkins()
- {
+ public Collection<String> getDependabotBranchesJenkins() {
return dependabotBranchesJenkins;
}
-
+
/**
* <p>Setter for the field <code>dependabotBranchesJenkins</code>.</p>
*
* @param dependabotBranchesJenkins a {@link java.util.Collection} object
*/
- public void setDependabotBranchesJenkins( Collection<String> dependabotBranchesJenkins )
- {
+ public void setDependabotBranchesJenkins(Collection<String> dependabotBranchesJenkins) {
this.dependabotBranchesJenkins = dependabotBranchesJenkins;
}
@@ -181,8 +166,7 @@
*
* @return a {@link java.util.Collection} object
*/
- public Collection<String> getRestGit()
- {
+ public Collection<String> getRestGit() {
return restGit;
}
@@ -191,28 +175,25 @@
*
* @param rest a {@link java.util.Collection} object
*/
- public void setRestGit( Collection<String> rest )
- {
+ public void setRestGit(Collection<String> rest) {
this.restGit = rest;
}
-
+
/**
* <p>Getter for the field <code>restJenkins</code>.</p>
*
* @return a {@link java.util.Collection} object
*/
- public Collection<String> getRestJenkins()
- {
+ public Collection<String> getRestJenkins() {
return restJenkins;
}
-
+
/**
* <p>Setter for the field <code>restJenkins</code>.</p>
*
* @param restJenkins a {@link java.util.Collection} object
*/
- public void setRestJenkins( Collection<String> restJenkins )
- {
+ public void setRestJenkins(Collection<String> restJenkins) {
this.restJenkins = restJenkins;
}
@@ -221,8 +202,7 @@
*
* @return a {@link java.lang.String} object
*/
- public String getRepositoryName()
- {
+ public String getRepositoryName() {
return repositoryName;
}
@@ -231,30 +211,28 @@
*
* @return a {@link java.lang.String} object
*/
- public String getBuildUrl()
- {
+ public String getBuildUrl() {
return buildUrl;
}
-
+
/**
* <p>getTotalGit.</p>
*
* @return a int
*/
- public final int getTotalGit()
- {
+ public final int getTotalGit() {
return masterBranchesGit + jiraBranchesGit.size() + dependabotBranchesGit.size() + restGit.size();
}
-
+
/**
* <p>getTotalJenkins.</p>
*
* @return a int
*/
- public final int getTotalJenkins()
- {
- return masterBranchesJenkins + jiraBranchesJenkins.size() + dependabotBranchesJenkins.size()
- + restJenkins.size();
+ public final int getTotalJenkins() {
+ return masterBranchesJenkins
+ + jiraBranchesJenkins.size()
+ + dependabotBranchesJenkins.size()
+ + restJenkins.size();
}
-
}
diff --git a/src/main/java/org/apache/maven/dist/tools/index/DistCheckIndexPageReport.java b/src/main/java/org/apache/maven/dist/tools/index/DistCheckIndexPageReport.java
index 464bac6..f4b1cf0 100644
--- a/src/main/java/org/apache/maven/dist/tools/index/DistCheckIndexPageReport.java
+++ b/src/main/java/org/apache/maven/dist/tools/index/DistCheckIndexPageReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.index;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.index;
import java.io.IOException;
import java.time.LocalDate;
@@ -48,10 +47,8 @@
*
* @author skygo
*/
-@Mojo( name = "check-index-page", requiresProject = false )
-public class DistCheckIndexPageReport
- extends AbstractDistCheckReport
-{
+@Mojo(name = "check-index-page", requiresProject = false)
+public class DistCheckIndexPageReport extends AbstractDistCheckReport {
/** Constant <code>FAILURES_FILENAME="check-index-page.log"</code> */
public static final String FAILURES_FILENAME = "check-index-page.log";
@@ -59,29 +56,26 @@
public static final String POMS_INDEX_URL = "https://maven.apache.org/pom/";
private static final IndexPage[] INDEX_PAGES = new IndexPage[] {
- new IndexPage( "https://maven.apache.org/plugins/", "Plugins", 3, true ),
- new IndexPage( "https://maven.apache.org/shared/", "Shared", 2, true ),
- new IndexPage( "https://maven.apache.org/skins/", "Skins", 2, false ),
- new IndexPage( POMS_INDEX_URL, "Poms", 2, true ) };
+ new IndexPage("https://maven.apache.org/plugins/", "Plugins", 3, true),
+ new IndexPage("https://maven.apache.org/shared/", "Shared", 2, true),
+ new IndexPage("https://maven.apache.org/skins/", "Skins", 2, false),
+ new IndexPage(POMS_INDEX_URL, "Poms", 2, true)
+ };
private static final Map<String, IndexPage> INDEX_PAGES_REF;
- static
- {
+ static {
Map<String, IndexPage> aMap = new HashMap<>();
- for ( IndexPage ip : INDEX_PAGES )
- {
- aMap.put( ip.url, ip );
+ for (IndexPage ip : INDEX_PAGES) {
+ aMap.put(ip.url, ip);
}
- INDEX_PAGES_REF = Collections.unmodifiableMap( aMap );
+ INDEX_PAGES_REF = Collections.unmodifiableMap(aMap);
}
/**
* Dist Check Index Page Report.
*/
- public DistCheckIndexPageReport()
- {
- }
+ public DistCheckIndexPageReport() {}
/**
* Ignore dist failure for <code>artifactId</code> or <code>artifactId:version</code>
@@ -91,276 +85,231 @@
/** {@inheritDoc} */
@Override
- protected String getFailuresFilename()
- {
+ protected String getFailuresFilename() {
return FAILURES_FILENAME;
}
/** {@inheritDoc} */
@Override
- public String getName( Locale locale )
- {
+ public String getName(Locale locale) {
return "Dist Tool> Check Index Pages";
}
/** {@inheritDoc} */
@Override
- public String getDescription( Locale locale )
- {
+ public String getDescription(Locale locale) {
return "Verification of index pages";
}
/** {@inheritDoc} */
@Override
- protected boolean isIndexPageCheck()
- {
+ protected boolean isIndexPageCheck() {
return true;
}
-
- private static class CheckIndexPageResult
- extends AbstractCheckResult
- {
+ private static class CheckIndexPageResult extends AbstractCheckResult {
private String indexVersion;
private String indexDate;
-
- private CheckIndexPageResult( ConfigurationLineInfo r, String version )
- {
- super( r, version );
+
+ private CheckIndexPageResult(ConfigurationLineInfo r, String version) {
+ super(r, version);
}
- private void setIndexVersion( String ownText )
- {
+ private void setIndexVersion(String ownText) {
this.indexVersion = ownText;
}
- private void setIndexDate( String ownText )
- {
+ private void setIndexDate(String ownText) {
this.indexDate = ownText;
}
}
+
private final Map<String, List<CheckIndexPageResult>> results = new HashMap<>();
-
- private void reportLine( Sink sink, CheckIndexPageResult cipr , boolean displayDate )
- {
+ private void reportLine(Sink sink, CheckIndexPageResult cipr, boolean displayDate) {
ConfigurationLineInfo cli = cipr.getConfigurationLine();
sink.tableRow();
sink.tableCell();
- sink.anchor( cli.getArtifactId() );
- sink.rawText( cli.getArtifactId() );
+ sink.anchor(cli.getArtifactId());
+ sink.rawText(cli.getArtifactId());
sink.anchor_();
sink.tableCell_();
// maven-metadata.xml column
sink.tableCell();
- sink.link( cli.getMetadataFileURL( repoBaseUrl ) );
- sink.rawText( "maven-metadata.xml" );
+ sink.link(cli.getMetadataFileURL(repoBaseUrl));
+ sink.rawText("maven-metadata.xml");
sink.link_();
- sink.rawText( ": " + cli.getReleaseDateFromMetadata() + " - " + cipr.indexVersion );
+ sink.rawText(": " + cli.getReleaseDateFromMetadata() + " - " + cipr.indexVersion);
sink.tableCell_();
// index page column
sink.tableCell();
- if ( displayDate )
- {
- sink.rawText( cipr.indexDate );
- if ( ( cipr.indexDate != null ) && isDateSimilar( cli.getReleaseDateFromMetadata(), cipr.indexDate ) )
- {
- iconSuccess( sink );
+ if (displayDate) {
+ sink.rawText(cipr.indexDate);
+ if ((cipr.indexDate != null) && isDateSimilar(cli.getReleaseDateFromMetadata(), cipr.indexDate)) {
+ iconSuccess(sink);
+ } else {
+ iconWarning(sink);
}
- else
- {
- iconWarning( sink );
- }
- sink.rawText( " - " );
+ sink.rawText(" - ");
}
- sink.rawText( cipr.indexVersion );
- if ( cipr.getVersion().equals( cipr.indexVersion ) )
- {
- iconSuccess( sink );
- }
- else
- {
- iconError( sink );
+ sink.rawText(cipr.indexVersion);
+ if (cipr.getVersion().equals(cipr.indexVersion)) {
+ iconSuccess(sink);
+ } else {
+ iconError(sink);
- addErrorLine( cli, null, null,
- cli.getArtifactId() + ": found " + cipr.indexVersion + " instead of " + cipr.getVersion()
- + " in " + cli.getIndexPageUrl() );
+ addErrorLine(
+ cli,
+ null,
+ null,
+ cli.getArtifactId() + ": found " + cipr.indexVersion + " instead of " + cipr.getVersion() + " in "
+ + cli.getIndexPageUrl());
}
sink.tableCell_();
-
+
sink.tableRow_();
}
- private boolean isDateSimilar( String metadataDate, String indexDate )
- {
- try
- {
- LocalDate d1 = LocalDate.parse( metadataDate );
- LocalDate d2 = LocalDate.parse( indexDate );
+ private boolean isDateSimilar(String metadataDate, String indexDate) {
+ try {
+ LocalDate d1 = LocalDate.parse(metadataDate);
+ LocalDate d2 = LocalDate.parse(indexDate);
- long daysDifference = Period.between( d1, d2 ).getDays();
- return Math.abs( daysDifference ) < 7; // ok for 7 days difference
- }
- catch ( DateTimeParseException pe )
- {
- getLog().warn(
- "Unable to parse dates for fields from metadata:\"" + metadataDate
- + "\" and index:\"" + indexDate + "\"" );
+ long daysDifference = Period.between(d1, d2).getDays();
+ return Math.abs(daysDifference) < 7; // ok for 7 days difference
+ } catch (DateTimeParseException pe) {
+ getLog().warn("Unable to parse dates for fields from metadata:\"" + metadataDate + "\" and index:\""
+ + indexDate + "\"");
return false;
}
}
/** {@inheritDoc} */
@Override
- protected void executeReport( Locale locale )
- throws MavenReportException
- {
- if ( !outputDirectory.exists() )
- {
+ protected void executeReport(Locale locale) throws MavenReportException {
+ if (!outputDirectory.exists()) {
outputDirectory.mkdirs();
}
- try
- {
+ try {
this.execute();
- }
- catch ( MojoExecutionException ex )
- {
- throw new MavenReportException( ex.getMessage(), ex );
+ } catch (MojoExecutionException ex) {
+ throw new MavenReportException(ex.getMessage(), ex);
}
Sink sink = getSink();
sink.head();
sink.title();
- sink.text( "Check index pages" );
+ sink.text("Check index pages");
sink.title_();
sink.head_();
sink.body();
sink.section1();
sink.paragraph();
- sink.rawText( "Check that index pages have been updated with latest release info available in central"
- + " repository <code>maven-metadata.xml</code>." );
+ sink.rawText("Check that index pages have been updated with latest release info available in central"
+ + " repository <code>maven-metadata.xml</code>.");
sink.paragraph_();
sink.section1_();
- for ( Map.Entry<String, List<CheckIndexPageResult>> result: results.entrySet() )
- {
+ for (Map.Entry<String, List<CheckIndexPageResult>> result : results.entrySet()) {
String indexPageId = result.getKey();
- IndexPage indexPage = INDEX_PAGES_REF.get( indexPageId );
+ IndexPage indexPage = INDEX_PAGES_REF.get(indexPageId);
List<CheckIndexPageResult> indexPageResults = result.getValue();
- sink.anchor( indexPageResults.get( 0 ).getConfigurationLine().getDirectory() );
+ sink.anchor(indexPageResults.get(0).getConfigurationLine().getDirectory());
sink.anchor_();
sink.sectionTitle2();
- sink.text( indexPage.name + " index page: " );
- sink.link( indexPage.url );
- sink.text( indexPage.url );
+ sink.text(indexPage.name + " index page: ");
+ sink.link(indexPage.url);
+ sink.text(indexPage.url);
sink.link_();
sink.sectionTitle2_();
sink.table();
sink.tableRow();
sink.tableHeaderCell();
- sink.rawText( "Component (" + indexPageResults.size() + ")" );
+ sink.rawText("Component (" + indexPageResults.size() + ")");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.rawText( "maven-metadata.xml " );
- if ( indexPage.containsDate )
- {
- sink.rawText( "lastUpdated - " );
+ sink.rawText("maven-metadata.xml ");
+ if (indexPage.containsDate) {
+ sink.rawText("lastUpdated - ");
}
- sink.rawText( "latest" );
+ sink.rawText("latest");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.link( indexPage.url );
- sink.rawText( "index page" );
+ sink.link(indexPage.url);
+ sink.rawText("index page");
sink.link_();
sink.tableHeaderCell_();
sink.tableRow_();
- for ( CheckIndexPageResult csr : indexPageResults )
- {
- reportLine( sink, csr, indexPage.containsDate );
+ for (CheckIndexPageResult csr : indexPageResults) {
+ reportLine(sink, csr, indexPage.containsDate);
}
sink.table_();
}
-
+
sink.body_();
sink.flush();
sink.close();
}
- private void updateIndexPageInfo( ConfigurationLineInfo cli, CheckIndexPageResult r, IndexPage indexPage )
- throws IOException
- {
+ private void updateIndexPageInfo(ConfigurationLineInfo cli, CheckIndexPageResult r, IndexPage indexPage)
+ throws IOException {
Document doc = indexPage.document;
- if ( doc == null )
- {
+ if (doc == null) {
// document not yet downloaded: download and cache
- doc = JsoupRetry.get( indexPage.url );
+ doc = JsoupRetry.get(indexPage.url);
indexPage.document = doc;
}
// Maven parent POM is now a special case in https://maven.apache.org/pom/
- boolean isMavenParentPoms = ( "maven-parent".equals( cli.getArtifactId() ) );
+ boolean isMavenParentPoms = ("maven-parent".equals(cli.getArtifactId()));
- Elements a = isMavenParentPoms ? doc.select( "tr > th > b" )
- : doc.select( "tr > td > a[href]:not(.externalLink)" );
+ Elements a = isMavenParentPoms ? doc.select("tr > th > b") : doc.select("tr > td > a[href]:not(.externalLink)");
- String path = paths.get( cli.getArtifactId() );
- if ( isMavenParentPoms )
- {
+ String path = paths.get(cli.getArtifactId());
+ if (isMavenParentPoms) {
path = "Maven Parent POMs"; // looking for this <th><b> content
- }
- else if ( path == null )
- {
+ } else if (path == null) {
path = '/' + cli.getArtifactId() + '/';
}
- for ( Element e : a )
- {
- String href = isMavenParentPoms ? e.text() : e.attr( "href" );
+ for (Element e : a) {
+ String href = isMavenParentPoms ? e.text() : e.attr("href");
- if ( href.contains( path ) )
- {
+ if (href.contains(path)) {
Element row = e.parent().parent();
- r.setIndexVersion( row.child( indexPage.versionColumn - 1 ).ownText() );
- if ( indexPage.containsDate )
- {
- r.setIndexDate( row.child( indexPage.versionColumn ).ownText() );
+ r.setIndexVersion(row.child(indexPage.versionColumn - 1).ownText());
+ if (indexPage.containsDate) {
+ r.setIndexDate(row.child(indexPage.versionColumn).ownText());
}
break;
- }
+ }
}
}
/** {@inheritDoc} */
@Override
- protected void checkArtifact( ConfigurationLineInfo configLine, String version )
- throws MojoExecutionException
- {
- try
- {
- CheckIndexPageResult result = new CheckIndexPageResult( configLine, version );
+ protected void checkArtifact(ConfigurationLineInfo configLine, String version) throws MojoExecutionException {
+ try {
+ CheckIndexPageResult result = new CheckIndexPageResult(configLine, version);
- if ( configLine.getIndexPageUrl() != null )
- {
- if ( results.get( configLine.getIndexPageUrl() ) == null )
- {
- results.put( configLine.getIndexPageUrl(), new LinkedList<CheckIndexPageResult>() );
- }
- results.get( configLine.getIndexPageUrl() ).add( result );
- updateIndexPageInfo( configLine, result, INDEX_PAGES_REF.get( configLine.getIndexPageUrl() ) );
+ if (configLine.getIndexPageUrl() != null) {
+ if (results.get(configLine.getIndexPageUrl()) == null) {
+ results.put(configLine.getIndexPageUrl(), new LinkedList<CheckIndexPageResult>());
+ }
+ results.get(configLine.getIndexPageUrl()).add(result);
+ updateIndexPageInfo(configLine, result, INDEX_PAGES_REF.get(configLine.getIndexPageUrl()));
}
- }
- catch ( IOException ex )
- {
- throw new MojoExecutionException( ex.getMessage(), ex );
+ } catch (IOException ex) {
+ throw new MojoExecutionException(ex.getMessage(), ex);
}
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/index/IndexPage.java b/src/main/java/org/apache/maven/dist/tools/index/IndexPage.java
index 224d7ce..fbd2bad 100644
--- a/src/main/java/org/apache/maven/dist/tools/index/IndexPage.java
+++ b/src/main/java/org/apache/maven/dist/tools/index/IndexPage.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.index;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,22 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.index;
import org.jsoup.nodes.Document;
-class IndexPage
-{
+class IndexPage {
final String url;
final String name;
final int versionColumn;
final boolean containsDate;
Document document;
-
- IndexPage( String url, String name, int versionColumn, boolean containsDate )
- {
+
+ IndexPage(String url, String name, int versionColumn, boolean containsDate) {
this.url = url;
this.name = name;
this.versionColumn = versionColumn;
this.containsDate = containsDate;
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/apache/maven/dist/tools/masterjobs/ListMasterJobsReport.java b/src/main/java/org/apache/maven/dist/tools/masterjobs/ListMasterJobsReport.java
index 4434d24..ae04330 100644
--- a/src/main/java/org/apache/maven/dist/tools/masterjobs/ListMasterJobsReport.java
+++ b/src/main/java/org/apache/maven/dist/tools/masterjobs/ListMasterJobsReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.masterjobs;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.masterjobs;
import java.io.IOException;
import java.time.ZonedDateTime;
@@ -46,214 +45,177 @@
*
* @author Robert Scholte
*/
-@Mojo( name = "list-master-jobs", requiresProject = false )
-public class ListMasterJobsReport extends AbstractMavenReport
-{
+@Mojo(name = "list-master-jobs", requiresProject = false)
+public class ListMasterJobsReport extends AbstractMavenReport {
private String gitboxUrl = "https://gitbox.apache.org/repos/asf";
private String mavenboxJobsBaseUrl = "https://ci-maven.apache.org/job/Maven/job/maven-box/";
- private Collection<String> excluded = Arrays.asList( "maven-integration-testing", // runs with Maven core job
- "maven-jenkins-env",
- "maven-jenkins-lib",
- "maven-sources",
- "maven-studies",
- "maven-mvnd",
- "maven-metric-extension",
- "maven-gh-actions-shared" );
+ private Collection<String> excluded = Arrays.asList(
+ "maven-integration-testing", // runs with Maven core job
+ "maven-jenkins-env",
+ "maven-jenkins-lib",
+ "maven-sources",
+ "maven-studies",
+ "maven-mvnd",
+ "maven-metric-extension",
+ "maven-gh-actions-shared");
/**
* <p>Constructor for DistCheckSiteReport.</p>
*/
- public ListMasterJobsReport()
- {
- }
+ public ListMasterJobsReport() {}
/** {@inheritDoc} */
@Override
- public String getOutputName()
- {
+ public String getOutputName() {
return "dist-tool-master-jobs";
}
/** {@inheritDoc} */
@Override
- public String getName( Locale locale )
- {
+ public String getName(Locale locale) {
return "Dist Tool> List Master Jobs";
}
/** {@inheritDoc} */
@Override
- public String getDescription( Locale locale )
- {
+ public String getDescription(Locale locale) {
return "Shows the status of Jenkins job for the master branch of every Git repository on one page";
}
/** {@inheritDoc} */
@Override
- protected void executeReport( Locale locale )
- throws MavenReportException
- {
+ protected void executeReport(Locale locale) throws MavenReportException {
Collection<String> repositoryNames;
- try
- {
+ try {
repositoryNames = repositoryNames();
- }
- catch ( IOException e )
- {
- throw new MavenReportException( "Failed to extract repositorynames from Gitbox", e );
+ } catch (IOException e) {
+ throw new MavenReportException("Failed to extract repositorynames from Gitbox", e);
}
- List<Result> repoStatus = new ArrayList<>( repositoryNames.size() );
+ List<Result> repoStatus = new ArrayList<>(repositoryNames.size());
- Collection<String> included = repositoryNames.stream()
- .filter( s -> !excluded.contains( s ) )
- .collect( Collectors.toList() );
+ Collection<String> included =
+ repositoryNames.stream().filter(s -> !excluded.contains(s)).collect(Collectors.toList());
- for ( String repository : included )
- {
+ for (String repository : included) {
final String repositoryJobUrl = mavenboxJobsBaseUrl + "job/" + repository;
- try
- {
- Document doc = JsoupRetry.get( repositoryJobUrl );
+ try {
+ Document doc = JsoupRetry.get(repositoryJobUrl);
- Result result = new Result( repository, repositoryJobUrl );
+ Result result = new Result(repository, repositoryJobUrl);
- Element masterRow = doc.getElementById( "job_master" );
- if ( masterRow == null )
- {
- getLog().warn( mavenboxJobsBaseUrl + repository + " is missing id job_master" );
+ Element masterRow = doc.getElementById("job_master");
+ if (masterRow == null) {
+ getLog().warn(mavenboxJobsBaseUrl + repository + " is missing id job_master");
continue;
+ } else if (masterRow.hasClass("job-status-red") || masterRow.hasClass("job-status-red-anime")) {
+ result.setStatus("FAILURE");
+ } else if (masterRow.hasClass("job-status-yellow") || masterRow.hasClass("job-status-yellow-anime")) {
+ result.setStatus("UNSTABLE");
+ } else if (masterRow.hasClass("job-status-blue") || masterRow.hasClass("job-status-blue-anime")) {
+ result.setStatus("SUCCESS");
+ } else {
+ result.setStatus("UNKNOWN");
}
- else if ( masterRow.hasClass( "job-status-red" ) || masterRow.hasClass( "job-status-red-anime" ) )
- {
- result.setStatus( "FAILURE" );
- }
- else if ( masterRow.hasClass( "job-status-yellow" ) || masterRow.hasClass( "job-status-yellow-anime" ) )
- {
- result.setStatus( "UNSTABLE" );
- }
- else if ( masterRow.hasClass( "job-status-blue" ) || masterRow.hasClass( "job-status-blue-anime" ) )
- {
- result.setStatus( "SUCCESS" );
- }
- else
- {
- result.setStatus( "UNKNOWN" );
- }
- result.setIcon( masterRow.select( "span.build-status-icon__wrapper" ).first().outerHtml() );
+ result.setIcon(masterRow
+ .select("span.build-status-icon__wrapper")
+ .first()
+ .outerHtml());
- result.setLastBuild( getLastBuild( masterRow.child( 3 ).attr( "data" ),
- masterRow.child( 4 ).attr( "data" ) ) );
+ result.setLastBuild(getLastBuild(
+ masterRow.child(3).attr("data"), masterRow.child(4).attr("data")));
- repoStatus.add( result );
- }
- catch ( IOException e )
- {
- getLog().warn( "Failed to read status for " + repository + " Jenkins job " + repositoryJobUrl );
+ repoStatus.add(result);
+ } catch (IOException e) {
+ getLog().warn("Failed to read status for " + repository + " Jenkins job " + repositoryJobUrl);
}
}
- generateReport( repoStatus );
+ generateReport(repoStatus);
}
-
- private void generateReport( List<Result> repoStatus )
- {
+
+ private void generateReport(List<Result> repoStatus) {
Sink sink = getSink();
sink.head();
sink.title();
- sink.text( "List Master Jobs" );
+ sink.text("List Master Jobs");
sink.title_();
sink.head_();
sink.body();
- sink.text( "Jenkins jobs for master branch sorted by status of last build:" );
+ sink.text("Jenkins jobs for master branch sorted by status of last build:");
sink.list();
- Map<String, List<Result>> groupedResults = repoStatus.stream()
- .collect( Collectors.groupingBy( Result::getStatus ) );
+ Map<String, List<Result>> groupedResults =
+ repoStatus.stream().collect(Collectors.groupingBy(Result::getStatus));
- groupedResults.entrySet()
- .stream()
- .sorted( Map.Entry.comparingByKey( resultComparator() ) )
- .forEach( e ->
- {
- sink.listItem();
- int size = e.getValue().size();
- sink.text( size + " job" + ( size > 1 ? "s" : "" ) + " with status " + e.getKey() + ":" );
- sink.list();
- e.getValue().forEach( r ->
- {
+ groupedResults.entrySet().stream()
+ .sorted(Map.Entry.comparingByKey(resultComparator()))
+ .forEach(e -> {
sink.listItem();
- sink.rawText( r.getIcon() );
+ int size = e.getValue().size();
+ sink.text(size + " job" + (size > 1 ? "s" : "") + " with status " + e.getKey() + ":");
+ sink.list();
+ e.getValue().forEach(r -> {
+ sink.listItem();
+ sink.rawText(r.getIcon());
- sink.rawText( "<span" );
- if ( ( r.getLastBuild() == null )
- || r.getLastBuild().isBefore( ZonedDateTime.now().minusMonths( 1 ) ) )
- {
- sink.rawText( " style=\"color:red\"" );
- }
- sink.rawText( ">(" + ( ( r.getLastBuild() == null )
- ? "-"
- : r.getLastBuild().format( DateTimeFormatter.ISO_LOCAL_DATE ) )
- + ")</span> " );
+ sink.rawText("<span");
+ if ((r.getLastBuild() == null)
+ || r.getLastBuild().isBefore(ZonedDateTime.now().minusMonths(1))) {
+ sink.rawText(" style=\"color:red\"");
+ }
+ sink.rawText(">("
+ + ((r.getLastBuild() == null)
+ ? "-"
+ : r.getLastBuild().format(DateTimeFormatter.ISO_LOCAL_DATE))
+ + ")</span> ");
- sink.link( r.getBuildUrl() );
- sink.rawText( r.getRepositoryName() );
- sink.link_();
+ sink.link(r.getBuildUrl());
+ sink.rawText(r.getRepositoryName());
+ sink.link_();
+ sink.listItem_();
+ });
+ sink.list_();
+
sink.listItem_();
- } );
- sink.list_();
-
- sink.listItem_();
- } );
+ });
sink.list_();
sink.body_();
}
-
- private Comparator<String> resultComparator()
- {
- final List<String> orderedStatus = Arrays.asList( "FAILURE", "UNSTABLE", "UNKNOWN", "SUCCESS" );
- return ( l, r ) ->
- {
- return Integer.compare( orderedStatus.indexOf( l ), orderedStatus.indexOf( r ) );
- };
+
+ private Comparator<String> resultComparator() {
+ final List<String> orderedStatus = Arrays.asList("FAILURE", "UNSTABLE", "UNKNOWN", "SUCCESS");
+ return (l, r) -> {
+ return Integer.compare(orderedStatus.indexOf(l), orderedStatus.indexOf(r));
+ };
}
- private ZonedDateTime getLastBuild( String lastSuccess, String lastFailure )
- {
+ private ZonedDateTime getLastBuild(String lastSuccess, String lastFailure) {
ZonedDateTime success = null;
- if ( !"-".equals( lastSuccess ) )
- {
- success = ZonedDateTime.parse( lastSuccess );
+ if (!"-".equals(lastSuccess)) {
+ success = ZonedDateTime.parse(lastSuccess);
}
ZonedDateTime failure = null;
- if ( !"-".equals( lastFailure ) )
- {
- failure = ZonedDateTime.parse( lastFailure );
+ if (!"-".equals(lastFailure)) {
+ failure = ZonedDateTime.parse(lastFailure);
}
- if ( success == null )
- {
+ if (success == null) {
return failure;
- }
- else if ( failure == null )
- {
+ } else if (failure == null) {
return success;
- }
- else if ( success.compareTo( failure ) >= 0 )
- {
+ } else if (success.compareTo(failure) >= 0) {
return success;
- }
- else
- {
+ } else {
return failure;
}
}
-
+
/**
* Extract Git repository names for Apache Maven from
* <a href="https://gitbox.apache.org/repos/asf">Gitbox main page</a>.
@@ -261,19 +223,18 @@
* @return the list of repository names (without ".git")
* @throws java.io.IOException problem with reading repository index
*/
- protected Collection<String> repositoryNames()
- throws IOException
- {
- List<String> names = new ArrayList<>( 100 );
- Document doc = JsoupRetry.get( gitboxUrl );
+ protected Collection<String> repositoryNames() throws IOException {
+ List<String> names = new ArrayList<>(100);
+ Document doc = JsoupRetry.get(gitboxUrl);
// find Apache Maven table
- Element apacheMavenTable = doc.getElementsMatchingText( "^Apache Maven$" ).parents().get( 0 );
+ Element apacheMavenTable =
+ doc.getElementsMatchingText("^Apache Maven$").parents().get(0);
- Elements gitRepo = apacheMavenTable.select( "tbody tr" ).not( "tr.disabled" ).select( "td:first-child a" );
+ Elements gitRepo =
+ apacheMavenTable.select("tbody tr").not("tr.disabled").select("td:first-child a");
- for ( Element element : gitRepo )
- {
- names.add( element.text().split( "\\.git" )[0] );
+ for (Element element : gitRepo) {
+ names.add(element.text().split("\\.git")[0]);
}
return names;
diff --git a/src/main/java/org/apache/maven/dist/tools/masterjobs/Result.java b/src/main/java/org/apache/maven/dist/tools/masterjobs/Result.java
index d3d3c83..20f832e 100644
--- a/src/main/java/org/apache/maven/dist/tools/masterjobs/Result.java
+++ b/src/main/java/org/apache/maven/dist/tools/masterjobs/Result.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.masterjobs;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.masterjobs;
import java.time.ZonedDateTime;
@@ -26,8 +25,7 @@
*
* @author Robert Scholte
*/
-public class Result
-{
+public class Result {
private String repositoryName;
private String status;
@@ -35,7 +33,7 @@
private String buildUrl;
private String icon;
-
+
private ZonedDateTime lastBuild;
/**
@@ -44,8 +42,7 @@
* @param repositoryName a {@link java.lang.String} object
* @param buildUrl a {@link java.lang.String} object
*/
- public Result( String repositoryName, String buildUrl )
- {
+ public Result(String repositoryName, String buildUrl) {
this.repositoryName = repositoryName;
this.buildUrl = buildUrl;
}
@@ -55,8 +52,7 @@
*
* @param status a {@link java.lang.String} object
*/
- public void setStatus( String status )
- {
+ public void setStatus(String status) {
this.status = status;
}
@@ -65,8 +61,7 @@
*
* @param icon a {@link java.lang.String} object
*/
- public void setIcon( String icon )
- {
+ public void setIcon(String icon) {
this.icon = icon;
}
@@ -75,28 +70,25 @@
*
* @param lastBuild a {@link java.time.ZonedDateTime} object
*/
- public void setLastBuild( ZonedDateTime lastBuild )
- {
+ public void setLastBuild(ZonedDateTime lastBuild) {
this.lastBuild = lastBuild;
}
-
+
/**
* <p>Getter for the field <code>lastBuild</code>.</p>
*
* @return a {@link java.time.ZonedDateTime} object
*/
- public ZonedDateTime getLastBuild()
- {
+ public ZonedDateTime getLastBuild() {
return lastBuild;
}
-
+
/**
* <p>Getter for the field <code>repositoryName</code>.</p>
*
* @return a {@link java.lang.String} object
*/
- public String getRepositoryName()
- {
+ public String getRepositoryName() {
return repositoryName;
}
@@ -105,8 +97,7 @@
*
* @return a {@link java.lang.String} object
*/
- public String getStatus()
- {
+ public String getStatus() {
return status;
}
@@ -115,8 +106,7 @@
*
* @return a {@link java.lang.String} object
*/
- public String getBuildUrl()
- {
+ public String getBuildUrl() {
return buildUrl;
}
@@ -125,8 +115,7 @@
*
* @return a {@link java.lang.String} object
*/
- public String getIcon()
- {
+ public String getIcon() {
return icon;
- }
+ }
}
diff --git a/src/main/java/org/apache/maven/dist/tools/memorycheck/MemoryCheckReport.java b/src/main/java/org/apache/maven/dist/tools/memorycheck/MemoryCheckReport.java
index 6bdebb9..10da3ac 100644
--- a/src/main/java/org/apache/maven/dist/tools/memorycheck/MemoryCheckReport.java
+++ b/src/main/java/org/apache/maven/dist/tools/memorycheck/MemoryCheckReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.memorycheck;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.memorycheck;
+
+import java.io.IOException;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
import org.apache.maven.dist.tools.AbstractDistCheckReport;
import org.apache.maven.dist.tools.ConfigurationLineInfo;
@@ -31,17 +41,6 @@
import org.kohsuke.github.GHWorkflowRun;
import org.kohsuke.github.GitHub;
-import java.io.IOException;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-
/**
* Generate from now a single page with an history of build status from
* <a href="https://github.com/quick-perf/maven-test-bench">Maven Test Bench</a> project, which runs a daily
@@ -49,173 +48,148 @@
*
* @author Patrice Cavezzan
*/
-
-@Mojo( name = "memory-check", requiresProject = false )
-public class MemoryCheckReport extends AbstractDistCheckReport
-{
+@Mojo(name = "memory-check", requiresProject = false)
+public class MemoryCheckReport extends AbstractDistCheckReport {
private static final String GITHUB_REPOSITORY = "quick-perf/maven-test-bench";
/** Constant <code>GITHUB_REPOSITORY_URL="<a href="https://github.com/">...</a> + GITHUB_REPOSITORY"</code> */
public static final String GITHUB_REPOSITORY_URL = "https://github.com/" + GITHUB_REPOSITORY;
/** Constant <code>MEMORY_CHECK_GITHUB_ACTION_WORKFLOW_NAME="Daily Memory Check"</code> */
public static final String MEMORY_CHECK_GITHUB_ACTION_WORKFLOW_NAME = "Daily Memory Check";
+
private static final int BUILD_HISTORY_SIZE = 10;
private static final int GITHUB_ACTION_JOB_PAGE_SIZE = 10;
/**
* Memory Check Report constructor.
*/
- public MemoryCheckReport()
- {
- }
+ public MemoryCheckReport() {}
/** {@inheritDoc} */
@Override
- protected void executeReport( Locale locale ) throws MavenReportException
- {
+ protected void executeReport(Locale locale) throws MavenReportException {
final Sink sink = getSink();
sink.head();
- generateTitle( sink );
+ generateTitle(sink);
sink.head_();
sink.body();
- generateMavenTestBenchIntroduction( sink );
+ generateMavenTestBenchIntroduction(sink);
sink.paragraph();
- generateMavenTestBenchBuildStatusResult( sink );
+ generateMavenTestBenchBuildStatusResult(sink);
sink.paragraph_();
sink.body_();
}
- private void generateTitle( Sink sink )
- {
+ private void generateTitle(Sink sink) {
sink.title();
- sink.text( "Memory Check" );
+ sink.text("Memory Check");
sink.title_();
}
- private void generateMavenTestBenchIntroduction( Sink sink )
- {
+ private void generateMavenTestBenchIntroduction(Sink sink) {
final SinkEventAttributes mavenQuickPerfLinkAttributes = new SinkEventAttributeSet();
- mavenQuickPerfLinkAttributes.addAttribute( SinkEventAttributes.TITLE, "Memory Check" );
+ mavenQuickPerfLinkAttributes.addAttribute(SinkEventAttributes.TITLE, "Memory Check");
// open in new tab to avoid being blocked by iframe
- mavenQuickPerfLinkAttributes.addAttribute( SinkEventAttributes.TARGET , "_blank" );
- sink.link( GITHUB_REPOSITORY_URL, mavenQuickPerfLinkAttributes );
- sink.text( "Memory Check" );
- sink.link_( );
- sink.text( "is running " );
- sink.rawText( "mvn validate" );
- sink.text( " on a massive multi module project, and we make sure that memory allocation stay " );
+ mavenQuickPerfLinkAttributes.addAttribute(SinkEventAttributes.TARGET, "_blank");
+ sink.link(GITHUB_REPOSITORY_URL, mavenQuickPerfLinkAttributes);
+ sink.text("Memory Check");
+ sink.link_();
+ sink.text("is running ");
+ sink.rawText("mvn validate");
+ sink.text(" on a massive multi module project, and we make sure that memory allocation stay ");
final SinkEventAttributes sampleLinkAttributes = new SinkEventAttributeSet();
- sampleLinkAttributes.addAttribute( SinkEventAttributes.TITLE, "Threashold set" );
+ sampleLinkAttributes.addAttribute(SinkEventAttributes.TITLE, "Threashold set");
// open in new tab to avoid being blocked by iframe
- sampleLinkAttributes.addAttribute( SinkEventAttributes.TARGET , "_blank" );
+ sampleLinkAttributes.addAttribute(SinkEventAttributes.TARGET, "_blank");
sink.link(
GITHUB_REPOSITORY_URL + "/blob/master/maven-perf/src/test/java/org/quickperf/"
+ "maven/bench/head/MvnValidateMaxAllocation.java#L52",
- sampleLinkAttributes
- );
- sink.text( "under a certain threshold." );
+ sampleLinkAttributes);
+ sink.text("under a certain threshold.");
sink.link_();
}
- private void generateMavenTestBenchBuildStatusResult( Sink sink )
- {
+ private void generateMavenTestBenchBuildStatusResult(Sink sink) {
sink.lineBreak();
- sink.text( "Current build status: " );
+ sink.text("Current build status: ");
List<GHWorkflowJob> status = getLatestBuildStatus();
sink.list();
- status.forEach( s ->
- {
+ status.forEach(s -> {
sink.listItem();
- sink.link( s.getHtmlUrl().toString() );
- sink.text( DateTimeFormatter.ISO_LOCAL_DATE
- .withZone( ZoneId.of( "UTC" ) )
- .format( s.getStartedAt().toInstant() ) );
- if ( s.getConclusion() == GHWorkflowRun.Conclusion.SUCCESS )
- {
- iconSuccess( sink );
- }
- else
- {
- iconError( sink );
+ sink.link(s.getHtmlUrl().toString());
+ sink.text(DateTimeFormatter.ISO_LOCAL_DATE
+ .withZone(ZoneId.of("UTC"))
+ .format(s.getStartedAt().toInstant()));
+ if (s.getConclusion() == GHWorkflowRun.Conclusion.SUCCESS) {
+ iconSuccess(sink);
+ } else {
+ iconError(sink);
}
sink.link_();
sink.listItem_();
- } );
+ });
sink.list_();
}
/** {@inheritDoc} */
@Override
- protected boolean isIndexPageCheck()
- {
+ protected boolean isIndexPageCheck() {
return false;
}
/** {@inheritDoc} */
@Override
- protected void checkArtifact( ConfigurationLineInfo request, String repoBase ) throws MojoExecutionException
- {
- }
+ protected void checkArtifact(ConfigurationLineInfo request, String repoBase) throws MojoExecutionException {}
/** {@inheritDoc} */
@Override
- protected String getFailuresFilename()
- {
+ protected String getFailuresFilename() {
return null;
}
/** {@inheritDoc} */
@Override
- public String getOutputName()
- {
+ public String getOutputName() {
return "dist-tool-memory-check";
}
/** {@inheritDoc} */
@Override
- public String getName( Locale locale )
- {
+ public String getName(Locale locale) {
return "Dist Tool> Memory Check";
}
/** {@inheritDoc} */
@Override
- public String getDescription( Locale locale )
- {
+ public String getDescription(Locale locale) {
return "Display daily memory result from a QuickPerf sub project on github";
}
- private List<GHWorkflowJob> getLatestBuildStatus()
- {
- try
- {
+ private List<GHWorkflowJob> getLatestBuildStatus() {
+ try {
return StreamSupport.stream(
- GitHub.connect()
- .getRepository( GITHUB_REPOSITORY )
- .queryWorkflowRuns().list().withPageSize( GITHUB_ACTION_JOB_PAGE_SIZE )
- .spliterator(),
- false )
- .limit( BUILD_HISTORY_SIZE )
- .filter( ghWorkflowRun -> ghWorkflowRun.getName().equals( MEMORY_CHECK_GITHUB_ACTION_WORKFLOW_NAME ) )
- .flatMap( ghWorkflowRun ->
- {
- try
- {
- return Arrays.stream( ghWorkflowRun.listJobs().toArray() );
- }
- catch ( IOException e )
- {
- getLog().warn( e );
- return Stream.empty();
- }
- } )
- .collect( Collectors.toList() );
- }
- catch ( IOException e )
- {
- getLog().warn( e );
+ GitHub.connect()
+ .getRepository(GITHUB_REPOSITORY)
+ .queryWorkflowRuns()
+ .list()
+ .withPageSize(GITHUB_ACTION_JOB_PAGE_SIZE)
+ .spliterator(),
+ false)
+ .limit(BUILD_HISTORY_SIZE)
+ .filter(ghWorkflowRun -> ghWorkflowRun.getName().equals(MEMORY_CHECK_GITHUB_ACTION_WORKFLOW_NAME))
+ .flatMap(ghWorkflowRun -> {
+ try {
+ return Arrays.stream(ghWorkflowRun.listJobs().toArray());
+ } catch (IOException e) {
+ getLog().warn(e);
+ return Stream.empty();
+ }
+ })
+ .collect(Collectors.toList());
+ } catch (IOException e) {
+ getLog().warn(e);
return new ArrayList<>();
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/pgp/CheckPgpKeysReport.java b/src/main/java/org/apache/maven/dist/tools/pgp/CheckPgpKeysReport.java
index 226723a..b094c67 100644
--- a/src/main/java/org/apache/maven/dist/tools/pgp/CheckPgpKeysReport.java
+++ b/src/main/java/org/apache/maven/dist/tools/pgp/CheckPgpKeysReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.pgp;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.pgp;
import java.io.File;
import java.io.FileWriter;
@@ -44,10 +43,8 @@
/**
* Check PGP KEYS files.
*/
-@Mojo( name = "check-pgp-keys", requiresProject = false )
-public class CheckPgpKeysReport
- extends AbstractDistCheckReport
-{
+@Mojo(name = "check-pgp-keys", requiresProject = false)
+public class CheckPgpKeysReport extends AbstractDistCheckReport {
/** Constant <code>FAILURES_FILENAME="check-pgp-keys.log"</code> */
public static final String FAILURES_FILENAME = "check-pgp-keys.log";
@@ -60,121 +57,104 @@
/**
* Check PGP Keys report.
*/
- public CheckPgpKeysReport()
- {
- }
+ public CheckPgpKeysReport() {}
/** {@inheritDoc} */
@Override
- protected String getFailuresFilename()
- {
+ protected String getFailuresFilename() {
return FAILURES_FILENAME;
}
/** {@inheritDoc} */
@Override
- public String getName( Locale locale )
- {
+ public String getName(Locale locale) {
return "Dist Tool> Check PGP KEYS";
}
/** {@inheritDoc} */
@Override
- public String getDescription( Locale locale )
- {
+ public String getDescription(Locale locale) {
return "Verification of PGP KEYS files";
}
/** {@inheritDoc} */
@Override
- protected boolean isIndexPageCheck()
- {
+ protected boolean isIndexPageCheck() {
return false;
}
/** {@inheritDoc} */
@Override
- protected void executeReport( Locale locale )
- throws MavenReportException
- {
- String projectKeys = fetchUrl( PROJECT_KEYS_URL );
- String distKeys = fetchUrl( DIST_KEYS_URL );
+ protected void executeReport(Locale locale) throws MavenReportException {
+ String projectKeys = fetchUrl(PROJECT_KEYS_URL);
+ String distKeys = fetchUrl(DIST_KEYS_URL);
- if ( !projectKeys.equals( distKeys ) )
- {
- File failure = new File( failuresDirectory, FAILURES_FILENAME );
- try ( PrintWriter output = new PrintWriter( new FileWriter( failure ) ) )
- {
- output.println( "PGP KEYS files content is different: " + DIST_KEYS_URL + " vs " + PROJECT_KEYS_URL );
- }
- catch ( Exception e )
- {
- getLog().error( "Cannot append to " + getFailuresFilename() );
+ if (!projectKeys.equals(distKeys)) {
+ File failure = new File(failuresDirectory, FAILURES_FILENAME);
+ try (PrintWriter output = new PrintWriter(new FileWriter(failure))) {
+ output.println("PGP KEYS files content is different: " + DIST_KEYS_URL + " vs " + PROJECT_KEYS_URL);
+ } catch (Exception e) {
+ getLog().error("Cannot append to " + getFailuresFilename());
}
}
Sink sink = getSink();
sink.head();
sink.title();
- sink.text( "Check PGP KEYS files" );
+ sink.text("Check PGP KEYS files");
sink.title_();
sink.head_();
sink.body();
sink.section1();
sink.paragraph();
- sink.rawText( "Check that:" );
+ sink.rawText("Check that:");
sink.paragraph_();
sink.list();
sink.listItem();
- sink.rawText( "official Maven PGP KEYS file from distribution area (<b>PMC write only</b>) " );
- sink.link( DIST_KEYS_URL );
- sink.rawText( DIST_KEYS_URL );
+ sink.rawText("official Maven PGP KEYS file from distribution area (<b>PMC write only</b>) ");
+ sink.link(DIST_KEYS_URL);
+ sink.rawText(DIST_KEYS_URL);
sink.link_();
sink.listItem_();
sink.listItem();
- sink.rawText( "intermediate <b>committer write</b> one in Maven Subversion tree " );
- sink.link( PROJECT_KEYS_URL );
- sink.rawText( PROJECT_KEYS_URL );
+ sink.rawText("intermediate <b>committer write</b> one in Maven Subversion tree ");
+ sink.link(PROJECT_KEYS_URL);
+ sink.rawText(PROJECT_KEYS_URL);
sink.link_();
sink.listItem_();
sink.list_();
sink.paragraph();
- sink.rawText( "Committers are supposed to write to project's KEYS then ask PMC for sync, but sometimes PMC"
- + " members directly add in distribution area, then future sync is not trivial any more." );
+ sink.rawText("Committers are supposed to write to project's KEYS then ask PMC for sync, but sometimes PMC"
+ + " members directly add in distribution area, then future sync is not trivial any more.");
sink.paragraph_();
sink.paragraph();
- sink.rawText( "match: " );
- if ( projectKeys.equals( distKeys ) )
- {
- iconSuccess( sink );
- }
- else
- {
- iconError( sink );
+ sink.rawText("match: ");
+ if (projectKeys.equals(distKeys)) {
+ iconSuccess(sink);
+ } else {
+ iconError(sink);
}
sink.paragraph_();
- sink.numberedList( 0 );
- KeysIterator distIterator = new KeysIterator( distKeys );
- KeysIterator projectIterator = new KeysIterator( projectKeys );
- while ( distIterator.hasNext() || projectIterator.hasNext() )
- {
+ sink.numberedList(0);
+ KeysIterator distIterator = new KeysIterator(distKeys);
+ KeysIterator projectIterator = new KeysIterator(projectKeys);
+ while (distIterator.hasNext() || projectIterator.hasNext()) {
String distKey = distIterator.hasNext() ? distIterator.next() : "";
String projectKey = projectIterator.hasNext() ? projectIterator.next() : "";
sink.numberedListItem();
- sink.verbatim( BOLD );
- sink.rawText( distKey );
+ sink.verbatim(BOLD);
+ sink.rawText(distKey);
sink.verbatim_();
- if ( !projectKey.equals( distKey ) )
- {
- sink.rawText( "dist target (PMC) " );
- iconError( sink );
- sink.rawText( " project (committers)" );
+ if (!projectKey.equals(distKey)) {
+ sink.rawText("dist target (PMC) ");
+ iconError(sink);
+ sink.rawText(" project (committers)");
- sink.verbatim( BOLD );
- sink.rawText( projectKey );
+ sink.verbatim(BOLD);
+ sink.rawText(projectKey);
sink.verbatim_();
}
sink.numberedListItem_();
@@ -188,51 +168,38 @@
/** {@inheritDoc} */
@Override
- protected void checkArtifact( ConfigurationLineInfo request, String repoBase )
- throws MojoExecutionException
- {
- }
+ protected void checkArtifact(ConfigurationLineInfo request, String repoBase) throws MojoExecutionException {}
- private String fetchUrl( String url )
- throws MavenReportException
- {
- try ( InputStream in = new URL( url ).openStream();
- Reader reader = new InputStreamReader( in, "UTF-8" );
- StringWriter writer = new StringWriter() )
- {
- IOUtils.copy( reader, writer );
+ private String fetchUrl(String url) throws MavenReportException {
+ try (InputStream in = new URL(url).openStream();
+ Reader reader = new InputStreamReader(in, "UTF-8");
+ StringWriter writer = new StringWriter()) {
+ IOUtils.copy(reader, writer);
return writer.toString();
- }
- catch ( IOException ioe )
- {
- throw new MavenReportException( "cannot fetch " + url, ioe );
+ } catch (IOException ioe) {
+ throw new MavenReportException("cannot fetch " + url, ioe);
}
}
- private static class KeysIterator
- implements Iterator<String>
- {
+ private static class KeysIterator implements Iterator<String> {
private static final String BEGIN = "-----BEGIN PGP PUBLIC KEY BLOCK-----";
private static final String END = "-----END PGP PUBLIC KEY BLOCK-----";
private String content;
- KeysIterator( String content )
- {
- this.content = content.substring( content.indexOf( "---" ) + 3 );
+ KeysIterator(String content) {
+ this.content = content.substring(content.indexOf("---") + 3);
}
@Override
- public boolean hasNext()
- {
+ public boolean hasNext() {
return content.length() > 0;
}
@Override
- public String next()
- {
- String id = content.substring( 0, content.indexOf( BEGIN ) ).trim();
- content = content.substring( content.indexOf( END ) + END.length() ).trim();
+ public String next() {
+ String id = content.substring(0, content.indexOf(BEGIN)).trim();
+ content = content.substring(content.indexOf(END) + END.length()).trim();
return id;
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/prerequisites/GetPrerequisites.java b/src/main/java/org/apache/maven/dist/tools/prerequisites/GetPrerequisites.java
index 8b40003..eea9255 100644
--- a/src/main/java/org/apache/maven/dist/tools/prerequisites/GetPrerequisites.java
+++ b/src/main/java/org/apache/maven/dist/tools/prerequisites/GetPrerequisites.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.prerequisites;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.prerequisites;
import java.io.IOException;
import java.util.ArrayList;
@@ -36,14 +35,13 @@
*
* @author Karl Heinz Marbaiase
*/
-public class GetPrerequisites
-{
+public class GetPrerequisites {
/**
* TODO Currently hard code should be somehow extracted from the configuration file....
*/
- public static final String[] PLUGIN_NAMES = {
- "maven-acr-plugin",
-// "maven-ant-plugin", // retired
+ public static final String[] PLUGIN_NAMES = {
+ "maven-acr-plugin",
+ // "maven-ant-plugin", // retired
"maven-antrun-plugin",
"maven-archetype-plugin",
"maven-assembly-plugin",
@@ -104,9 +102,7 @@
/**
* Get Prerequisites for the given plugin name.
*/
- public GetPrerequisites()
- {
- }
+ public GetPrerequisites() {}
/**
* <p>getPluginInfoUrl.</p>
@@ -114,8 +110,7 @@
* @param pluginName a {@link java.lang.String} object
* @return a {@link java.lang.String} object
*/
- public String getPluginInfoUrl( String pluginName )
- {
+ public String getPluginInfoUrl(String pluginName) {
return BASEURL + pluginName + "/plugin-info.html";
}
@@ -126,66 +121,57 @@
* @return a {@link org.apache.maven.dist.tools.prerequisites.PluginPrerequisites} object
* @throws java.io.IOException if any.
*/
- public PluginPrerequisites getPluginPrerequisites( String pluginName )
- throws IOException
- {
- String url = getPluginInfoUrl( pluginName );
+ public PluginPrerequisites getPluginPrerequisites(String pluginName) throws IOException {
+ String url = getPluginInfoUrl(pluginName);
- Document doc = JsoupRetry.get( url );
+ Document doc = JsoupRetry.get(url);
String releaseDate = "?";
- Elements breadcrumbs = doc.select( "div[id=breadcrumbs]" ); // breadcrumbs
- if ( breadcrumbs.size() >= 0 )
- {
- String text = breadcrumbs.get( 0 ).text();
- int index = text.indexOf( "Last Published: " );
- releaseDate = text.substring( index + 16 ).substring( 0, 10 );
+ Elements breadcrumbs = doc.select("div[id=breadcrumbs]"); // breadcrumbs
+ if (breadcrumbs.size() >= 0) {
+ String text = breadcrumbs.get(0).text();
+ int index = text.indexOf("Last Published: ");
+ releaseDate = text.substring(index + 16).substring(0, 10);
}
- Elements select = doc.select( "table.bodyTable" ); // Stylus skin
+ Elements select = doc.select("table.bodyTable"); // Stylus skin
- if ( select.size() < 1 )
- {
- select = doc.select( "table.table-striped" ); // Fluido skin
+ if (select.size() < 1) {
+ select = doc.select("table.table-striped"); // Fluido skin
}
- if ( select.size() < 1 )
- {
- System.err.println( "Could not find expected plugin info for " + url );
- return new PluginPrerequisites( pluginName, "?", "?", "?", "?" );
+ if (select.size() < 1) {
+ System.err.println("Could not find expected plugin info for " + url);
+ return new PluginPrerequisites(pluginName, "?", "?", "?", "?");
}
- Element tableInfo = select.get( 1 );
- Elements elementsByAttributeA = tableInfo.getElementsByAttributeValue( "class", "a" );
- Elements elementsByAttributeB = tableInfo.getElementsByAttributeValue( "class", "b" );
+ Element tableInfo = select.get(1);
+ Elements elementsByAttributeA = tableInfo.getElementsByAttributeValue("class", "a");
+ Elements elementsByAttributeB = tableInfo.getElementsByAttributeValue("class", "b");
String mavenVersion = elementsByAttributeA.first().text();
String jdkVersion = elementsByAttributeB.first().text();
-
- //FIXME: Sometimes it happens that the indexes are swapped (I don't know why...I have to find out why...)
- if ( mavenVersion.startsWith( "JDK" ) )
- {
+
+ // FIXME: Sometimes it happens that the indexes are swapped (I don't know why...I have to find out why...)
+ if (mavenVersion.startsWith("JDK")) {
String tmp = jdkVersion;
jdkVersion = mavenVersion;
mavenVersion = tmp;
}
- //Leave only version part...
- mavenVersion = mavenVersion.replace( "Maven ", "" );
- jdkVersion = jdkVersion.replace( "JDK ", "" ).replace( "1.", "" );
+ // Leave only version part...
+ mavenVersion = mavenVersion.replace("Maven ", "");
+ jdkVersion = jdkVersion.replace("JDK ", "").replace("1.", "");
- String pluginVersion = doc.select( "pre" ).text();
- int index = pluginVersion.indexOf( "<version>" );
- if ( index < 0 )
- {
+ String pluginVersion = doc.select("pre").text();
+ int index = pluginVersion.indexOf("<version>");
+ if (index < 0) {
pluginVersion = "";
- }
- else
- {
- pluginVersion = pluginVersion.substring( index + "<version>".length() );
- pluginVersion = pluginVersion.substring( 0, pluginVersion.indexOf( "</version>" ) );
+ } else {
+ pluginVersion = pluginVersion.substring(index + "<version>".length());
+ pluginVersion = pluginVersion.substring(0, pluginVersion.indexOf("</version>"));
}
- return new PluginPrerequisites( pluginName, pluginVersion, releaseDate, mavenVersion, jdkVersion );
+ return new PluginPrerequisites(pluginName, pluginVersion, releaseDate, mavenVersion, jdkVersion);
}
/**
@@ -193,20 +179,15 @@
*
* @return a {@link java.util.List} object
*/
- public List<PluginPrerequisites> getPrequisites()
- {
+ public List<PluginPrerequisites> getPrequisites() {
List<PluginPrerequisites> result = new ArrayList<>();
- for ( String pluginName : PLUGIN_NAMES )
- {
- try
- {
- result.add( getPluginPrerequisites( pluginName ) );
- }
- catch ( IOException e )
- {
- //What could happen?
- //check it...
+ for (String pluginName : PLUGIN_NAMES) {
+ try {
+ result.add(getPluginPrerequisites(pluginName));
+ } catch (IOException e) {
+ // What could happen?
+ // check it...
}
}
return result;
@@ -217,9 +198,7 @@
*
* @return a {@link java.util.Map} object
*/
- public Map<ArtifactVersion, List<PluginPrerequisites>> getGroupedPrequisites()
- {
- return getPrequisites().stream()
- .collect( Collectors.groupingBy( PluginPrerequisites::getMavenVersion ) );
+ public Map<ArtifactVersion, List<PluginPrerequisites>> getGroupedPrequisites() {
+ return getPrequisites().stream().collect(Collectors.groupingBy(PluginPrerequisites::getMavenVersion));
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/prerequisites/ListPluginsPrerequisitesReport.java b/src/main/java/org/apache/maven/dist/tools/prerequisites/ListPluginsPrerequisitesReport.java
index 4e1de48..5d488b9 100644
--- a/src/main/java/org/apache/maven/dist/tools/prerequisites/ListPluginsPrerequisitesReport.java
+++ b/src/main/java/org/apache/maven/dist/tools/prerequisites/ListPluginsPrerequisitesReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.prerequisites;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.prerequisites;
import java.util.List;
import java.util.Locale;
@@ -33,38 +32,29 @@
*
* @author Karl Heinz Marbaise
*/
-@Mojo( name = "list-plugins-prerequisites", requiresProject = false )
-public class ListPluginsPrerequisitesReport
- extends AbstractMavenReport
-{
+@Mojo(name = "list-plugins-prerequisites", requiresProject = false)
+public class ListPluginsPrerequisitesReport extends AbstractMavenReport {
/**
* List Plugins Prerequisites Report
*/
- public ListPluginsPrerequisitesReport()
- {
- }
+ public ListPluginsPrerequisitesReport() {}
/** {@inheritDoc} */
@Override
- public String getName( Locale locale )
- {
+ public String getName(Locale locale) {
return "Dist Tool> List Plugins Prerequisites";
}
/** {@inheritDoc} */
@Override
- public String getDescription( Locale locale )
- {
+ public String getDescription(Locale locale) {
return "Maven and JDK version prerequisites for plugins";
}
/** {@inheritDoc} */
@Override
- protected void executeReport( Locale locale )
- throws MavenReportException
- {
- if ( !outputDirectory.exists() )
- {
+ protected void executeReport(Locale locale) throws MavenReportException {
+ if (!outputDirectory.exists()) {
outputDirectory.mkdirs();
}
@@ -74,70 +64,63 @@
sink.head();
sink.title();
- sink.text( "Display Plugins Prerequisites" );
+ sink.text("Display Plugins Prerequisites");
sink.title_();
sink.head_();
sink.body();
sink.table();
- prerequisites.getGroupedPrequisites()
- .entrySet()
- .stream()
- .sorted( Map.Entry.comparingByKey() )
- .forEachOrdered( plugin ->
- {
- List<PluginPrerequisites> pluginsPrerequisites = plugin.getValue();
+ prerequisites.getGroupedPrequisites().entrySet().stream()
+ .sorted(Map.Entry.comparingByKey())
+ .forEachOrdered(plugin -> {
+ List<PluginPrerequisites> pluginsPrerequisites = plugin.getValue();
+ sink.tableRow();
+ sink.tableHeaderCell();
+ sink.rawText("Maven Version Prerequisite " + plugin.getKey()
+ + " (" + pluginsPrerequisites.size()
+ + " / "
+ + GetPrerequisites.PLUGIN_NAMES.length + ")");
+ sink.tableHeaderCell_();
+
+ sink.tableHeaderCell();
+ sink.rawText("Maven Version");
+ sink.tableHeaderCell_();
+
+ sink.tableHeaderCell();
+ sink.rawText("JDK Version");
+ sink.tableHeaderCell_();
+
+ sink.tableHeaderCell();
+ sink.rawText("Release Date");
+ sink.tableHeaderCell_();
+
+ sink.tableRow_();
+
+ for (PluginPrerequisites pluginPrerequisites : pluginsPrerequisites) {
sink.tableRow();
- sink.tableHeaderCell();
- sink.rawText(
- "Maven Version Prerequisite " + plugin.getKey()
- + " (" + pluginsPrerequisites.size()
- + " / "
- + GetPrerequisites.PLUGIN_NAMES.length + ")" );
- sink.tableHeaderCell_();
+ sink.tableCell();
+ sink.link(prerequisites.getPluginInfoUrl(pluginPrerequisites.getPluginName()));
+ sink.text(pluginPrerequisites.getPluginName());
+ sink.link_();
+ sink.text(" ");
+ sink.text(pluginPrerequisites.getPluginVersion());
+ sink.tableCell_();
- sink.tableHeaderCell();
- sink.rawText( "Maven Version" );
- sink.tableHeaderCell_();
+ sink.tableCell();
+ sink.text(pluginPrerequisites.getMavenVersion().toString());
+ sink.tableCell_();
- sink.tableHeaderCell();
- sink.rawText( "JDK Version" );
- sink.tableHeaderCell_();
+ sink.tableCell();
+ sink.text(pluginPrerequisites.getJdkVersion());
+ sink.tableCell_();
- sink.tableHeaderCell();
- sink.rawText( "Release Date" );
- sink.tableHeaderCell_();
-
+ sink.tableCell();
+ sink.text(pluginPrerequisites.getReleaseDate());
+ sink.tableCell_();
sink.tableRow_();
-
- for ( PluginPrerequisites pluginPrerequisites : pluginsPrerequisites )
- {
- sink.tableRow();
- sink.tableCell();
- sink.link( prerequisites.getPluginInfoUrl( pluginPrerequisites.getPluginName() ) );
- sink.text( pluginPrerequisites.getPluginName() );
- sink.link_();
- sink.text( " " );
- sink.text( pluginPrerequisites.getPluginVersion() );
- sink.tableCell_();
-
- sink.tableCell();
- sink.text( pluginPrerequisites.getMavenVersion().toString() );
- sink.tableCell_();
-
- sink.tableCell();
- sink.text( pluginPrerequisites.getJdkVersion() );
- sink.tableCell_();
-
- sink.tableCell();
- sink.text( pluginPrerequisites.getReleaseDate() );
- sink.tableCell_();
- sink.tableRow_();
- }
-
}
- );
+ });
sink.table_();
sink.body_();
@@ -145,8 +128,7 @@
/** {@inheritDoc} */
@Override
- public String getOutputName()
- {
+ public String getOutputName() {
return "dist-tool-prerequisites";
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/prerequisites/PluginPrerequisites.java b/src/main/java/org/apache/maven/dist/tools/prerequisites/PluginPrerequisites.java
index b349966..a4d71ea 100644
--- a/src/main/java/org/apache/maven/dist/tools/prerequisites/PluginPrerequisites.java
+++ b/src/main/java/org/apache/maven/dist/tools/prerequisites/PluginPrerequisites.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.prerequisites;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.prerequisites;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
@@ -27,8 +26,7 @@
*
* @author Karl Heinz Marbaise
*/
-public class PluginPrerequisites
-{
+public class PluginPrerequisites {
private String pluginName;
private String pluginVersion;
@@ -48,13 +46,12 @@
* @param mavenVersion a {@link java.lang.String} object
* @param jdkVersion a {@link java.lang.String} object
*/
- public PluginPrerequisites( String pluginName, String pluginVersion, String releaseDate, String mavenVersion,
- String jdkVersion )
- {
+ public PluginPrerequisites(
+ String pluginName, String pluginVersion, String releaseDate, String mavenVersion, String jdkVersion) {
this.pluginName = pluginName;
this.pluginVersion = pluginVersion;
this.releaseDate = releaseDate;
- this.mavenVersion = new DefaultArtifactVersion( mavenVersion );
+ this.mavenVersion = new DefaultArtifactVersion(mavenVersion);
this.jdkVersion = jdkVersion;
}
@@ -63,8 +60,7 @@
*
* @return a {@link org.apache.maven.artifact.versioning.ArtifactVersion} object
*/
- public ArtifactVersion getMavenVersion()
- {
+ public ArtifactVersion getMavenVersion() {
return mavenVersion;
}
@@ -73,9 +69,8 @@
*
* @param mavenVersion a {@link java.lang.String} object
*/
- public void setMavenVersion( String mavenVersion )
- {
- this.mavenVersion = new DefaultArtifactVersion( mavenVersion );
+ public void setMavenVersion(String mavenVersion) {
+ this.mavenVersion = new DefaultArtifactVersion(mavenVersion);
}
/**
@@ -83,8 +78,7 @@
*
* @return a {@link java.lang.String} object
*/
- public String getJdkVersion()
- {
+ public String getJdkVersion() {
return jdkVersion;
}
@@ -93,8 +87,7 @@
*
* @param jdkVersion a {@link java.lang.String} object
*/
- public void setJdkVersion( String jdkVersion )
- {
+ public void setJdkVersion(String jdkVersion) {
this.jdkVersion = jdkVersion;
}
@@ -103,8 +96,7 @@
*
* @return a {@link java.lang.String} object
*/
- public String getPluginName()
- {
+ public String getPluginName() {
return pluginName;
}
@@ -113,8 +105,7 @@
*
* @return a {@link java.lang.String} object
*/
- public String getPluginVersion()
- {
+ public String getPluginVersion() {
return pluginVersion;
}
@@ -123,8 +114,7 @@
*
* @return a {@link java.lang.String} object
*/
- public String getReleaseDate()
- {
+ public String getReleaseDate() {
return releaseDate;
}
@@ -133,9 +123,7 @@
*
* @param pluginName a {@link java.lang.String} object
*/
- public void setPluginName( String pluginName )
- {
+ public void setPluginName(String pluginName) {
this.pluginName = pluginName;
}
-
}
diff --git a/src/main/java/org/apache/maven/dist/tools/site/CheckSiteResult.java b/src/main/java/org/apache/maven/dist/tools/site/CheckSiteResult.java
index 3b3f026..9ce6690 100644
--- a/src/main/java/org/apache/maven/dist/tools/site/CheckSiteResult.java
+++ b/src/main/java/org/apache/maven/dist/tools/site/CheckSiteResult.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.site;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.site;
import java.util.HashMap;
import java.util.Map;
@@ -30,9 +29,7 @@
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Node;
-class CheckSiteResult
- extends AbstractCheckResult
-{
+class CheckSiteResult extends AbstractCheckResult {
private String url;
private Map<HTMLChecker, Boolean> checkMap = new HashMap<>();
@@ -43,13 +40,11 @@
private String screenshotName;
- CheckSiteResult( ConfigurationLineInfo r, String version )
- {
- super( r, version );
+ CheckSiteResult(ConfigurationLineInfo r, String version) {
+ super(r, version);
}
- void setUrl( String url )
- {
+ void setUrl(String url) {
this.url = url;
}
@@ -58,8 +53,7 @@
*
* @return the url
*/
- public String getUrl()
- {
+ public String getUrl() {
return url;
}
@@ -68,13 +62,11 @@
*
* @return the checkMap
*/
- public Map<HTMLChecker, Boolean> getCheckMap()
- {
+ public Map<HTMLChecker, Boolean> getCheckMap() {
return checkMap;
}
- void setHTTPErrorUrl( int status )
- {
+ void setHTTPErrorUrl(int status) {
this.statusCode = status;
}
@@ -83,94 +75,71 @@
*
* @return the statusCode
*/
- public int getStatusCode()
- {
+ public int getStatusCode() {
return statusCode;
}
- void renderDetectedSkin( Sink sink )
- {
- if ( statusCode != DistCheckSiteReport.HTTP_OK )
- {
- sink.text( "None" );
- }
- else
- {
- sink.text( "skin: " );
- if ( isSkin( "Fluido" ) )
- {
- sink.text( "Fluido" );
+ void renderDetectedSkin(Sink sink) {
+ if (statusCode != DistCheckSiteReport.HTTP_OK) {
+ sink.text("None");
+ } else {
+ sink.text("skin: ");
+ if (isSkin("Fluido")) {
+ sink.text("Fluido");
+ } else if (isSkin("Stylus")) {
+ sink.text("Stylus");
+ } else {
+ sink.text("Not determined");
}
- else if ( isSkin( "Stylus" ) )
- {
- sink.text( "Stylus" );
- }
- else
- {
- sink.text( "Not determined" );
- }
- sink.verbatim( null );
- sink.text( comment.trim().replace( " |", "|" ).replace( "| ", "" ) );
+ sink.verbatim(null);
+ sink.text(comment.trim().replace(" |", "|").replace("| ", ""));
sink.verbatim_();
}
}
- void renderDisplayedArtifactVersion( Sink sink )
- {
- if ( statusCode != DistCheckSiteReport.HTTP_OK )
- {
- AbstractDistCheckReport.iconError( sink );
- }
- else
- {
+ void renderDisplayedArtifactVersion(Sink sink) {
+ if (statusCode != DistCheckSiteReport.HTTP_OK) {
+ AbstractDistCheckReport.iconError(sink);
+ } else {
boolean found = false;
- for ( Map.Entry<HTMLChecker, Boolean> e : checkMap.entrySet() )
- {
- if ( e.getValue() )
- {
- AbstractDistCheckReport.iconSuccess( sink );
- sink.text( ": " + e.getKey().getName() );
+ for (Map.Entry<HTMLChecker, Boolean> e : checkMap.entrySet()) {
+ if (e.getValue()) {
+ AbstractDistCheckReport.iconSuccess(sink);
+ sink.text(": " + e.getKey().getName());
found = true;
}
}
- if ( !found )
- {
- AbstractDistCheckReport.iconWarning( sink );
- sink.text( ": artifact version not found" );
+ if (!found) {
+ AbstractDistCheckReport.iconWarning(sink);
+ sink.text(": artifact version not found");
}
}
}
- private boolean isSkin( String skinName )
- {
- return comment.contains( skinName );
+ private boolean isSkin(String skinName) {
+ return comment.contains(skinName);
}
- void setDocument( Document doc )
- {
- comment = extractComment( doc );
- statusCode = ( doc == null ) ? -1 : DistCheckSiteReport.HTTP_OK;
+ void setDocument(Document doc) {
+ comment = extractComment(doc);
+ statusCode = (doc == null) ? -1 : DistCheckSiteReport.HTTP_OK;
}
- static String extractComment( Document document )
- {
- for ( Node node : document.childNodes() )
- {
- if ( node instanceof Comment )
- {
- return ( ( Comment ) node ).getData();
+ static String extractComment(Document document) {
+ for (Node node : document.childNodes()) {
+ if (node instanceof Comment) {
+ return ((Comment) node).getData();
}
}
return "";
}
- void setScreenShot( String fileName )
- {
+ void setScreenShot(String fileName) {
this.screenshotName = fileName;
}
- String getScreenShot()
- {
+
+ String getScreenShot() {
return screenshotName;
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/site/DistCheckSiteReport.java b/src/main/java/org/apache/maven/dist/tools/site/DistCheckSiteReport.java
index 8ffa664..2cc6172 100644
--- a/src/main/java/org/apache/maven/dist/tools/site/DistCheckSiteReport.java
+++ b/src/main/java/org/apache/maven/dist/tools/site/DistCheckSiteReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.site;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.site;
import java.util.LinkedList;
import java.util.List;
@@ -45,19 +44,15 @@
*
* @author skygo
*/
-@Mojo( name = "check-site", requiresProject = false )
-public class DistCheckSiteReport
- extends AbstractDistCheckReport
-{
+@Mojo(name = "check-site", requiresProject = false)
+public class DistCheckSiteReport extends AbstractDistCheckReport {
/** Constant <code>FAILURES_FILENAME="check-site.log"</code> */
public static final String FAILURES_FILENAME = "check-site.log";
/**
* <p>Constructor for DistCheckSiteReport.</p>
*/
- public DistCheckSiteReport()
- {
- }
+ public DistCheckSiteReport() {}
/**
* Ignore site failure for <code>artifactId</code> or <code>artifactId:version</code>
@@ -74,7 +69,7 @@
/**
* Local repository.
*/
- @Parameter( defaultValue = "${localRepository}", required = true, readonly = true )
+ @Parameter(defaultValue = "${localRepository}", required = true, readonly = true)
protected ArtifactRepository localRepository;
/**
@@ -90,8 +85,7 @@
/** {@inheritDoc} */
@Override
- protected boolean isIndexPageCheck()
- {
+ protected boolean isIndexPageCheck() {
return false;
}
@@ -100,22 +94,19 @@
*
* @return a {@link java.lang.String} object
*/
- protected String getFailuresFilename()
- {
+ protected String getFailuresFilename() {
return FAILURES_FILENAME;
}
/** {@inheritDoc} */
@Override
- public String getName( Locale locale )
- {
+ public String getName(Locale locale) {
return "Dist Tool> Check Sites";
}
/** {@inheritDoc} */
@Override
- public String getDescription( Locale locale )
- {
+ public String getDescription(Locale locale) {
return "Verification of documentation site corresponding to artifact";
}
@@ -125,75 +116,66 @@
/** {@inheritDoc} */
@Override
- protected void executeReport( Locale locale )
- throws MavenReportException
- {
- if ( !outputDirectory.exists() )
- {
+ protected void executeReport(Locale locale) throws MavenReportException {
+ if (!outputDirectory.exists()) {
outputDirectory.mkdirs();
}
- try
- {
+ try {
this.execute();
- }
- catch ( MojoExecutionException ex )
- {
- throw new MavenReportException( ex.getMessage(), ex );
+ } catch (MojoExecutionException ex) {
+ throw new MavenReportException(ex.getMessage(), ex);
}
Sink sink = getSink();
sink.head();
sink.title();
- sink.text( "Check sites" );
+ sink.text("Check sites");
sink.title_();
sink.head_();
sink.body();
sink.section1();
- sink.rawText( "Checked sites, also do some basic checking in index.html contents." );
- sink.rawText( "This is to help maintaining some coherence. How many site are skin fluido, stylus,"
- + " where they have artifact version (right, left)" );
- sink.rawText( "All sun icons in one column is kind of objective." );
+ sink.rawText("Checked sites, also do some basic checking in index.html contents.");
+ sink.rawText("This is to help maintaining some coherence. How many site are skin fluido, stylus,"
+ + " where they have artifact version (right, left)");
+ sink.rawText("All sun icons in one column is kind of objective.");
sink.section1_();
sink.table();
sink.tableRow();
sink.tableHeaderCell();
- sink.rawText( "groupId/artifactId" );
+ sink.rawText("groupId/artifactId");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.rawText( "LATEST" );
+ sink.rawText("LATEST");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.rawText( "DATE" );
+ sink.rawText("DATE");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.rawText( "URL" );
+ sink.rawText("URL");
sink.lineBreak();
- sink.rawText( "Skins" );
+ sink.rawText("Skins");
sink.lineBreak();
- sink.rawText( "Comments on top of html" );
+ sink.rawText("Comments on top of html");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.rawText( "Artifact version displayed" );
+ sink.rawText("Artifact version displayed");
sink.tableHeaderCell_();
sink.tableRow_();
String directory = null;
- for ( CheckSiteResult csr : results )
- {
+ for (CheckSiteResult csr : results) {
ConfigurationLineInfo cli = csr.getConfigurationLine();
- if ( !cli.getDirectory().equals( directory ) )
- {
+ if (!cli.getDirectory().equals(directory)) {
directory = cli.getDirectory();
sink.tableRow();
sink.tableHeaderCell();
// shorten groupid
- sink.rawText( cli.getGroupId().replaceAll( "org.apache.maven", "o.a.m" ) );
+ sink.rawText(cli.getGroupId().replaceAll("org.apache.maven", "o.a.m"));
sink.tableHeaderCell_();
- for ( int i = 0; i < 5 ; i++ )
- {
+ for (int i = 0; i < 5; i++) {
sink.tableHeaderCell();
- sink.rawText( " " );
+ sink.rawText(" ");
sink.tableHeaderCell_();
}
sink.tableRow_();
@@ -201,33 +183,32 @@
sink.tableRow();
sink.tableCell();
- sink.anchor( cli.getArtifactId() );
- sink.rawText( cli.getArtifactId() );
+ sink.anchor(cli.getArtifactId());
+ sink.rawText(cli.getArtifactId());
sink.anchor_();
sink.tableCell_();
sink.tableCell();
- sink.rawText( csr.getVersion() );
+ sink.rawText(csr.getVersion());
sink.tableCell_();
sink.tableCell();
- sink.rawText( cli.getReleaseDateFromMetadata() );
+ sink.rawText(cli.getReleaseDateFromMetadata());
sink.tableCell_();
sink.tableCell();
- if ( csr.getStatusCode() != HTTP_OK )
- {
- iconError( sink );
- sink.rawText( "[" + csr.getStatusCode() + "] " );
+ if (csr.getStatusCode() != HTTP_OK) {
+ iconError(sink);
+ sink.rawText("[" + csr.getStatusCode() + "] ");
}
- sink.link( csr.getUrl() );
- sink.rawText( getSimplifiedUrl( csr.getUrl() ) );
+ sink.link(csr.getUrl());
+ sink.rawText(getSimplifiedUrl(csr.getUrl()));
sink.link_();
sink.lineBreak();
- csr.renderDetectedSkin( sink );
+ csr.renderDetectedSkin(sink);
sink.tableCell_();
sink.tableCell();
- csr.renderDisplayedArtifactVersion( sink );
+ csr.renderDisplayedArtifactVersion(sink);
sink.tableCell_();
sink.tableRow_();
@@ -238,63 +219,50 @@
sink.close();
}
- private String getSimplifiedUrl( String url )
- {
- return url.replace( "://maven.apache.org", "://m.a.o" );
+ private String getSimplifiedUrl(String url) {
+ return url.replace("://maven.apache.org", "://m.a.o");
}
- private void checkSite( ConfigurationLineInfo cli, String version )
- {
- CheckSiteResult result = new CheckSiteResult( cli, version );
- results.add( result );
- try
- {
- Artifact artifact =
- artifactFactory.createProjectArtifact( cli.getGroupId(), cli.getArtifactId(), version );
+ private void checkSite(ConfigurationLineInfo cli, String version) {
+ CheckSiteResult result = new CheckSiteResult(cli, version);
+ results.add(result);
+ try {
+ Artifact artifact = artifactFactory.createProjectArtifact(cli.getGroupId(), cli.getArtifactId(), version);
MavenProject artifactProject =
- mavenProjectBuilder.buildFromRepository( artifact, artifactRepositories, localRepository, false );
+ mavenProjectBuilder.buildFromRepository(artifact, artifactRepositories, localRepository, false);
- String siteUrl = sites.get( cli.getArtifactId() );
- if ( siteUrl == null )
- {
- siteUrl = sites.get( cli.getArtifactId() + ':' + version );
- if ( siteUrl == null )
- {
+ String siteUrl = sites.get(cli.getArtifactId());
+ if (siteUrl == null) {
+ siteUrl = sites.get(cli.getArtifactId() + ':' + version);
+ if (siteUrl == null) {
siteUrl = artifactProject.getUrl();
}
}
- result.setUrl( siteUrl );
- Document doc = JsoupRetry.get( siteUrl );
- for ( HTMLChecker c : checkers )
- {
- result.getCheckMap().put( c, c.isDisplayedArtifactVersionOk( doc, version ) );
+ result.setUrl(siteUrl);
+ Document doc = JsoupRetry.get(siteUrl);
+ for (HTMLChecker c : checkers) {
+ result.getCheckMap().put(c, c.isDisplayedArtifactVersionOk(doc, version));
}
- result.setDocument( doc );
+ result.setDocument(doc);
+ } catch (HttpStatusException hes) {
+ addErrorLine(
+ cli,
+ version,
+ ignoreSiteFailures,
+ "HTTP result code: " + hes.getStatusCode() + " for " + cli.getArtifactId() + " site = "
+ + hes.getUrl());
+ result.setHTTPErrorUrl(hes.getStatusCode());
+ } catch (Exception ex) {
+ // continue for other artifact
+ getLog().error(ex.getMessage() + cli.getArtifactId());
}
- catch ( HttpStatusException hes )
- {
- addErrorLine( cli,
- version,
- ignoreSiteFailures,
- "HTTP result code: " + hes.getStatusCode() + " for " + cli.getArtifactId() + " site = "
- + hes.getUrl() );
- result.setHTTPErrorUrl( hes.getStatusCode() );
- }
- catch ( Exception ex )
- {
- //continue for other artifact
- getLog().error( ex.getMessage() + cli.getArtifactId() );
- }
-
}
/** {@inheritDoc} */
@Override
- protected void checkArtifact( ConfigurationLineInfo configLine, String latestVersion )
- throws MojoExecutionException
- {
- checkSite( configLine, latestVersion );
+ protected void checkArtifact(ConfigurationLineInfo configLine, String latestVersion) throws MojoExecutionException {
+ checkSite(configLine, latestVersion);
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/site/HTMLChecker.java b/src/main/java/org/apache/maven/dist/tools/site/HTMLChecker.java
index 62875dd..9d3cb0e 100644
--- a/src/main/java/org/apache/maven/dist/tools/site/HTMLChecker.java
+++ b/src/main/java/org/apache/maven/dist/tools/site/HTMLChecker.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.site;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.site;
import org.jsoup.nodes.Document;
@@ -26,8 +25,7 @@
*
* @author skygo
*/
-public interface HTMLChecker
-{
+public interface HTMLChecker {
/**
* name of the checker.
@@ -50,6 +48,5 @@
* @param version version to check against
* @return true if version is found
*/
- boolean isDisplayedArtifactVersionOk( Document doc, String version );
-
+ boolean isDisplayedArtifactVersionOk(Document doc, String version);
}
diff --git a/src/main/java/org/apache/maven/dist/tools/site/HTMLCheckerFactory.java b/src/main/java/org/apache/maven/dist/tools/site/HTMLCheckerFactory.java
index 7180625..20c38b5 100644
--- a/src/main/java/org/apache/maven/dist/tools/site/HTMLCheckerFactory.java
+++ b/src/main/java/org/apache/maven/dist/tools/site/HTMLCheckerFactory.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.site;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.site;
import java.util.LinkedList;
import java.util.List;
@@ -31,25 +30,20 @@
*
* @author skygo
*/
-public final class HTMLCheckerFactory
-{
+public final class HTMLCheckerFactory {
- private HTMLCheckerFactory()
- {
- }
+ private HTMLCheckerFactory() {}
/**
* get all checker
*
* @return list of checker
*/
- public static List<HTMLChecker> getCheckers()
- {
+ public static List<HTMLChecker> getCheckers() {
List<HTMLChecker> tmp = new LinkedList<>();
- tmp.add( new FluidoHTMLChecker() );
- tmp.add( new StylusRightHTMLChecker() );
- tmp.add( new StylusLeftHTMLChecker() );
+ tmp.add(new FluidoHTMLChecker());
+ tmp.add(new StylusRightHTMLChecker());
+ tmp.add(new StylusLeftHTMLChecker());
return tmp;
}
-
}
diff --git a/src/main/java/org/apache/maven/dist/tools/site/checkers/FluidoHTMLChecker.java b/src/main/java/org/apache/maven/dist/tools/site/checkers/FluidoHTMLChecker.java
index 7daeb76..32b0a4f 100644
--- a/src/main/java/org/apache/maven/dist/tools/site/checkers/FluidoHTMLChecker.java
+++ b/src/main/java/org/apache/maven/dist/tools/site/checkers/FluidoHTMLChecker.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.site.checkers;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.site.checkers;
import org.apache.maven.dist.tools.site.HTMLChecker;
import org.jsoup.nodes.Document;
@@ -28,34 +27,28 @@
*
* @author skygo
*/
-public class FluidoHTMLChecker implements HTMLChecker
-{
+public class FluidoHTMLChecker implements HTMLChecker {
/**
* Fluido Html Checker
*/
- public FluidoHTMLChecker()
- {
- }
+ public FluidoHTMLChecker() {}
/** {@inheritDoc} */
@Override
- public String getName()
- {
+ public String getName() {
return "Fluido";
}
/** {@inheritDoc} */
@Override
- public String getSkin()
- {
+ public String getSkin() {
return "Fluido";
}
/** {@inheritDoc} */
@Override
- public boolean isDisplayedArtifactVersionOk( Document doc, String version )
- {
- Element links = doc.select( "li#projectVersion" ).first();
- return ( links != null ) && links.text().contains( version );
+ public boolean isDisplayedArtifactVersionOk(Document doc, String version) {
+ Element links = doc.select("li#projectVersion").first();
+ return (links != null) && links.text().contains(version);
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/site/checkers/StylusLeftHTMLChecker.java b/src/main/java/org/apache/maven/dist/tools/site/checkers/StylusLeftHTMLChecker.java
index d0f69c0..850cc23 100644
--- a/src/main/java/org/apache/maven/dist/tools/site/checkers/StylusLeftHTMLChecker.java
+++ b/src/main/java/org/apache/maven/dist/tools/site/checkers/StylusLeftHTMLChecker.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.site.checkers;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.site.checkers;
import org.apache.maven.dist.tools.site.HTMLChecker;
import org.jsoup.nodes.Document;
@@ -28,35 +27,29 @@
*
* @author skygo
*/
-public class StylusLeftHTMLChecker implements HTMLChecker
-{
+public class StylusLeftHTMLChecker implements HTMLChecker {
/**
* Stylus Left Html Checker
*/
- public StylusLeftHTMLChecker()
- {
- }
+ public StylusLeftHTMLChecker() {}
/** {@inheritDoc} */
@Override
- public String getName()
- {
+ public String getName() {
return "Stylus left side";
}
/** {@inheritDoc} */
@Override
- public String getSkin()
- {
+ public String getSkin() {
return "Stylus";
}
/** {@inheritDoc} */
@Override
- public boolean isDisplayedArtifactVersionOk( Document doc, String version )
- {
- Element links = doc.select( "div.xleft" ).first();
+ public boolean isDisplayedArtifactVersionOk(Document doc, String version) {
+ Element links = doc.select("div.xleft").first();
- return ( links != null ) && links.text().contains( version );
+ return (links != null) && links.text().contains(version);
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/site/checkers/StylusRightHTMLChecker.java b/src/main/java/org/apache/maven/dist/tools/site/checkers/StylusRightHTMLChecker.java
index a474f0d..4e735f1 100644
--- a/src/main/java/org/apache/maven/dist/tools/site/checkers/StylusRightHTMLChecker.java
+++ b/src/main/java/org/apache/maven/dist/tools/site/checkers/StylusRightHTMLChecker.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.site.checkers;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.site.checkers;
import org.apache.maven.dist.tools.site.HTMLChecker;
import org.jsoup.nodes.Document;
@@ -28,35 +27,29 @@
*
* @author skygo
*/
-public class StylusRightHTMLChecker implements HTMLChecker
-{
+public class StylusRightHTMLChecker implements HTMLChecker {
/**
* Stylus Right Html Checker
*/
- public StylusRightHTMLChecker()
- {
- }
+ public StylusRightHTMLChecker() {}
/** {@inheritDoc} */
@Override
- public String getName()
- {
+ public String getName() {
return "Stylus right side";
}
/** {@inheritDoc} */
@Override
- public String getSkin()
- {
+ public String getSkin() {
return "Stylus";
}
/** {@inheritDoc} */
@Override
- public boolean isDisplayedArtifactVersionOk( Document doc, String version )
- {
- Element links = doc.select( "div.xright" ).first();
+ public boolean isDisplayedArtifactVersionOk(Document doc, String version) {
+ Element links = doc.select("div.xright").first();
- return ( links != null ) && links.text().contains( version );
+ return (links != null) && links.text().contains(version);
}
}
diff --git a/src/main/java/org/apache/maven/dist/tools/source/CheckSourceReleaseResult.java b/src/main/java/org/apache/maven/dist/tools/source/CheckSourceReleaseResult.java
index 5d6d221..bfdf336 100644
--- a/src/main/java/org/apache/maven/dist/tools/source/CheckSourceReleaseResult.java
+++ b/src/main/java/org/apache/maven/dist/tools/source/CheckSourceReleaseResult.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.source;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,37 +16,32 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.source;
import java.util.List;
import org.apache.maven.dist.tools.AbstractCheckResult;
import org.apache.maven.dist.tools.ConfigurationLineInfo;
-class CheckSourceReleaseResult
- extends AbstractCheckResult
-{
+class CheckSourceReleaseResult extends AbstractCheckResult {
List<String> central;
List<String> dist;
List<String> distOlder;
- CheckSourceReleaseResult( ConfigurationLineInfo r, String version )
- {
- super( r, version );
+ CheckSourceReleaseResult(ConfigurationLineInfo r, String version) {
+ super(r, version);
}
- void setMissingDistSourceRelease( List<String> checkRepos )
- {
+ void setMissingDistSourceRelease(List<String> checkRepos) {
dist = checkRepos;
}
- void setMissingCentralSourceRelease( List<String> checkRepos )
- {
+ void setMissingCentralSourceRelease(List<String> checkRepos) {
central = checkRepos;
}
- void setDistOlderSourceRelease( List<String> checkRepos )
- {
+ void setDistOlderSourceRelease(List<String> checkRepos) {
distOlder = checkRepos;
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/apache/maven/dist/tools/source/DistCheckSourceReleaseReport.java b/src/main/java/org/apache/maven/dist/tools/source/DistCheckSourceReleaseReport.java
index 53279db..1d296df 100644
--- a/src/main/java/org/apache/maven/dist/tools/source/DistCheckSourceReleaseReport.java
+++ b/src/main/java/org/apache/maven/dist/tools/source/DistCheckSourceReleaseReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.dist.tools.source;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.dist.tools.source;
import java.io.IOException;
import java.util.ArrayList;
@@ -47,10 +46,8 @@
*
* @author skygo
*/
-@Mojo( name = "check-source-release", requiresProject = false )
-public class DistCheckSourceReleaseReport
- extends AbstractDistCheckReport
-{
+@Mojo(name = "check-source-release", requiresProject = false)
+public class DistCheckSourceReleaseReport extends AbstractDistCheckReport {
private static final String NOT_IN_DISTRIBUTION_AREA = "_not_in_distribution_area_";
/** Constant <code>FAILURES_FILENAME="check-source-release.log"</code> */
@@ -59,14 +56,11 @@
/**
* Dist Check Source Release Report
*/
- public DistCheckSourceReleaseReport()
- {
- }
+ public DistCheckSourceReleaseReport() {}
/** {@inheritDoc} */
@Override
- protected boolean isIndexPageCheck()
- {
+ protected boolean isIndexPageCheck() {
return false;
}
@@ -81,29 +75,25 @@
*
* @return a {@link java.lang.String} object
*/
- protected String getFailuresFilename()
- {
+ protected String getFailuresFilename() {
return FAILURES_FILENAME;
}
/** {@inheritDoc} */
@Override
- public String getName( Locale locale )
- {
+ public String getName(Locale locale) {
return "Dist Tool> Check Source Release";
}
/** {@inheritDoc} */
@Override
- public String getDescription( Locale locale )
- {
+ public String getDescription(Locale locale) {
return "Verification of source release";
}
private final List<CheckSourceReleaseResult> results = new LinkedList<>();
- private static class DirectoryStatistics
- {
+ private static class DirectoryStatistics {
final String directory;
final String groupId;
@@ -118,147 +108,126 @@
int distOlder = 0;
- private DirectoryStatistics( String directory, String groupId )
- {
+ private DirectoryStatistics(String directory, String groupId) {
this.directory = directory;
this.groupId = groupId;
}
- public boolean contains( CheckSourceReleaseResult csrr )
- {
- return csrr.getConfigurationLine().getDirectory().equals( directory );
+ public boolean contains(CheckSourceReleaseResult csrr) {
+ return csrr.getConfigurationLine().getDirectory().equals(directory);
}
- public void addArtifact( CheckSourceReleaseResult result )
- {
+ public void addArtifact(CheckSourceReleaseResult result) {
artifactsCount++;
- if ( !result.central.isEmpty() )
- {
+ if (!result.central.isEmpty()) {
centralMissing++;
}
- if ( result.dist == null )
- {
+ if (result.dist == null) {
return;
}
- if ( !result.dist.isEmpty() || !result.distOlder.isEmpty() )
- {
+ if (!result.dist.isEmpty() || !result.distOlder.isEmpty()) {
distError++;
}
- if ( !result.dist.isEmpty() )
- {
+ if (!result.dist.isEmpty()) {
distMissing++;
}
- if ( !result.distOlder.isEmpty() )
- {
+ if (!result.distOlder.isEmpty()) {
distOlder++;
}
}
}
- private void reportLine( Sink sink, CheckSourceReleaseResult csrr )
- {
+ private void reportLine(Sink sink, CheckSourceReleaseResult csrr) {
ConfigurationLineInfo cli = csrr.getConfigurationLine();
sink.tableRow();
sink.tableCell();
- sink.anchor( cli.getArtifactId() );
- sink.rawText( cli.getArtifactId() );
+ sink.anchor(cli.getArtifactId());
+ sink.rawText(cli.getArtifactId());
sink.anchor_();
sink.tableCell_();
// LATEST column
sink.tableCell();
- sink.link( cli.getMetadataFileURL( repoBaseUrl ) );
- sink.rawText( csrr.getVersion() );
+ sink.link(cli.getMetadataFileURL(repoBaseUrl));
+ sink.rawText(csrr.getVersion());
sink.link_();
sink.tableCell_();
// DATE column
sink.tableCell();
- sink.rawText( cli.getReleaseDateFromMetadata() );
+ sink.rawText(cli.getReleaseDateFromMetadata());
sink.tableCell_();
// dist column
sink.tableCell();
- if ( csrr.dist != null )
- {
- if ( cli.isSrcBin() )
- {
+ if (csrr.dist != null) {
+ if (cli.isSrcBin()) {
String directory = csrr.getVersion() + "/source/";
- sink.link( distributionAreaUrl + cli.getDirectory() + '/' + directory );
- sink.text( directory );
+ sink.link(distributionAreaUrl + cli.getDirectory() + '/' + directory);
+ sink.text(directory);
sink.link_();
}
- if ( csrr.dist.isEmpty() && csrr.distOlder.isEmpty() )
- {
- sink.text( cli.getSourceReleaseFilename( csrr.getVersion(), true ) );
- iconSuccess( sink );
+ if (csrr.dist.isEmpty() && csrr.distOlder.isEmpty()) {
+ sink.text(cli.getSourceReleaseFilename(csrr.getVersion(), true));
+ iconSuccess(sink);
}
StringBuilder cliMissing = new StringBuilder();
- for ( String missing : csrr.dist )
- {
+ for (String missing : csrr.dist) {
sink.lineBreak();
- iconError( sink );
- sink.rawText( missing );
- if ( !csrr.central.contains( missing ) )
- {
+ iconError(sink);
+ sink.rawText(missing);
+ if (!csrr.central.contains(missing)) {
// if the release distribution is in central repository, we can get it from there...
- cliMissing.append( "\nwget " );
- cliMissing.append( cli.getVersionnedFolderURL( repoBaseUrl, csrr.getVersion() ) );
- cliMissing.append( missing );
- cliMissing.append( "\nsvn add " ).append( missing );
+ cliMissing.append("\nwget ");
+ cliMissing.append(cli.getVersionnedFolderURL(repoBaseUrl, csrr.getVersion()));
+ cliMissing.append(missing);
+ cliMissing.append("\nsvn add ").append(missing);
}
}
- if ( !cliMissing.toString().isEmpty() )
- {
+ if (!cliMissing.toString().isEmpty()) {
sink.lineBreak();
SinkEventAttributeSet atts = new SinkEventAttributeSet();
- sink.unknown( "pre", new Object[] { new Integer( HtmlMarkup.TAG_TYPE_START ) }, atts );
- sink.text( cliMissing.toString() );
- sink.unknown( "pre", new Object[] { new Integer( HtmlMarkup.TAG_TYPE_END ) }, null );
+ sink.unknown("pre", new Object[] {new Integer(HtmlMarkup.TAG_TYPE_START)}, atts);
+ sink.text(cliMissing.toString());
+ sink.unknown("pre", new Object[] {new Integer(HtmlMarkup.TAG_TYPE_END)}, null);
}
StringBuilder cliOlder = new StringBuilder();
- for ( String missing : csrr.distOlder )
- {
+ for (String missing : csrr.distOlder) {
sink.lineBreak();
- iconRemove( sink );
- sink.rawText( missing );
- cliOlder.append( "\nsvn rm " ).append( missing );
+ iconRemove(sink);
+ sink.rawText(missing);
+ cliOlder.append("\nsvn rm ").append(missing);
}
- if ( !cliOlder.toString().isEmpty() )
- {
+ if (!cliOlder.toString().isEmpty()) {
sink.lineBreak();
SinkEventAttributeSet atts = new SinkEventAttributeSet();
- sink.unknown( "pre", new Object[] { new Integer( HtmlMarkup.TAG_TYPE_START ) }, atts );
- sink.text( cliOlder.toString() );
- sink.unknown( "pre", new Object[] { new Integer( HtmlMarkup.TAG_TYPE_END ) }, null );
+ sink.unknown("pre", new Object[] {new Integer(HtmlMarkup.TAG_TYPE_START)}, atts);
+ sink.text(cliOlder.toString());
+ sink.unknown("pre", new Object[] {new Integer(HtmlMarkup.TAG_TYPE_END)}, null);
}
}
// central column
sink.tableCell();
- sink.link( cli.getBaseURL( repoBaseUrl, "" ) );
- sink.text( "<artifactId>" );
+ sink.link(cli.getBaseURL(repoBaseUrl, ""));
+ sink.text("<artifactId>");
sink.link_();
- sink.text( "/" );
- sink.link( cli.getVersionnedFolderURL( repoBaseUrl, csrr.getVersion() ) );
- sink.text( csrr.getVersion() );
+ sink.text("/");
+ sink.link(cli.getVersionnedFolderURL(repoBaseUrl, csrr.getVersion()));
+ sink.text(csrr.getVersion());
sink.link_();
- sink.text( "/(source-release)" );
- if ( csrr.central.isEmpty() )
- {
- iconSuccess( sink );
+ sink.text("/(source-release)");
+ if (csrr.central.isEmpty()) {
+ iconSuccess(sink);
+ } else {
+ iconWarning(sink);
}
- else
- {
- iconWarning( sink );
- }
- for ( String missing : csrr.central )
- {
+ for (String missing : csrr.central) {
sink.lineBreak();
- iconError( sink );
- sink.rawText( missing );
+ iconError(sink);
+ sink.rawText(missing);
}
sink.tableCell_();
@@ -268,109 +237,100 @@
/** {@inheritDoc} */
@Override
- protected void executeReport( Locale locale )
- throws MavenReportException
- {
- if ( !outputDirectory.exists() )
- {
+ protected void executeReport(Locale locale) throws MavenReportException {
+ if (!outputDirectory.exists()) {
outputDirectory.mkdirs();
}
- try
- {
+ try {
this.execute();
- }
- catch ( MojoExecutionException ex )
- {
- throw new MavenReportException( ex.getMessage(), ex );
+ } catch (MojoExecutionException ex) {
+ throw new MavenReportException(ex.getMessage(), ex);
}
- DirectoryStatistics stats = new DirectoryStatistics( "", "org.apache.maven" ); // global stats
+ DirectoryStatistics stats = new DirectoryStatistics("", "org.apache.maven"); // global stats
List<DirectoryStatistics> statistics = new ArrayList<>();
DirectoryStatistics current = null;
- for ( CheckSourceReleaseResult csrr : results )
- {
- if ( ( current == null ) || !current.contains( csrr ) )
- {
- current = new DirectoryStatistics( csrr.getConfigurationLine().getDirectory(),
- csrr.getConfigurationLine().getGroupId() );
- statistics.add( current );
+ for (CheckSourceReleaseResult csrr : results) {
+ if ((current == null) || !current.contains(csrr)) {
+ current = new DirectoryStatistics(
+ csrr.getConfigurationLine().getDirectory(),
+ csrr.getConfigurationLine().getGroupId());
+ statistics.add(current);
}
- current.addArtifact( csrr );
- stats.addArtifact( csrr );
+ current.addArtifact(csrr);
+ stats.addArtifact(csrr);
}
Sink sink = getSink();
sink.head();
sink.title();
- sink.text( "Check source release" );
+ sink.text("Check source release");
sink.title_();
sink.head_();
sink.body();
sink.section1();
sink.paragraph();
- sink.text( "Check Source Release"
- + " (= <artifactId>-<version>-source-release.zip + .asc + .sha1 or .sha512) availability in:" );
+ sink.text("Check Source Release"
+ + " (= <artifactId>-<version>-source-release.zip + .asc + .sha1 or .sha512) availability in:");
sink.paragraph_();
sink.list();
sink.listItem();
- sink.text( "Apache Maven distribution area: " );
- sink.link( distributionAreaUrl );
- sink.text( distributionAreaUrl );
+ sink.text("Apache Maven distribution area: ");
+ sink.link(distributionAreaUrl);
+ sink.text(distributionAreaUrl);
sink.link_();
sink.listItem_();
sink.listItem();
- sink.text( "Maven central repository: " );
- sink.link( repoBaseUrl );
- sink.text( repoBaseUrl );
+ sink.text("Maven central repository: ");
+ sink.link(repoBaseUrl);
+ sink.text(repoBaseUrl);
sink.link_();
sink.listItem_();
sink.list_();
sink.paragraph();
- sink.text( "Older artifacts exploration is Work In Progress..." );
+ sink.text("Older artifacts exploration is Work In Progress...");
sink.paragraph_();
sink.section1_();
sink.table();
sink.tableRow();
sink.tableHeaderCell();
- sink.rawText( "groupId/artifactId: " + String.valueOf( stats.artifactsCount ) );
+ sink.rawText("groupId/artifactId: " + String.valueOf(stats.artifactsCount));
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.rawText( "LATEST" );
+ sink.rawText("LATEST");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.rawText( "DATE" );
+ sink.rawText("DATE");
sink.tableHeaderCell_();
- reportStatisticsHeader( stats, sink );
+ reportStatisticsHeader(stats, sink);
sink.tableRow_();
Iterator<DirectoryStatistics> dirs = statistics.iterator();
current = null;
- for ( CheckSourceReleaseResult csrr : results )
- {
- if ( ( current == null ) || !current.contains( csrr ) )
- {
+ for (CheckSourceReleaseResult csrr : results) {
+ if ((current == null) || !current.contains(csrr)) {
current = dirs.next();
sink.tableRow();
sink.tableHeaderCell();
// shorten groupid
- sink.rawText( csrr.getConfigurationLine().getGroupId().replaceAll( "org.apache.maven", "o.a.m" ) + ": "
- + String.valueOf( current.artifactsCount ) );
+ sink.rawText(csrr.getConfigurationLine().getGroupId().replaceAll("org.apache.maven", "o.a.m") + ": "
+ + String.valueOf(current.artifactsCount));
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.rawText( " " );
+ sink.rawText(" ");
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.rawText( " " );
+ sink.rawText(" ");
sink.tableHeaderCell_();
- reportStatisticsHeader( current, sink );
+ reportStatisticsHeader(current, sink);
sink.tableRow_();
}
- reportLine( sink, csrr );
+ reportLine(sink, csrr);
}
sink.table_();
@@ -379,37 +339,33 @@
sink.close();
}
- private void reportStatisticsHeader( DirectoryStatistics current, Sink sink )
- {
+ private void reportStatisticsHeader(DirectoryStatistics current, Sink sink) {
sink.tableHeaderCell();
- if ( !NOT_IN_DISTRIBUTION_AREA.equals( current.directory ) )
- {
- sink.link( distributionAreaUrl + current.directory );
- sink.text( "<dist-area>/" + current.directory );
+ if (!NOT_IN_DISTRIBUTION_AREA.equals(current.directory)) {
+ sink.link(distributionAreaUrl + current.directory);
+ sink.text("<dist-area>/" + current.directory);
sink.link_();
- sink.rawText( ": " + String.valueOf( current.artifactsCount - current.distError ) );
- iconSuccess( sink );
- if ( current.distError > 0 )
- {
- sink.rawText( "/" + String.valueOf( current.distError ) );
- iconWarning( sink );
- sink.rawText( "= " + String.valueOf( current.distMissing ) );
- iconError( sink );
- sink.rawText( "/" + String.valueOf( current.distOlder ) );
- iconRemove( sink );
+ sink.rawText(": " + String.valueOf(current.artifactsCount - current.distError));
+ iconSuccess(sink);
+ if (current.distError > 0) {
+ sink.rawText("/" + String.valueOf(current.distError));
+ iconWarning(sink);
+ sink.rawText("= " + String.valueOf(current.distMissing));
+ iconError(sink);
+ sink.rawText("/" + String.valueOf(current.distOlder));
+ iconRemove(sink);
}
}
sink.tableHeaderCell_();
sink.tableHeaderCell();
- sink.link( repoBaseUrl + current.groupId.replace( '.', '/' ) );
- sink.text( "<central>/" + current.groupId.replace( '.', '/' ).replace( "org/apache/maven", "o/a/m" ) );
+ sink.link(repoBaseUrl + current.groupId.replace('.', '/'));
+ sink.text("<central>/" + current.groupId.replace('.', '/').replace("org/apache/maven", "o/a/m"));
sink.link_();
- sink.rawText( ": " + String.valueOf( current.artifactsCount - current.centralMissing ) );
- iconSuccess( sink );
- if ( current.centralMissing > 0 )
- {
- sink.rawText( "/" + String.valueOf( current.centralMissing ) );
- iconWarning( sink );
+ sink.rawText(": " + String.valueOf(current.artifactsCount - current.centralMissing));
+ iconSuccess(sink);
+ if (current.centralMissing > 0) {
+ sink.rawText("/" + String.valueOf(current.centralMissing));
+ iconWarning(sink);
}
sink.tableHeaderCell_();
}
@@ -420,8 +376,7 @@
* @param artifact artifact name
* @return regex
*/
- protected static String getSourceReleasePattern( String artifact )
- {
+ protected static String getSourceReleasePattern(String artifact) {
/// not the safest
return "^" + artifact + "-[0-9].*source-release.*$";
}
@@ -430,67 +385,52 @@
private Document cachedDocument;
- private Document read( String url )
- throws IOException
- {
- if ( url.startsWith( distributionAreaUrl ) )
- {
+ private Document read(String url) throws IOException {
+ if (url.startsWith(distributionAreaUrl)) {
// distribution area: cache content, since it is read multiple times
- if ( !url.equals( cachedUrl ) )
- {
+ if (!url.equals(cachedUrl)) {
cachedUrl = url;
- cachedDocument = JsoupRetry.get( url );
+ cachedDocument = JsoupRetry.get(url);
}
return cachedDocument;
- }
- else
- {
- return JsoupRetry.get( url );
+ } else {
+ return JsoupRetry.get(url);
}
}
- private Elements selectLinks( String repourl )
- throws IOException
- {
- try
- {
- return read( repourl ).select( "a[href]" );
- }
- catch ( IOException ioe )
- {
- throw new IOException( "IOException while reading " + repourl, ioe );
+ private Elements selectLinks(String repourl) throws IOException {
+ try {
+ return read(repourl).select("a[href]");
+ } catch (IOException ioe) {
+ throw new IOException("IOException while reading " + repourl, ioe);
}
}
- private List<String> checkContainsOld( String url, ConfigurationLineInfo cli, String version )
- throws IOException
- {
- Elements links = selectLinks( url );
+ private List<String> checkContainsOld(String url, ConfigurationLineInfo cli, String version) throws IOException {
+ Elements links = selectLinks(url);
- String sourceReleaseFilename = cli.getSourceReleaseFilename( version, true );
+ String sourceReleaseFilename = cli.getSourceReleaseFilename(version, true);
List<String> retrievedOldFiles = new LinkedList<>();
- for ( Element e : links )
- {
- String art = e.attr( "href" );
- if ( art.matches( getSourceReleasePattern( cli.getArtifactId() ) ) )
- {
- String retrievedFile = e.attr( "href" );
- if ( ! retrievedFile.startsWith( sourceReleaseFilename ) )
- {
- retrievedOldFiles.add( retrievedFile );
+ for (Element e : links) {
+ String art = e.attr("href");
+ if (art.matches(getSourceReleasePattern(cli.getArtifactId()))) {
+ String retrievedFile = e.attr("href");
+ if (!retrievedFile.startsWith(sourceReleaseFilename)) {
+ retrievedOldFiles.add(retrievedFile);
}
}
}
- if ( !retrievedOldFiles.isEmpty() )
- {
+ if (!retrievedOldFiles.isEmpty()) {
// write the following output in red so it's more readable in jenkins console
- addErrorLine( cli, version, ignoreDistFailures, "Different version than " + version + " for "
- + cli.getArtifactId() + " available in " + url );
- for ( String sourceItem : retrievedOldFiles )
- {
- addErrorLine( cli, version, ignoreDistFailures, " > " + sourceItem + " <" );
+ addErrorLine(
+ cli,
+ version,
+ ignoreDistFailures,
+ "Different version than " + version + " for " + cli.getArtifactId() + " available in " + url);
+ for (String sourceItem : retrievedOldFiles) {
+ addErrorLine(cli, version, ignoreDistFailures, " > " + sourceItem + " <");
}
}
@@ -499,56 +439,48 @@
/**
* Check that url points to a directory index containing expected release files
- *
+ *
* @param url
* @param cli
* @param version
* @return missing files
* @throws IOException
*/
- private List<String> checkDirectoryIndex( String url, ConfigurationLineInfo cli, String version, boolean dist )
- throws IOException
- {
+ private List<String> checkDirectoryIndex(String url, ConfigurationLineInfo cli, String version, boolean dist)
+ throws IOException {
Set<String> retrievedFiles = new HashSet<>();
- Elements links = selectLinks( url );
- for ( Element e : links )
- {
- retrievedFiles.add( e.attr( "href" ) );
+ Elements links = selectLinks(url);
+ for (Element e : links) {
+ retrievedFiles.add(e.attr("href"));
}
- String sourceReleaseFilename = cli.getSourceReleaseFilename( version, dist );
+ String sourceReleaseFilename = cli.getSourceReleaseFilename(version, dist);
List<String> missingFiles = new ArrayList<>();
// require source release file
- if ( !retrievedFiles.contains( sourceReleaseFilename ) )
- {
- missingFiles.add( sourceReleaseFilename );
+ if (!retrievedFiles.contains(sourceReleaseFilename)) {
+ missingFiles.add(sourceReleaseFilename);
}
// require source release file signature (.asc)
- if ( !retrievedFiles.contains( sourceReleaseFilename + ".asc" ) )
- {
- missingFiles.add( sourceReleaseFilename + ".asc" );
+ if (!retrievedFiles.contains(sourceReleaseFilename + ".asc")) {
+ missingFiles.add(sourceReleaseFilename + ".asc");
}
// require source release file checksum (.sha1 or .sha512)
- if ( !( retrievedFiles.contains( sourceReleaseFilename + ".sha1" )
- || retrievedFiles.contains( sourceReleaseFilename + ".sha512" ) ) )
- {
- missingFiles.add( sourceReleaseFilename + ".sha1 or .sha512" );
+ if (!(retrievedFiles.contains(sourceReleaseFilename + ".sha1")
+ || retrievedFiles.contains(sourceReleaseFilename + ".sha512"))) {
+ missingFiles.add(sourceReleaseFilename + ".sha1 or .sha512");
}
- if ( !missingFiles.isEmpty() )
- {
- boolean error = addErrorLine( cli, version, ignoreDistFailures,
- "Missing file for " + cli.getArtifactId() + " in " + url );
- for ( String sourceItem : missingFiles )
- {
- addErrorLine( cli, version, ignoreDistFailures, " > " + sourceItem + " <" );
+ if (!missingFiles.isEmpty()) {
+ boolean error = addErrorLine(
+ cli, version, ignoreDistFailures, "Missing file for " + cli.getArtifactId() + " in " + url);
+ for (String sourceItem : missingFiles) {
+ addErrorLine(cli, version, ignoreDistFailures, " > " + sourceItem + " <");
}
- if ( error )
- {
- getLog().warn( "==> when reading " + url + " got following hrefs: " + retrievedFiles );
- getLog().warn( url + " = " + read( url ) );
+ if (error) {
+ getLog().warn("==> when reading " + url + " got following hrefs: " + retrievedFiles);
+ getLog().warn(url + " = " + read(url));
}
}
@@ -557,33 +489,28 @@
/** {@inheritDoc} */
@Override
- protected void checkArtifact( ConfigurationLineInfo configLine, String version )
- throws MojoExecutionException
- {
- try
- {
- CheckSourceReleaseResult result = new CheckSourceReleaseResult( configLine, version );
- results.add( result );
+ protected void checkArtifact(ConfigurationLineInfo configLine, String version) throws MojoExecutionException {
+ try {
+ CheckSourceReleaseResult result = new CheckSourceReleaseResult(configLine, version);
+ results.add(result);
// central
- String centralUrl = configLine.getVersionnedFolderURL( repoBaseUrl, version );
- result.setMissingCentralSourceRelease( checkDirectoryIndex( centralUrl, configLine, version, false ) );
+ String centralUrl = configLine.getVersionnedFolderURL(repoBaseUrl, version);
+ result.setMissingCentralSourceRelease(checkDirectoryIndex(centralUrl, configLine, version, false));
- if ( NOT_IN_DISTRIBUTION_AREA.equals( configLine.getDirectory() ) )
- {
+ if (NOT_IN_DISTRIBUTION_AREA.equals(configLine.getDirectory())) {
// no distribution check
return;
}
// dist
- String distUrl = distributionAreaUrl + configLine.getDirectory()
- + ( configLine.isSrcBin() ? ( "/" + version + "/source" ) : "" );
- result.setMissingDistSourceRelease( checkDirectoryIndex( distUrl, configLine, version, true ) );
- result.setDistOlderSourceRelease( checkContainsOld( distUrl, configLine, version ) );
- }
- catch ( IOException ex )
- {
- throw new MojoExecutionException( ex.getMessage(), ex );
+ String distUrl = distributionAreaUrl
+ + configLine.getDirectory()
+ + (configLine.isSrcBin() ? ("/" + version + "/source") : "");
+ result.setMissingDistSourceRelease(checkDirectoryIndex(distUrl, configLine, version, true));
+ result.setDistOlderSourceRelease(checkContainsOld(distUrl, configLine, version));
+ } catch (IOException ex) {
+ throw new MojoExecutionException(ex.getMessage(), ex);
}
}
}
diff --git a/src/test/java/org/apache/maven/dist/tools/site/SiteReportTest.java b/src/test/java/org/apache/maven/dist/tools/site/SiteReportTest.java
index e08ad6b..9ebd8d2 100644
--- a/src/test/java/org/apache/maven/dist/tools/site/SiteReportTest.java
+++ b/src/test/java/org/apache/maven/dist/tools/site/SiteReportTest.java
@@ -1,22 +1,22 @@
-package org.apache.maven.dist.tools.site;
-
/*
- * Copyright 2013 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-
-import static org.junit.Assert.assertTrue;
+package org.apache.maven.dist.tools.site;
import java.io.IOException;
import java.io.InputStream;
@@ -25,25 +25,21 @@
import org.jsoup.nodes.Document;
import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+
/**
* SiteReportTest
*/
-public class SiteReportTest
-{
+public class SiteReportTest {
/**
* SiteReportTest
*/
- public SiteReportTest()
- {
- }
+ public SiteReportTest() {}
- private String readDocument( String resource )
- throws IOException
- {
- try ( InputStream in = getClass().getResourceAsStream( resource ) )
- {
- Document doc = Jsoup.parse( in, "UTF-8", "https://maven.apache.org/archetype/" );
- return CheckSiteResult.extractComment( doc );
+ private String readDocument(String resource) throws IOException {
+ try (InputStream in = getClass().getResourceAsStream(resource)) {
+ Document doc = Jsoup.parse(in, "UTF-8", "https://maven.apache.org/archetype/");
+ return CheckSiteResult.extractComment(doc);
}
}
@@ -53,11 +49,9 @@
* @throws IOException if the resource cannot be read
*/
@Test
- public void testFluidoSkin()
- throws IOException
- {
- String comment = readDocument( "fluido.html" );
- assertTrue( comment.contains( "Fluido" ) );
+ public void testFluidoSkin() throws IOException {
+ String comment = readDocument("fluido.html");
+ assertTrue(comment.contains("Fluido"));
}
/**
@@ -66,10 +60,8 @@
* @throws IOException if the resource cannot be read
*/
@Test
- public void testStylusRightSkin()
- throws IOException
- {
- String comment = readDocument( "stylus-right.html" );
- assertTrue( comment.contains( "Stylus" ) );
+ public void testStylusRightSkin() throws IOException {
+ String comment = readDocument("stylus-right.html");
+ assertTrue(comment.contains("Stylus"));
}
}
diff --git a/src/test/java/org/apache/maven/dist/tools/source/PatternTest.java b/src/test/java/org/apache/maven/dist/tools/source/PatternTest.java
index 96420ce..fac582f 100644
--- a/src/test/java/org/apache/maven/dist/tools/source/PatternTest.java
+++ b/src/test/java/org/apache/maven/dist/tools/source/PatternTest.java
@@ -1,67 +1,60 @@
+/*
+ * 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.apache.maven.dist.tools.source;
-/*
- * Copyright 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import org.apache.maven.dist.tools.source.DistCheckSourceReleaseReport;
-import org.junit.Test;
-
/**
* PatternTest
*
* @author skygo
*/
-public class PatternTest
-{
+public class PatternTest {
/**
* Test Pattern
*/
- public PatternTest()
- {
- }
+ public PatternTest() {}
/**
* Test of getGroupId method, of class ConfigurationLineInfo.
*/
@Test
- public void testGetGroupId()
- {
- String q = DistCheckSourceReleaseReport.getSourceReleasePattern( "doxia" );
+ public void testGetGroupId() {
+ String q = DistCheckSourceReleaseReport.getSourceReleasePattern("doxia");
- assertTrue( "doxia-1.4-source-release.zip.asc".matches( q ) );
- assertTrue( "doxia-1.4-source-release.zip.md5".matches( q ) );
- assertTrue( "doxia-1.4-source-release.zip".matches( q ) );
- assertFalse( "doxia-sitetools-1.4-source-release.zip.asc".matches( q ) );
- assertFalse( "doxia-sitetools-1.4-source-release.zip.md5".matches( q ) );
- assertFalse( "doxia-sitetools-1.4-source-release.zip".matches( q ) );
+ assertTrue("doxia-1.4-source-release.zip.asc".matches(q));
+ assertTrue("doxia-1.4-source-release.zip.md5".matches(q));
+ assertTrue("doxia-1.4-source-release.zip".matches(q));
+ assertFalse("doxia-sitetools-1.4-source-release.zip.asc".matches(q));
+ assertFalse("doxia-sitetools-1.4-source-release.zip.md5".matches(q));
+ assertFalse("doxia-sitetools-1.4-source-release.zip".matches(q));
- String r = DistCheckSourceReleaseReport.getSourceReleasePattern( "doxia-sitetools" );
+ String r = DistCheckSourceReleaseReport.getSourceReleasePattern("doxia-sitetools");
- assertFalse( "doxia-1.4-source-release.zip.asc".matches( r ) );
- assertFalse( "doxia-1.4-source-release.zip.md5".matches( r ) );
- assertFalse( "doxia-1.4-source-release.zip".matches( r ) );
- assertTrue( "doxia-sitetools-1.4-source-release.zip.asc".matches( r ) );
- assertTrue( "doxia-sitetools-1.4-source-release.zip.md5".matches( r ) );
- assertTrue( "doxia-sitetools-1.4-source-release.zip".matches( r ) );
+ assertFalse("doxia-1.4-source-release.zip.asc".matches(r));
+ assertFalse("doxia-1.4-source-release.zip.md5".matches(r));
+ assertFalse("doxia-1.4-source-release.zip".matches(r));
+ assertTrue("doxia-sitetools-1.4-source-release.zip.asc".matches(r));
+ assertTrue("doxia-sitetools-1.4-source-release.zip.md5".matches(r));
+ assertTrue("doxia-sitetools-1.4-source-release.zip".matches(r));
}
-
-
-
-
}