Author: skygo Date: Thu May 30 23:57:47 2013 New Revision: 1488062 URL: http://svn.apache.org/r1488062 Log: add possibility to ask for a list of request goals can report to web edit pom so dist-tool-plugin report on is on site with mvn clean install site
Added: maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/AbstractCheckResult.java (with props) Modified: maven/sandbox/trunk/dist-tools/dist-tool-plugin/pom.xml maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/AbstractDistCheckMojo.java maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSiteMojo.java maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSourceReleaseMojo.java Modified: maven/sandbox/trunk/dist-tools/dist-tool-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/dist-tools/dist-tool-plugin/pom.xml?rev=1488062&r1=1488061&r2=1488062&view=diff ============================================================================== --- maven/sandbox/trunk/dist-tools/dist-tool-plugin/pom.xml (original) +++ maven/sandbox/trunk/dist-tools/dist-tool-plugin/pom.xml Thu May 30 23:57:47 2013 @@ -24,18 +24,24 @@ <version>0.0.1-SNAPSHOT</version> <packaging>maven-plugin</packaging> <description>Dist tool plugin. - Not to be released.</description> + Not to be released.</description> + <prerequisites> + <maven>3.0.4</maven> + </prerequisites> + <dependencies> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> - <version>3.0.5</version> - <type>jar</type> - </dependency> + <version>${mvnversion}</version> + + </dependency> <dependency> <groupId>org.apache.maven.plugin-tools</groupId> <artifactId>maven-plugin-annotations</artifactId> <version>3.2</version> + <scope>provided</scope> + </dependency> <dependency> <groupId>org.jsoup</groupId> @@ -45,13 +51,68 @@ <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-core</artifactId> - <version>3.0.4</version> + <version>${mvnversion}</version> <type>jar</type> + + </dependency> + <dependency> + <groupId>org.apache.maven.reporting</groupId> + <artifactId>maven-reporting-impl</artifactId> + <version>2.2</version> + <type>jar</type> + <exclusions> + <exclusion> + <artifactId>maven-artifact</artifactId> + <groupId>org.apache.maven</groupId> + </exclusion> + <exclusion> + <artifactId>maven-model</artifactId> + <groupId>org.apache.maven</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-api</artifactId> + <version>0.9.0.M2</version> </dependency> + <dependency> + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-util</artifactId> + <version>0.9.0.M2</version> + + </dependency> + + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-aether-provider</artifactId> + <version>${mvnversion}</version> + + </dependency> + </dependencies> <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>3.3</version> + </plugin> + <plugin> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-maven-plugin</artifactId> + <version>1.4</version> + </plugin> + </plugins> + </pluginManagement> <plugins> <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>animal-sniffer-maven-plugin</artifactId> + <version>1.9</version> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-plugin-plugin</artifactId> <version>3.2</version> @@ -84,10 +145,33 @@ <source>1.7</source> </configuration> </plugin> + <plugin> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + <executions> + <execution> + <id>auto</id> + <phase>install</phase> + <goals> + <goal>check-site</goal> + <goal>check-source-release</goal> + </goals> + <configuration> + <configurationLines> + <configurationLine>org.apache.maven.indexer;maven-indexer;https://dist.apache.org/repos/dist/release/maven/indexer/</configurationLine> + <configurationLine>org.apache.maven.plugins;maven-ant-plugin;https://dist.apache.org/repos/dist/release/maven/plugins/</configurationLine> + </configurationLines> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> <properties> - <netbeans.checkstyle.format>true</netbeans.checkstyle.format> + <netbeans.checkstyle.format>true</netbeans.checkstyle.format> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <mvnversion>3.1-SNAPSHOT</mvnversion> </properties> <reporting> <plugins> @@ -96,20 +180,53 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jxr-plugin</artifactId> - <version>${jxrVersion}</version> + <version>2.3</version> <configuration> <aggregate>true</aggregate> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + <version>2.7</version> + <reportSets> + <reportSet> + <reports> + <report>index</report> + </reports> + </reportSet> + </reportSets> + + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.10</version> <configuration> <includeTestSourceDirectory>true</includeTestSourceDirectory> <configLocation>config/maven_checks.xml</configLocation> </configuration> + </plugin> + <plugin> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + <reportSets> + <reportSet> + <id>html</id> + <reports> + <report>check-site</report> + <report>check-source-release</report> + </reports> + </reportSet> + </reportSets> + <!-- <configuration> + <configurationLines> + <configurationLine>org.apache.maven.wagon;wagon;https://dist.apache.org/repos/dist/release/maven/wagon/</configurationLine> + </configurationLines> + </configuration> + --> </plugin> - </plugins> + </plugins> </reporting> </project> \ No newline at end of file Added: maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/AbstractCheckResult.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/AbstractCheckResult.java?rev=1488062&view=auto ============================================================================== --- maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/AbstractCheckResult.java (added) +++ maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/AbstractCheckResult.java Thu May 30 23:57:47 2013 @@ -0,0 +1,52 @@ +package org.apache.maven.dist.tools; +/* + * 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. + */ + +/** + * + * @author skygo + */ +class AbstractCheckResult +{ + + private final ConfigurationLineInfo configLine; + private final String version; + + AbstractCheckResult( ConfigurationLineInfo r, String version ) + { + this.configLine = r; + this.version = version; + } + + /** + * @return the r + */ + public ConfigurationLineInfo getConfigurationLine() + { + return configLine; + } + + /** + * @return the version + */ + public String getVersion() + { + return version; + } +} Propchange: maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/AbstractCheckResult.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/AbstractDistCheckMojo.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/AbstractDistCheckMojo.java?rev=1488062&r1=1488061&r2=1488062&view=diff ============================================================================== --- maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/AbstractDistCheckMojo.java (original) +++ maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/AbstractDistCheckMojo.java Thu May 30 23:57:47 2013 @@ -1,5 +1,4 @@ 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,63 +17,89 @@ package org.apache.maven.dist.tools; * specific language governing permissions and limitations * under the License. */ + import java.io.BufferedReader; +import java.io.File; import java.io.IOException; import java.io.InputStreamReader; -import java.net.URL; -import org.apache.maven.plugin.AbstractMojo; +import java.util.List; +import org.apache.maven.doxia.siterenderer.Renderer; + import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.apache.maven.reporting.AbstractMavenReport; /** * * @author skygo */ -public abstract class AbstractDistCheckMojo extends AbstractMojo +public abstract class AbstractDistCheckMojo extends AbstractMavenReport { - @Parameter( property = "repository.url", defaultValue = "http://repo1.maven.org/maven2/" ) - private String repoBaseUrl; - @Parameter( property = "database.url", defaultValue = "db/mavendb.csv" ) - private String dbLocation; + @Parameter( property = "repositoryUrl", defaultValue = "http://repo1.maven.org/maven2/" ) + protected String repoBaseUrl; + @Parameter( property = "configurationLines", defaultValue = "" ) + private List<String> configurationLines; abstract void checkArtifact( ConfigurationLineInfo request, String repoBase ) throws MojoExecutionException; + private static final String MAVEN_DB = "db/mavendb.csv"; + @Component + protected Renderer siteRenderer; + @Parameter( property = "project.reporting.outputDirectory", required = true ) + protected File outputDirectory; + @Component + protected MavenProject project; @Override - public void execute() throws MojoExecutionException, MojoFailureException + protected String getOutputDirectory() { - URL dbURL; - if ( dbLocation.equals( "db/mavendb.csv" ) ) - { - dbURL = Thread.currentThread().getContextClassLoader().getResource( "db/mavendb.csv" ); - } - else - { - throw new MojoFailureException( "Custom data not implemented " ); - } + return outputDirectory.getAbsolutePath(); + } + @Override + protected Renderer getSiteRenderer() + { + return siteRenderer; + } - try (BufferedReader input = new BufferedReader( new InputStreamReader( dbURL.openStream() ) )) + @Override + protected MavenProject getProject() + { + return project; + } + + @Override + public void execute() throws MojoExecutionException + { + if ( configurationLines.isEmpty() ) { - String text; - while ( (text = input.readLine()) != null ) + try (BufferedReader input = new BufferedReader( new InputStreamReader( Thread.currentThread().getContextClassLoader().getResource( MAVEN_DB ).openStream() ) )) { - if ( text.startsWith( "##" ) ) + String text; + while ( (text = input.readLine()) != null ) { - getLog().info( text ); + configurationLines.add( text ); } - else - { - String[] artifactInfo = text.split( ";" ); - checkArtifact( new ConfigurationLineInfo( artifactInfo[0], artifactInfo[1], artifactInfo[2] ), repoBaseUrl ); - } - + } + catch ( IOException ex ) + { + throw new MojoExecutionException( ex.getMessage(), ex ); } } - catch ( IOException ex ) + + for ( String line : configurationLines ) { - throw new MojoFailureException( ex.getMessage(), ex ); + if ( line.startsWith( "##" ) ) + { + getLog().info( line ); + } + else + { + String[] artifactInfo = line.split( ";" ); + checkArtifact( new ConfigurationLineInfo( artifactInfo[0], artifactInfo[1], artifactInfo[2] ), repoBaseUrl ); + } } } } Modified: maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSiteMojo.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSiteMojo.java?rev=1488062&r1=1488061&r2=1488062&view=diff ============================================================================== --- maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSiteMojo.java (original) +++ maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSiteMojo.java Thu May 30 23:57:47 2013 @@ -1,5 +1,4 @@ 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,26 +17,32 @@ package org.apache.maven.dist.tools; * specific language governing permissions and limitations * under the License. */ + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.util.Collections; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; +import java.util.Locale; +import java.util.Map; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; +import org.apache.maven.doxia.sink.Sink; import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.apache.maven.project.ProjectBuilder; +import org.apache.maven.reporting.MavenReportException; +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; @@ -49,6 +54,19 @@ import org.jsoup.nodes.Element; @Mojo( name = "check-site" ) public class DistCheckSiteMojo extends AbstractDistCheckMojo { +// common type for site checker + + @Component + private ProjectBuilder projectBuilder; + @Component + private RepositorySystem repoSystem; + /** + * The entry point to Aether, i.e. the component doing all the work. + * + * @parameter default-value="${repositorySystemSession}" + * @readonly + */ + private RepositorySystemSession repoSession; interface HTMLChecker { @@ -61,7 +79,7 @@ public class DistCheckSiteMojo extends A String getName(); /** - * true if checker find patter in document + * true if checker find pattern in document * * @param doc * @param version @@ -69,10 +87,148 @@ public class DistCheckSiteMojo extends A */ boolean isOk( Document doc, String version ); } + + class DistCheckSiteResult extends AbstractCheckResult + { + + private String url; + private Map<DistCheckSiteMojo.HTMLChecker, Boolean> checkMap = new HashMap<>(); + + public DistCheckSiteResult( ConfigurationLineInfo r, String version ) + { + super( r, version ); + } + + void setUrl( String url ) + { + this.url = url; + } + + /** + * @return the url + */ + public String getUrl() + { + return url; + } + + /** + * @return the checkMap + */ + public Map<DistCheckSiteMojo.HTMLChecker, Boolean> getCheckMap() + { + return checkMap; + } + } + // keep result + private List<DistCheckSiteResult> results = new LinkedList<>(); private List<HTMLChecker> checker = new LinkedList<>(); - private void checkSite( String repourl, ConfigurationLineInfo r, String version ) throws MojoExecutionException + @Override + protected void executeReport( Locale locale ) throws MavenReportException { + if ( !outputDirectory.exists() ) + { + outputDirectory.mkdirs(); + } + try + { + this.execute(); + } + catch ( MojoExecutionException ex ) + { + throw new MavenReportException( ex.getMessage(), ex ); + } + Sink sink = getSink(); + sink.head(); + sink.title(); + sink.text( "Check sites" ); + sink.title_(); + sink.head_(); + + sink.body(); + sink.section1(); + sink.rawText( "Checked sites" ); + sink.section1_(); + sink.table(); + sink.tableRow(); + sink.tableHeaderCell(); + sink.rawText( "groupId:artifactId (from conf file)" ); + sink.tableHeaderCell_(); + sink.tableHeaderCell(); + sink.rawText( "Latest version from metadata" ); + sink.tableHeaderCell_(); + sink.tableHeaderCell(); + sink.rawText( "URL" ); + sink.tableHeaderCell_(); + for ( HTMLChecker c : checker ) + { + sink.tableHeaderCell(); + sink.rawText( c.getName() ); + sink.tableHeaderCell_(); + } + + sink.tableRow_(); + for ( DistCheckSiteResult csr : results ) + { + sink.tableRow(); + sink.tableCell(); + sink.rawText( csr.getConfigurationLine().getGroupId() + ":" ); + sink.rawText( csr.getConfigurationLine().getArtifactId() ); + sink.tableCell_(); + sink.tableCell(); + sink.rawText( csr.getVersion() ); + sink.tableCell_(); + sink.tableCell(); + sink.rawText( csr.getUrl() ); + sink.tableCell_(); + for ( HTMLChecker c : checker ) + { + sink.tableCell(); + if ( csr.getCheckMap().get( c ) != null ) + { + sink.rawText( csr.getCheckMap().get( c ).toString() ); + } + else + { + sink.rawText( "Error" ); + } + + sink.tableCell_(); + } + sink.tableRow_(); + } + sink.table_(); + sink.body_(); + sink.flush(); + sink.close(); + } + + @Override + public String getOutputName() + { + return "check-siteOutputName"; + } + + @Override + public String getName( Locale locale ) + { + return "Check sites"; + } + + @Override + public String getDescription( Locale locale ) + { + return "check-siteDescription"; + } + /*@Component + private RepositorySystemSession repoSession; + */ + + private void checkSite( String repourl, ConfigurationLineInfo r, String version ) + { + DistCheckSiteResult result = new DistCheckSiteResult( r, version ); + results.add( result ); StringBuilder message = new StringBuilder(); try (BufferedReader input = new BufferedReader( new InputStreamReader( new URL( repourl ).openStream() ) )) { @@ -80,31 +236,40 @@ public class DistCheckSiteMojo extends A Model m = mavenreader.read( input ); // need to have parent information and resolve properties // - MavenProject project = new MavenProject( m ); - - - Document doc = Jsoup.connect( project.getUrl() ).get(); - message.append( "Site for " ).append( project.getArtifactId() ).append( " at " ).append( project.getUrl() ).append( " seek for" ).append( project.getVersion() ).append( " " ); + /* ModelBuildingRequest md = new DefaultModelBuildingRequest(); + md.setPomFile( outputDirectory ); + DefaultModelBuilder d = new DefaultModelBuilder(); + + + DefaultRepositorySystemSession repoSystem = new MavenRepositorySystemSession(); + DefaultProjectBuildingRequest req = new DefaultProjectBuildingRequest(); + //session. + req.setRepositorySession( repoSession ); + //session. + getLog().warn( "" + repoSession ); + + req.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_STRICT ); + ProjectBuildingResult res = projectBuilder.build( new UrlModelSource( new URL( repourl ) ), req );*/ + MavenProject projectc = new MavenProject( m );//res.getProject(); + + getLog().info( projectc.getUrl() + "+" + projectc.getProperties() ); + result.setUrl( projectc.getUrl() ); + Document doc = Jsoup.connect( projectc.getUrl() ).get(); + result.setUrl( projectc.getUrl() ); + message.append( "Site for " ).append( projectc.getArtifactId() ).append( " at " ).append( projectc.getUrl() ).append( " seek for" ).append( projectc.getVersion() ).append( " " ); for ( HTMLChecker c : checker ) { + result.getCheckMap().put( c, c.isOk( doc, version ) ); message.append( "[" ).append( c.getName() ).append( c.isOk( doc, version ) ).append( "]" ); } - getLog().warn( message.toString() ); } - catch ( MalformedURLException ex ) - { - throw new MojoExecutionException( ex.getMessage(), ex ); - } - catch ( IOException ex ) - { - throw new MojoExecutionException( ex.getMessage(), ex ); - } - catch ( XmlPullParserException ex ) + catch ( Exception ex ) { - Logger.getLogger( DistCheckSiteMojo.class.getName() ).log( Level.SEVERE, null, ex ); + //continue for other artifact + getLog().error( ex.getMessage() ); } } @@ -138,7 +303,7 @@ public class DistCheckSiteMojo extends A } @Override - public void execute() throws MojoExecutionException, MojoFailureException + public void execute() throws MojoExecutionException { //add html checker checker.add( new HTMLChecker() @@ -185,6 +350,6 @@ public class DistCheckSiteMojo extends A } } } ); - super.execute(); + super.execute(); } } Modified: maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSourceReleaseMojo.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSourceReleaseMojo.java?rev=1488062&r1=1488061&r2=1488062&view=diff ============================================================================== --- maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSourceReleaseMojo.java (original) +++ maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSourceReleaseMojo.java Thu May 30 23:57:47 2013 @@ -1,5 +1,4 @@ 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 +17,7 @@ package org.apache.maven.dist.tools; * specific language governing permissions and limitations * under the License. */ + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -26,11 +26,14 @@ import java.net.URL; import java.util.Collections; import java.util.LinkedList; import java.util.List; +import java.util.Locale; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; +import org.apache.maven.doxia.sink.Sink; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.reporting.MavenReportException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; @@ -47,7 +50,130 @@ public class DistCheckSourceReleaseMojo { //Artifact metadata retrieval done y hands. - private void checkRepos( String repourl, ConfigurationLineInfo r, String version ) throws IOException + class DistCheckSourceRelease extends AbstractCheckResult + { + + private List<String> central; + private List<String> dist; + + public DistCheckSourceRelease( ConfigurationLineInfo r, String version ) + { + super( r, version ); + } + + private void setMissingDistSourceRelease( List<String> checkRepos ) + { + dist = checkRepos; + } + + private void setMisingCentralSourceRelease( List<String> checkRepos ) + { + central = checkRepos; + } + } + private List<DistCheckSourceRelease> results = new LinkedList<>(); + + @Override + protected void executeReport( Locale locale ) throws MavenReportException + { + if ( !outputDirectory.exists() ) + { + outputDirectory.mkdirs(); + } + try + { + this.execute(); + } + catch ( MojoExecutionException ex ) + { + throw new MavenReportException( ex.getMessage(), ex ); + } + Sink sink = getSink(); + sink.head(); + sink.title(); + sink.text( "Check source release" ); + sink.title_(); + sink.head_(); + + sink.body(); + sink.section1(); + sink.rawText( "Missing Source Release (less you have better the result)" ); + sink.section1_(); + sink.table(); + sink.tableRow(); + sink.tableHeaderCell(); + sink.rawText( "groupId:artifactId (from conf file)" ); + sink.tableHeaderCell_(); + sink.tableHeaderCell(); + sink.rawText( "Latest version from metadata" ); + sink.tableHeaderCell_(); + sink.tableHeaderCell(); + sink.rawText( "Central " + repoBaseUrl ); + sink.tableHeaderCell_(); + sink.tableHeaderCell(); + sink.rawText( "Dist" ); + sink.tableHeaderCell_(); + sink.tableRow_(); + for ( DistCheckSourceRelease csr : results ) + { + sink.tableRow(); + sink.tableCell(); + sink.rawText( csr.getConfigurationLine().getGroupId() + ":" ); + sink.rawText( csr.getConfigurationLine().getArtifactId() ); + sink.tableCell_(); + sink.tableCell(); + sink.rawText( csr.getVersion() ); + sink.tableCell_(); + sink.tableCell(); + sink.bold(); + sink.lineBreak(); + for ( String missing : csr.central ) + { + sink.rawText( missing ); + sink.lineBreak(); + } + + sink.bold_(); + sink.tableCell_(); + sink.tableCell(); + sink.bold(); + sink.lineBreak(); + for ( String missing : csr.dist ) + { + sink.rawText( missing ); + sink.lineBreak(); + } + + sink.bold_(); + sink.tableCell_(); + + sink.tableRow_(); + } + sink.table_(); + sink.body_(); + sink.flush(); + sink.close(); + } + + @Override + public String getOutputName() + { + return "check-source-releaseOutputName"; + } + + @Override + public String getName( Locale locale ) + { + return "check-source-releaseName"; + } + + @Override + public String getDescription( Locale locale ) + { + return "check-source-releaseDescription"; + } + + private List<String> checkRepos( String repourl, ConfigurationLineInfo r, String version ) throws IOException { Document doc = Jsoup.connect( repourl ).get(); Elements links = doc.select( "a[href]" ); @@ -73,6 +199,7 @@ public class DistCheckSourceReleaseMojo getLog().error( "Missing:" + sourceItem + " in " + repourl ); } } + return expectedFile; } @Override @@ -88,11 +215,12 @@ public class DistCheckSourceReleaseMojo // revert sort versions (not handling alpha and complex vesion scheme but more usefull version are displayed left side Collections.sort( metadata.versioning.versions, Collections.reverseOrder() ); getLog().warn( metadata.versioning.versions + " version(s) detected " + repoBaseUrl ); - + DistCheckSourceRelease result = new DistCheckSourceRelease( r, metadata.versioning.latest ); + results.add( result ); // central - checkRepos( r.getVersionnedFolderURL( repoBaseUrl, metadata.versioning.latest ), r, metadata.versioning.latest ); + result.setMisingCentralSourceRelease( checkRepos( r.getVersionnedFolderURL( repoBaseUrl, metadata.versioning.latest ), r, metadata.versioning.latest ) ); //dist - checkRepos( r.getDist(), r, metadata.versioning.latest ); + result.setMissingDistSourceRelease( checkRepos( r.getDist(), r, metadata.versioning.latest ) ); } catch ( MalformedURLException ex ) {