Issue Details (XML | Word | Printable)

Key: SUREFIRE-257
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Dirk Sturzebecher
Votes: 86
Watchers: 65
Operations

If you were logged in you would be able to see more operations.
Maven Surefire

surefire-report reruns tests

Created: 22/Nov/05 04:23 PM   Updated: 07/Nov/08 03:22 PM
Return to search
Component/s: Maven Surefire Report Plugin
Affects Version/s: None
Fix Version/s: 2.x

Time Tracking:
Not Specified

File Attachments: 1. Text File MSUREFIREREP-6-patch.txt (2 kB)

Environment: maven 2.0
Issue Links:
Related
 


 Description  « Hide

surefire-report reruns the tests. In my case this is not just annoying, but leads to a failure, as the VM (probably) is reused and leftovers from the first tests are (definitly) still present.

I run maven with: clean package site



Dirk Sturzebecher added a comment - 22/Nov/05 04:25 PM

one more detail, if I include the plugin in the build section (as in the documentation) it is not triggered. I have included it in the reporting section (which kind of makes sense)...


Johnny R. Ruiz III added a comment - 25/Nov/05 01:47 PM

Maybe it is better if we don't re-run the test on report generation. What do you guys think?


Brett Porter added a comment - 25/Nov/05 05:45 PM

if we omit the test running, then just running "mvn site" will fail.

I'm not sure what failures are encountered other than being annoying

Anyway, this is a core Maven issue, and we are looking to improve it in Maven 2.1/2.2


Dirk Sturzebecher added a comment - 27/Nov/05 02:42 PM

do not run the tests unnecessarily again, this can only cause trouble!

the best would be if the tests would be considered as a dependencies, so not run if there is something in the surefire dir, run if it is empty (or something of this kind)


Carlos Sanchez added a comment - 27/Nov/05 06:48 PM

I'd add a property to the report plugin like "always run tests". If false it'd check for reports and not run tests if present


Grégory Joseph added a comment - 13/Jan/06 06:39 PM

For some reason, when executing the test phase, the settings of the surefire plugin seem to not be taken into account: my tests are not forked, thus failing.


Grégory Joseph added a comment - 13/Jan/06 08:12 PM

Hmm, nevermind that - my tests are failing because they're run twice - if I remove the clover report plugin, which also runs the tests, then they don't fail ..


Dirk Sturzebecher added a comment - 07/Feb/06 01:36 PM

Just tried the same again with maven 2.0.2 and set my surefire to fork. Works fine now. That is the result looks good on first inspection, but the console shows errors as below. First one looks like a missing file, second one seams a problem with the local. My environment is a german local. Seams to be te typical difference between english numbers (2,000.) and german numbers (2.000,)

[exec] [INFO] [surefire:test]
[exec] [INFO] Setting reports dir: C:\Dokumente und Einstellungen\dsturze\Eigene Dateien\dirk\projects\MoneyPlus-0.4.4\target/surefire-reports
[exec] [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[exec] [INFO] Setting property: velocimacro.messages.on => 'false'.
[exec] [INFO] Setting property: resource.loader => 'classpath'.
[exec] [INFO] Setting property: resource.manager.logwhenfound => 'false'.
[exec] [INFO] **************************************************************
[exec] [INFO] Starting Jakarta Velocity v1.4
[exec] [INFO] RuntimeInstance initializing.
[exec] [INFO] Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
[exec] [INFO] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
[exec] [INFO] Resource Loader Instantiated: org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[exec] [INFO] ClasspathResourceLoader : initialization starting.
[exec] [INFO] ClasspathResourceLoader : initialization complete.
[exec] [INFO] ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
[exec] [INFO] Default ResourceManager initialization complete.
[exec] [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[exec] [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[exec] [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[exec] [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Include
[exec] [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[exec] [INFO] Created: 20 parsers.
[exec] [INFO] Velocimacro : initialization starting.
[exec] [INFO] Velocimacro : adding VMs from VM library template : VM_global_library.vm
[exec] [ERROR] ResourceManager : unable to find resource 'VM_global_library.vm' in any resource loader.
[exec] [INFO] Velocimacro : error using VM library template VM_global_library.vm : org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'VM_global_library.vm'
[exec] [INFO] Velocimacro : VM library template macro registration complete.
[exec] [INFO] Velocimacro : allowInline = true : VMs can be defined inline in templates
[exec] [INFO] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
[exec] [INFO] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
[exec] [INFO] Velocimacro : initialization complete.
[exec] [INFO] Velocity successfully started.
[exec] [INFO] [site:site]
[exec] [WARNING] Error loading report org.codehaus.mojo.surefire.SurefireReportMojo - AbstractMethodError: canGenerateReport()
[exec] [INFO] Generate "Maven Surefire Report" report.
[exec] java.lang.NumberFormatException: For input string: "0,282"
[exec] at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224)
[exec] at java.lang.Float.parseFloat(Float.java:394)
[exec] at org.codehaus.mojo.surefire.ReportTestSuite.startElement(ReportTestSuite.java:78)
[exec] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
[exec] at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:798)
[exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:878)
[exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:1157)
[exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794)
[exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
[exec] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
[exec] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
[exec] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
[exec] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
[exec] at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
[exec] at javax.xml.parsers.SAXParser.parse(SAXParser.java:311)
[exec] at org.codehaus.mojo.surefire.ReportTestSuite.<init>(ReportTestSuite.java:59)
[exec] at org.codehaus.mojo.surefire.SurefireReportParser.parseXMLReportFiles(SurefireReportParser.java:42)
[exec] at org.codehaus.mojo.surefire.SurefireReportGenerator.doGenerateReport(SurefireReportGenerator.java:44)
[exec] at org.codehaus.mojo.surefire.SurefireReportMojo.executeReport(SurefireReportMojo.java:77)
[exec] at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:117)
[exec] at org.apache.maven.plugins.site.SiteMojo.generateReportsPages(SiteMojo.java:802)
[exec] at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:301)
[exec] at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:415)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:531)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:472)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:451)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:303)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:270)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:139)
[exec] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
[exec] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
[exec] at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[exec] at java.lang.reflect.Method.invoke(Method.java:585)
[exec] at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
[exec] at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
[exec] at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
[exec] at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[exec] java.lang.NumberFormatException: For input string: "0,313"
[exec] at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224)
[exec] at java.lang.Float.parseFloat(Float.java:394)
[exec] at org.codehaus.mojo.surefire.ReportTestSuite.startElement(ReportTestSuite.java:78)
[exec] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
[exec] at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:798)
[exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:878)
[exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:1157)
[exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794)
[exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
[exec] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
[exec] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
[exec] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
[exec] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
[exec] at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
[exec] at javax.xml.parsers.SAXParser.parse(SAXParser.java:311)
[exec] at org.codehaus.mojo.surefire.ReportTestSuite.<init>(ReportTestSuite.java:59)
[exec] at org.codehaus.mojo.surefire.SurefireReportParser.parseXMLReportFiles(SurefireReportParser.java:42)
[exec] at org.codehaus.mojo.surefire.SurefireReportGenerator.doGenerateReport(SurefireReportGenerator.java:44)
[exec] at org.codehaus.mojo.surefire.SurefireReportMojo.executeReport(SurefireReportMojo.java:77)
[exec] at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:117)
[exec] at org.apache.maven.plugins.site.SiteMojo.generateReportsPages(SiteMojo.java:802)
[exec] at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:301)
[exec] at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:415)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:531)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:472)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:451)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:303)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:270)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:139)
[exec] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
[exec] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
[exec] at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[exec] at java.lang.reflect.Method.invoke(Method.java:585)
[exec] at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
[exec] at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
[exec] at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
[exec] at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[exec] java.lang.NullPointerException
[exec] at org.codehaus.mojo.surefire.SurefireReportGenerator.constructTestCasesSection(SurefireReportGenerator.java:344)
[exec] at org.codehaus.mojo.surefire.SurefireReportGenerator.doGenerateReport(SurefireReportGenerator.java:60)
[exec] at org.codehaus.mojo.surefire.SurefireReportMojo.executeReport(SurefireReportMojo.java:77)
[exec] at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:117)
[exec] at org.apache.maven.plugins.site.SiteMojo.generateReportsPages(SiteMojo.java:802)
[exec] at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:301)
[exec] at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:415)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:531)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:472)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:451)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:303)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:270)
[exec] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:139)
[exec] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
[exec] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
[exec] at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[exec] at java.lang.reflect.Method.invoke(Method.java:585)
[exec] at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
[exec] at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
[exec] at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
[exec] at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[exec] [ERROR] VM #displayTree: error : too few arguments to macro. Wanted 2 got 0
[exec] [ERROR] VM #menuItem: error : too few arguments to macro. Wanted 1 got 0
[exec] [INFO] Generate "Continuous Integration" report.
[exec] [INFO] Generate "Dependencies" report.
[exec] [INFO] Generate "Issue Tracking" report.
[exec] [INFO] Generate "Project License" report.
[exec] [INFO] Generate "Mailing Lists" report.
[exec] [INFO] Generate "Source Repository" report.
[exec] [INFO] Generate "Project Team" report.
[exec] [INFO] Generate an index file for the English version.
[exec] [INFO] ----------------------------------------------------------------------------
[exec] [INFO] BUILD SUCCESSFUL
[exec] [INFO] ----------------------------------------------------------------------------


Brett Porter made changes - 27/Feb/06 09:47 PM
Field Original Value New Value
Workflow Maven [ 42463 ] Maven New [ 49803 ]
Brett Porter made changes - 19/Mar/06 06:12 AM
Affects Version/s 2.0 [ 12007 ]
Component/s JUnit Report [ 11801 ]
Project Mojo [ 11062 ] Maven 2.x Surefire report Plugin [ 11222 ]
Key MOJO-135 MSUREFIREREP-6
Carlos Sanchez added a comment - 20/Apr/06 01:12 AM

the last one is another unrelated issue that has already been solved


Dan Fabulich added a comment - 05/May/06 02:49 PM

Is there any workaround for this? Is there some way I can skip the first test run and just let surefire-report run the tests for me or something?


Brett Porter added a comment - 05/May/06 08:05 PM

you can try putting <skip> into the <build> section. However, this will always skip tests during build (but still run them through site).


Pascal Magnard added a comment - 12/May/06 02:52 AM

I've got the same issue as Dirk. I added the surefire-report plugin declaration to the reporting section of my pom and each time this plugin is executed, the test phase is invoked. The expected behavior, according to the documentation, would be the surefire plugin to invoke the test phase (http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html) but not the surefire-report plugin (http://maven.apache.org/plugins/maven-surefire-report-plugin/report-mojo.html).
Having the tests ran twice when invoking mvn clean install site is more than annoying for the project i'm working on because the compilation and the testing are performed twice and they unfortunatly take a big while.

That would be great if you could provide a mean to prevent from having the surefire-report plugin kicking off a test phase when triggered. Some boolean like 'invokeTest' in the <configuration> section of the plugin would be just fine.

(And btw, Brett, i've been looking for you solution but was not able to find any <skip> tag in either the Maven 1.1 or Maven 2 POM XML schema.)


Kenny Cheang added a comment - 07/Jul/06 09:11 PM

I have the same issue. I am using "clean install site" and for some reason, the surefire test is executed four times. This is more than annoying. It considerably slows down the build process because I have some DAO tests against real database.

I hope Maven can remove all duplicated goals within a single maven command so that people can safely execute something like "mvn clean compile test package install deploy site site-deploy".


Martin Brunninger added a comment - 22/Aug/06 05:22 AM

I encountered this too.

I my eyes, running the test during site generation is no good idea as it modifies content outside the "/target/site" folder. If I run "mvn clean package site" there should be no problem with having no test results. If I run "mvn site" with no test results available, well for me it's ok to have no (or an empty) report in this case. If others like to have the tests done during site generation, I'd see this as an optional configuration as it modifies content outside the "/target/site" folder and is a time issue (especially for larger projects).

According to Kenny's problem, I assume he is using the surefire, surefire-report and clover plugin (like me). In this case I can explain why the tests are run four times. If you enable the debug output, you will see that clover does something like running a second lifecycle with goal install. So the first time the test are executed, it is done with instrumented code. The second time (in the original) lifecycle the test are run with non-instrumented code. To be honest, from some point of view this makes sense as instrumentation does not influence your tests (especially when making performance tests), but I would like to decide this myself. The second two executions are simple to explain. This is because surefire-report reruns the test (including all prior phases) and this includes instrumentation too.

Hope this helps.


Peter Anning added a comment - 03/Sep/06 06:18 PM

This is a big issue for us. We are migrating a large ant based project to Maven and have 1200 unit tests. If a test fails the only way to find which test has failed is to run the surefire-report:report goal this then re-runs all the tests, which takes a long time. Need a way to get this report plugin to only rerun tests if explicityly asked to. It should just compile a report on the results that are already there, if there are no individual test reports then exit without error. Also is there a way to get the surefire plugin to only create reports for tests that have failed.


Anders Sveen added a comment - 06/Oct/06 03:38 AM

Same prob, and experiencing excessive build times which is a big problem for our project.


Chris Hagmann added a comment - 06/Oct/06 05:13 PM

I would add a second goal (e.g. report-only) which doesn't execute the phase "test". Meaning:

surefire-report:report (would execute phase "test")
surefire-report:report-only (doesn't execute phase "test")

So just to also create a set of test reports without bothering building a site you would configure your pom with this:

{pre}
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>report-only</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>{pre}

Chris Hagmann added a comment - 06/Oct/06 05:24 PM

(Another attempt - JIRA administrator please remove my previous comment)

I would add a second goal (e.g. report-only) which doesn't execute the phase "test". Meaning:

surefire-report:report (would execute phase "test")
surefire-report:report-only (doesn't execute phase "test")

So just to also create a set of test reports without bothering building a site you would configure your pom with this:

<build>
  <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-report-plugin</artifactId>
                    <executions>
                        <execution>
                            <phase>test</phase>
                            <goals>
                                <goal>report-only</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
  </plugins>
</build>

Sasha A added a comment - 01/Nov/06 11:05 AM

The workaround I've been using is the problem Peter Anning has above is the following. First I run a target that invokes the tests, like:

mvn test OR mvn install

Then, if the tests fail, I run:

mvn -Dmaven.test.skip=true surefire-report:report

OR

mvn -Dmaven.test.skip=true site

Either of these commands runs the surefire report goal without running the tests again. Obviously, this is just a workaround, and it doesn't work well for continuous integration systems that need to run everything automagically, but it has helped me a lot.


aaron pieper added a comment - 28/Nov/06 02:46 PM

After adding the following code to my pom.xml, doing a "mvn install site" only runs the tests once. It is a good workaround if you're using a continuous integration system or can't be bothered to type two things.

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.0</version>
<configuration>
<systemProperties>
<property>
<name>maven.test.skip</name>
<value>true</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>


aaron pieper added a comment - 28/Nov/06 03:46 PM

Ignore my previously suggested workaround. "mvn install site" was only running the tests once for me because surefire reports were not being included.

I'm unsure why tests were being run twice since surefire was not in use, but the workaround I suggested does not work.


Barrie Treloar added a comment - 11/Dec/06 09:08 PM

Patch as requested by someone to create a "report-only" goal.

Includes update to index.apt to reference the goal.

Based on subversion revision 485987.

Workaround until someone sorts out reactor/forked lifecycle issues.


Barrie Treloar made changes - 11/Dec/06 09:08 PM
Attachment MSUREFIREREP-6-patch.txt [ 24598 ]
Barrie Treloar added a comment - 18/Jan/07 08:14 PM

I've added the workaround patch to the trunk which will be included in the 2.3 release.


Brett Porter made changes - 21/Jan/07 05:40 PM
Key MSUREFIREREP-6 SUREFIRE-257
Complexity Intermediate
Project Maven 2.x Surefire report Plugin [ 11222 ] Maven Surefire [ 10541 ]
Brett Porter made changes - 21/Jan/07 05:49 PM
Component/s report plugin [ 12564 ]
Brandon Goodin added a comment - 15/Feb/07 10:09 AM

I was not able to get report-only to work.

I have the following in my pom:

<build>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>report-only</goal>
</goals>
</execution>
</executions>
</plugin>
...
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
</plugin>
</plugins>
...
</reporting>
<pluginRepositories>
<pluginRepository>
<id>apache.org</id>
<name>Maven Plugin Snapshots</name>
<url>http://people.apache.org/repo/m2-snapshot-repository</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

I tried running the surefire-report:report-only goal with SNAPSHOT-2.3 and received the following:

**************************
mvn clean install surefire-report:report-only
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'surefire-report'.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Required goal not found: surefire-report:report-only
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Thu Feb 15 10:03:39 CST 2007
[INFO] Final Memory: 1M/3M
[INFO] ------------------------------------------------------------------------
**************************

I tried running the surefire-report:report goal with SNAPSHOT-2.3 and received the following:

**************************
mvn clean install surefire-report:report
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'surefire-report'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building iBATIS SQL Map
[INFO] task-segment: [clean, install, surefire-report:report]
[INFO] ----------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] 'report-only' was specified in an execution, but not found in the plugin
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Thu Feb 15 10:05:18 CST 2007
[INFO] Final Memory: 2M/4M
[INFO] ------------------------------------------------------------------------
**************************

I even removed the executions configuration... still no go.


Barrie Treloar added a comment - 15/Feb/07 09:29 PM

I don't know if a snapshot build has been created that includes this patch yet.

The error message you list would indicate this.

Your alternative is to create a locally patched version of the plugin.
That's what I have done and it works fine.


Brandon Goodin added a comment - 16/Feb/07 12:20 AM

That would work for me only. However, I have a group of developers that are either Maven skeptics or unfamiliar with Maven. I am attempting to provide them a working and acceptable alternative to our current ant build. I don't want to place a burden of asking them to checkout and patch a plugin. That would not reflect well on Maven. Is is possible to get a more recent SNAPSHOT deployed?


Barrie Treloar added a comment - 17/Feb/07 06:44 PM

Have a read of http://docs.codehaus.org/display/MAVENUSER/Patching+Maven+Plugins
and http://docs.codehaus.org/display/MAVENUSER/Using+Maven+in+a+corporate+environment.

It is my opinion that your build should never depend upon snapshot versions.
And including a snapshot repository can also mean pulling in more snapshot plugins than intended.


Brandon Goodin added a comment - 17/Feb/07 08:03 PM

Thanks for the feedback. The website (http://maven.apache.org/plugins/maven-surefire-report-plugin/report-mojo.html) is presenting the report-only functionality as though it is available. If you do not intend for people to use it you might want to roll your site documentation back to what is actually available. What is the timeline for a new release? This functionality is very much wanted and being that the project I am working with is an Apache project I'd prefer not to go setting up custom repos to serve up jars for our build. I'd much rather use yours.


Brett Porter added a comment - 20/Feb/07 06:26 AM

Barrie - should this be resolved if it is applied?


Brett Porter made changes - 20/Feb/07 06:26 AM
Fix Version/s 2.3 [ 12620 ]
Barrie Treloar added a comment - 20/Feb/07 02:16 PM

Unfortunately, I don't believe we can mark this resolved as surefire-report:report-only is a workaround.

More thought was meant to be given to this and lifecycles for Maven 2.1.

For instance, I want the assembly plugin to use the target/site files so I can grab the html from converted apts.
To do this, I'd like to bind site to the default lifecyle, which will cause surefire-report to run (with all the re-running of tests that are listed in this defect)


Graham Lea added a comment - 20/Feb/07 08:08 PM

Regardless of whether this is the best solution or not, it contains the functionality that most people want.

Please commit it to the Maven repository so we can use it.


Brett Porter made changes - 23/Feb/07 01:05 AM
Fix Version/s 2.4 [ 13243 ]
Fix Version/s 2.3 [ 12620 ]
Mike Youngstrom added a comment - 15/May/07 01:08 PM

I'm attempting to use report-only but I cannot seem to get maven to only execute "report-only" and not "report". It still executes both report-only and report hence my tests are still being executed again when "report" runs. Any ideas?

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<goals>
<goal>report-only</goal>
</goals>
</execution>
</executions>
</plugin>


Barrie Treloar added a comment - 15/May/07 05:50 PM

This is because 2.4 has not been released yet, so unless you have build a local copy and installed it report-only is not available yet.


Barrie Treloar made changes - 21/May/07 04:11 PM
Link This issue is related to SUREFIRE-330 [ SUREFIRE-330 ]
Nathan Beyer (Cerner) added a comment - 18/Jun/07 02:27 PM

If this isn't available with v2.3, then there's a documentation problem, as the "report-only" goal is advertised as available now and available since 2.3. See the following URLs, which as of this posting say 'report-only' is available.

http://maven.apache.org/plugins/maven-surefire-report-plugin/
http://maven.apache.org/plugins/maven-surefire-report-plugin/report-only-mojo.html


Michael Meyer added a comment - 21/Jun/07 01:09 AM

Any chance that this functionality will be released soon? Maybe in an alpha version of the plugin?


Benjamin Bentmann added a comment - 11/Aug/07 07:50 AM

I'm using Maven 2.0.7 and surefire-report-plugin:2.3. From my experience, "report-only" already works in this version. Mike's problem with the execution of both "report" and "report-only" should be solved by configuring surefire-report under the <reporting> section like this:

<reporting>
		...
			<plugin>
				<artifactId>maven-surefire-report-plugin</artifactId>
				...
				<reportSets>
					<reportSet>
						<reports>
							<report>report-only</report>
						</reports>
					</reportSet>
				</reportSets>
			</plugin>
		...
	</reporting>

This seems to be in conformance with http://maven.apache.org/pom.html#Reporting, one cannot configure a reporting plugin using the <build> section.

If I type "mvn site", the tests are not run. However, "report-only" still seems to fork a new lifecycle build. This is not really an issue, but seems unnecessary, at least to me as a Maven novice.


Mike Youngstrom added a comment - 13/Aug/07 03:21 PM

That works perfect. You're a genius Benjamin. An example like that should be added to the surefire docs.

Thanks.


Damien Lecan added a comment - 23/Aug/07 05:14 AM

Benjamin's example doesn't not work for me. html files for site are not generated.

I work with surefire 2.3 and if I try to do mvn surefire-report:report-only I get this error :

[INFO] Searching repository for plugin with prefix: 'surefire-report'.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Required goal not found: surefire-report:report-only

Are you sure this should work with Surefire 2.3 ?


Benjamin Bentmann added a comment - 23/Aug/07 05:44 AM

surefire and surefire-report are separate JARs, are you sure you use v2.3 of surefire-report? I just retried your example command-line and had no problems. Could you append the switch "-X" to enables Maven's debug output and verify it really states something like
Configuring mojo 'org.apache.maven.plugins:maven-surefire-report-plugin:2.3:report-only'
If you still have an older version, appending the switch "-U" should tell Maven to search for updates for the plugins (used to execute the current goal).


Barrie Treloar added a comment - 23/Aug/07 07:04 AM

the "report-only" goal has yet to be released, it is targetted for 2.3.1


Damien Lecan added a comment - 23/Aug/07 08:05 AM

With forced maven-surefire-report-plugin 2.3, this works nice.
Thank you


Benjamin Bentmann added a comment - 23/Aug/07 08:07 AM

Just to make sure I have the proper version 2.3, I re-downloaded http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-report-plugin/2.3/maven-surefire-report-plugin-2.3.jar. The plugin.xml contained in this JAR defines a <mojo> with <goal>report-only</goal> that is mapped to a class named SurefireReportOnlyMojo which is also contained in the JAR. Based on these practical observations, I would consider the "report-only" goal to be released


Fabrice BELLINGARD added a comment - 24/Aug/07 04:07 AM

The goal "report-only" actually exists in version 2.3, but when you launch a "mvn install site", you can see that the tests get executed twice. Which is a bug.
This bug is fixed in SVN. So if you use version 2.3.1-SNAPSHOT, this works perfectly.


Dan Fabulich made changes - 24/Nov/07 03:46 PM
Fix Version/s 2.4 [ 13243 ]
Fix Version/s 2.x [ 13647 ]
Luc Willems added a comment - 06/Nov/08 06:49 AM

is there a way to set the report-only options using
the cli using -Dxxxxx.report-only=true ?

this is would fix my automated builds of project sites .


Benjamin Bentmann added a comment - 06/Nov/08 10:32 AM

Luc, report-only is not an option/parameter but a plugin goal and these can in general not be directly activated via a property from the CLI. You can however add a profile to your POM that runs report-only and have this profile be activated via a system property.


Luc Willems added a comment - 07/Nov/08 03:07 PM

indead , i was going to fast here

i added the report-only option to ALL report entries in my multi module project. still some project rerun
the complete project ( 20 modules , 3 levels of grandparent/parent/child)
this is killing my builds and memory

i also added this for the javadoc plugin because it was doing the same thing

i basicly want to do "mvn clean deploy site-deploy" every night so we have new deployed artifacts and update project site after
every (nightly) build cycle.

for now , the site-deploy stuff is getting to complex because of all this issues


Benjamin Bentmann added a comment - 07/Nov/08 03:22 PM

Luc, what you describe (forking the entire multi-module build by a single module) looks like unintended usage of aggregator goals. These are goals whose doc pages say "Executes as an aggregator plugin.".

The goal report-only from the latest Surefire Report Plugin 2.4.3 does not work as as aggregator and hence should not cause you issues. As for the Javadoc Plugin, its latest release 2.5 includes those problematic aggregator goals. Unless you explicitly configured which report goals to execute, all reports from a plugin are executed. So be sure to setup the Javadoc Plugin as outlined in Selective Javadocs Reports and leave the *-aggregate goals out.