stat-scm-developer Mailing List for Source Code Management Statistics Mojo
Brought to you by:
benoitx,
dougculnane
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Arsen <ars...@ar...> - 2008-07-03 06:12:02
|
Hi, Well I'm trying to use stat-scm 1.1.0 reporting plugin from maven to generate my project's site. I have 2 questions. 1. Why it generates some files into ${project.name}/target/generated-site/xdoc/statscm and not in ${project.name}/target/site/statscm and how can I configure it. 2. Why it generates some page files in xml format not in html (for access them from my project's site by clicking links) and how can I configure it And this is my pom.xml's reporting section <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.4</version> <configuration> <source>1.5</source> <doclet> gr.spinellis.umlgraph.doclet.UmlGraphDoc </doclet> <docletArtifact> <groupId>gr.spinellis</groupId> <artifactId>UmlGraph</artifactId> <version>4.4</version> </docletArtifact> <additionalparam> -inferrel -inferdep -hide java.* -collpackages java.util.* -attributes -operations -enumerations -enumconstants -visibility </additionalparam> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jxr-plugin</artifactId> <version>2.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> <version>2.4.3</version> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>taglist-maven-plugin</artifactId> <version>2.2</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> <version>2.4</version> <configuration> <targetJdk>1.5</targetJdk> </configuration> </plugin> <plugin> <groupId>net.sf</groupId> <artifactId>stat-scm</artifactId> <version>1.1.0</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.2</version> </plugin> </plugins> </reporting> Thanks, Arsen |
From: Doug C. <do...@cu...> - 2008-06-17 18:50:03
|
Thanks Martin, I have committed your patch and credited you with the change in the index.apt so it will appear in the new on the project site home page. Thanks again, Doug Martin Kalén wrote: > Greetings, > > Martin Kalén wrote: >> [...] StatSCM cannot handle POM overrides of the default build- and >> reporting output directories. >> >> (Ie ${project.build.directory} and ${project.reporting.outputDirectory}) > > Attached is the patch as per request. > > Tested/verified with a POM that overrides both build- and reporting > output directories (the "target" directory is not at all present). > > You might want to check coding conventions, run some additional tests > etc and tweak the patch to your liking. > > Best regards, > Martin > > P.S. If you need it: permission to use the attached code under the > Apache License Version 2.0 is hereby granted by me, Martin Kalén, the > sole author. > ------------------------------------------------------------------------ > > Index: src/test/java/net/sf/statscm/StatConfTest.java > =================================================================== > --- src/test/java/net/sf/statscm/StatConfTest.java (revision 165) > +++ src/test/java/net/sf/statscm/StatConfTest.java (working copy) > @@ -16,6 +16,7 @@ > * limitations under the License. > */ > > +import java.lang.reflect.Method; > import java.util.ArrayList; > import java.util.List; > import java.util.Locale; > @@ -25,6 +26,7 @@ > import org.apache.maven.model.Build; > import org.apache.maven.model.Developer; > import org.apache.maven.model.Model; > +import org.apache.maven.model.Reporting; > import org.apache.maven.model.Scm; > import org.apache.maven.model.IssueManagement; > import org.apache.maven.project.MavenProject; > @@ -77,7 +79,7 @@ > assertEquals( StatConf.CONNECTION_TYPE_SVN, > StatConf.extractConnectionType( "svn:https://svn.sourceforge.net/svnroot/stat-scm/trunk" ) ); > } > - > + > /** > * Test to make sure that null pointers are handled, and errors are throwen corectly. > * > @@ -142,7 +144,53 @@ > } > } > > + > /** > + * Regression test custom build- and report output paths in POM. > + */ > + public void testConfigureFromPOMWithCustomPaths() throws Exception > + { > + MavenProject project = new MavenProject( new Model() ); > + StatScmMojo statScmMojo = new StatScmMojo(); > + statScmMojo.setProject( project ); > + StatConf statConf = statScmMojo.getStatConf(); > + Scm scm = new Scm(); > + project.setScm( scm ); > + scm.setDeveloperConnection( "svn:https://svn.sourceforge.net/svnroot/stat-scm/trunk" ); > + statConf.configure( project, Locale.ENGLISH ); > + > + // Make protected method accessible for test purposes > + String getReportingTargetDirectoryMethodName = "getReportingTargetDirectory"; > + Method getReportingTargetDirectory = statScmMojo.getClass().getDeclaredMethod( getReportingTargetDirectoryMethodName, (Class []) null ); > + assertNotNull( "Test case must be updated with refactored method name in " + statScmMojo.getClass().getName(), > + getReportingTargetDirectory ); > + getReportingTargetDirectory.setAccessible( true ); > + > + assertNotNull( StatConf.getOutputDir() ); > + assertTrue( "Fall back behaviour failed", StatConf.getOutputDir().indexOf("target") != -1 ); > + > + String reportingTargetDirectory = (String) getReportingTargetDirectory.invoke( statScmMojo, (Object []) null ); > + assertNotNull( reportingTargetDirectory ); > + assertTrue( "Fall back behaviour failed", reportingTargetDirectory.indexOf("target") != -1 ); > + > + String customBuildDirectory = "build"; > + Build build = new Build(); > + build.setDirectory( customBuildDirectory ); > + project.setBuild( build ); > + statConf.configure( project, Locale.ENGLISH ); > + assertEquals( "Custom build directory configuration ignored", -1, StatConf.getOutputDir().indexOf("target") ); > + assertTrue( "Custom build directory configuration ignored", StatConf.getOutputDir().indexOf(customBuildDirectory) != -1 ); > + > + String customReportOutputDirectory = customBuildDirectory + System.getProperty( "file.separator" ) + "site"; > + Reporting reporting = new Reporting(); > + reporting.setOutputDirectory(customReportOutputDirectory); > + project.setReporting( reporting ); > + reportingTargetDirectory = (String) getReportingTargetDirectory.invoke( statScmMojo, (Object []) null ); > + assertEquals( "Custom report output directory configuration ignored", -1, reportingTargetDirectory.indexOf("target") ); > + assertTrue( "Custom report output directory configuration ignored", reportingTargetDirectory.indexOf(customReportOutputDirectory) != -1 ); > + } > + > + /** > * > * @throws ConfigurationException > */ > Index: src/main/java/net/sf/statscm/StatConf.java > =================================================================== > --- src/main/java/net/sf/statscm/StatConf.java (revision 165) > +++ src/main/java/net/sf/statscm/StatConf.java (working copy) > @@ -22,6 +22,7 @@ > import net.sf.statcvs.output.ConfigurationException; > import net.sf.statcvs.output.ConfigurationOptions; > > +import org.apache.maven.model.Build; > import org.apache.maven.model.Developer; > import org.apache.maven.project.MavenProject; > > @@ -104,7 +105,17 @@ > // Set output parameters. > setOutputFormat( "xdoc" ); > // ? setDefaultCssFile("maven2-xdoc.css"); > - setOutputDir( baseDirectory.getAbsolutePath() + FILE_SEPARATOR + "target" + FILE_SEPARATOR + "generated-site" > + String buildBaseDirectory = null; > + Build build = project.getBuild(); > + if ( build != null ) > + { > + buildBaseDirectory = build.getDirectory(); > + } > + if ( buildBaseDirectory == null ) > + { > + buildBaseDirectory = baseDirectory.getAbsolutePath() + FILE_SEPARATOR + "target"; > + } > + setOutputDir( buildBaseDirectory + FILE_SEPARATOR + "generated-site" > + FILE_SEPARATOR + "xdoc" + FILE_SEPARATOR + STATSCM_DIR_NAME ); > > // Set up connection type > Index: src/main/java/net/sf/statscm/StatScmMojo.java > =================================================================== > --- src/main/java/net/sf/statscm/StatScmMojo.java (revision 165) > +++ src/main/java/net/sf/statscm/StatScmMojo.java (working copy) > @@ -37,6 +37,7 @@ > import java.util.Locale; > import java.util.ResourceBundle; > > +import org.apache.maven.model.Reporting; > import org.apache.maven.project.MavenProject; > > /** > @@ -223,8 +224,7 @@ > doCvsStats(); > } > doGenerateReport( getSink() ); > - copyResourceFiles( getOutputDirectory(), project.getBasedir() + statConf.FILE_SEPARATOR + "target" > - + statConf.FILE_SEPARATOR + "site" + statConf.FILE_SEPARATOR + StatConf.STATSCM_DIR_NAME ); > + copyResourceFiles( getOutputDirectory(), getReportingTargetDirectory() ); > } > else > { > @@ -542,6 +542,28 @@ > } > > /** > + * Returns the StatSCM report target directory. > + * > + * @return Absolute path to the directory with final HTML result. > + */ > + protected String getReportingTargetDirectory() > + { > + String targetBaseDirectory = null; > + Reporting reporting = getProject().getReporting(); > + if ( reporting != null) > + { > + targetBaseDirectory = reporting.getOutputDirectory(); > + } > + if ( targetBaseDirectory == null) > + { > + targetBaseDirectory = getStatConf().getBaseDirectory().getAbsolutePath() > + + statConf.FILE_SEPARATOR + "target" > + + statConf.FILE_SEPARATOR + "site"; > + } > + return targetBaseDirectory + statConf.FILE_SEPARATOR + StatConf.STATSCM_DIR_NAME; > + } > + > + /** > * String name of the html file that the Reporting Menu uses for a link. > * > * @return Name of Html file to link to. > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > ------------------------------------------------------------------------ > > _______________________________________________ > Stat-scm-developer mailing list > Sta...@li... > https://lists.sourceforge.net/lists/listinfo/stat-scm-developer > |
From: Martin K. <mar...@cu...> - 2008-06-17 01:04:02
|
Greetings, Martin Kalén wrote: > [...] StatSCM cannot handle > POM overrides of the default build- and reporting output directories. > > (Ie ${project.build.directory} and ${project.reporting.outputDirectory}) Attached is the patch as per request. Tested/verified with a POM that overrides both build- and reporting output directories (the "target" directory is not at all present). You might want to check coding conventions, run some additional tests etc and tweak the patch to your liking. Best regards, Martin P.S. If you need it: permission to use the attached code under the Apache License Version 2.0 is hereby granted by me, Martin Kalén, the sole author. |
From: Martin K. <mar...@cu...> - 2008-06-16 18:56:14
|
Greetings developers, I just found StatSCM and started to play around with it. It's a really nice interface to StatCVS and StatSVN - great work! However, I immediately hit a case where StatSCM could not handle a POM to correctly generate a report. After looking at the source code I see that that StatSCM cannot handle POM overrides of the default build- and reporting output directories. (Ie ${project.build.directory} and ${project.reporting.outputDirectory}) Some paths are hard coded to follow the Maven Standard Directory Layout with default build directory "${basedir}/target" and reporting output directory "${project.build.directory}/site". In my case, the POM is a conversion from a legacy Ant project that does not follow the SDL structure (which still makes it a perfectly valid POM). I am currently testing a small patch that will fix this in StatSCM (use POM-configured paths if they are set, otherwise fall back to the previous code -- i.e. should be backwards compatible). Would you be interested in this patch and if so, would you like a (unified?) diff on the dev-list or should I open an issue in the project tracker? Regards, Martin |