You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Martin Börlin <bo...@passagen.se> on 2006/09/07 12:33:20 UTC

phases executed twice when declaring maven-surefire-report-plugin

Hi!

I have a problem regarding the life cycle in Maven 2. I need to run an 
ANT-script before the package phase, i.e. in the test phase. I want to 
install the application and generate a Maven-site to a remote location, 
hence I run the folllowing Maven command:

mvn install site-deploy

Everything was fine until I added the maven-surefire-report-plugin 
into the <reporting> tag (to get the Maven surefire report html page). 
Then the phases from [resources:resources] up to and including 
[surefire:test] was executed twice, including my ANT-script.
Does any one know how to prevent Maven from running the phases from 
[resources:resources] up to and including [surefire:test] twice? Or at 
least (the most critical in my build process) how to prevent the ANT-
task from running more than once per Maven execution, (maybe using 
profiles in some way to prevent site-deploy from running the ANT-
task)? 
One obvious way is to run the commands (install and site-deploy) 
separately but I would prefer not to since the ANT-task deletes some 
stuff before the package phase... 

regards 
Martin

output when maven-surefire-report-plugin is defined in the <reporting> 
tag. Note the TWO test runs, the TWO ANT task executions and the line " 
[INFO] Generate "Maven Surefire Report" report." at the end.

[INFO] 
----------------------------------------------------------------------------
[INFO] Building SalesTool - Presentation
[INFO]    task-segment: [install, site-deploy]
[INFO] 
----------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Setting reports dir: C:\SalesTool\ST2.
0\test\presentation\target/surefire-reports
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
[surefire] Running com.tele2.salestool.facade.test.TestMyTest
[surefire] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.016 
sec
Results :
[surefire] Tests run: 1, Failures: 0, Errors: 0
[INFO] [antrun:run {execution: anttask}]
[INFO] Executing tasks
     [echo] ################### RUNNING ANT TASK 
########################
[INFO] Executed tasks
[INFO] [war:war]
[INFO] Exploding webapp...
[INFO] Copy webapp resources to C:\SalesTool\ST2.
0\test\presentation\target\presentation-0.1
[INFO] Assembling webapp presentation in C:\SalesTool\ST2.
0\test\presentation\target\presentation-0.1
[INFO] Generating war C:\SalesTool\ST2.
0\test\presentation\target\presentation-0.1.war
[INFO] Building war: C:\SalesTool\ST2.
0\test\presentation\target\presentation-0.1.war
[INFO] [install:install]
[INFO] Installing C:\SalesTool\ST2.
0\test\presentation\target\presentation-0.1.war to C:
\Maven\repository\com\tele2\salestool\presentation\0.1\presentation-0.1.
war
[INFO] Preparing javadoc:javadoc
[INFO] No goals needed for project - skipping
[INFO] Preparing surefire-report:report
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Setting reports dir: C:\SalesTool\ST2.
0\test\presentation\target/surefire-reports
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
[surefire] Running com.tele2.salestool.facade.test.TestMyTest
[surefire] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.016 
sec
Results :
[surefire] Tests run: 1, Failures: 0, Errors: 0
[INFO] [antrun:run {execution: anttask}]
[INFO] Executing tasks
     [echo] ################### RUNNING ANT TASK 
########################
[INFO] Executed tasks
[INFO] [site:site]
[WARNING] Error loading report org.apache.maven.plugin.jxr.JxrReport - 
AbstractMethodError: canGenerateReport()
[INFO] Generate "Continuous Integration" report.
[INFO] Generate "Dependencies" report.
[INFO] Generate "Issue Tracking" report.
[INFO] Generate "Project License" report.
[INFO] Generate "Mailing Lists" report.
[INFO] Generate "Source Repository" report.
[INFO] Generate "Project Team" report.
[INFO] Generate "Maven Surefire Report" report.
[INFO] Generate "Source Xref" report.



output when maven-surefire-report-plugin is NOT defined in the 
<reporting> tag. Note the ONE test run, the ONE ANT task execution and 
the ABSENCE of the line " [INFO] Generate "Maven Surefire Report" 
report.". (Mind you there is a file "surefire-report.html" generated 
but without (obviously) any information about the tests and no links to 
this file from the index.html file )

[INFO] 
----------------------------------------------------------------------------
[INFO] Building SalesTool - Presentation
[INFO]    task-segment: [install, site-deploy]
[INFO] 
----------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
Compiling 1 source file to C:\SalesTool\ST2.
0\test\presentation\target\test-classes
[INFO] [surefire:test]
[INFO] Setting reports dir: C:\SalesTool\ST2.
0\test\presentation\target/surefire-reports
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
[surefire] Running com.tele2.salestool.facade.test.TestMyTest
[surefire] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.016 
sec
Results :
[surefire] Tests run: 1, Failures: 0, Errors: 0
[INFO] [antrun:run {execution: anttask}]
[INFO] Executing tasks
     [echo] ################### RUNNING ANT TASK 
########################
[INFO] Executed tasks
[INFO] [war:war]
[INFO] Exploding webapp...
[INFO] Copy webapp resources to C:\SalesTool\ST2.
0\test\presentation\target\presentation-0.1
[INFO] Assembling webapp presentation in C:\SalesTool\ST2.
0\test\presentation\target\presentation-0.1
[INFO] Generating war C:\SalesTool\ST2.
0\test\presentation\target\presentation-0.1.war
[INFO] Building war: C:\SalesTool\ST2.
0\test\presentation\target\presentation-0.1.war
[INFO] [install:install]
[INFO] Installing C:\SalesTool\ST2.
0\test\presentation\target\presentation-0.1.war to C:
\Maven\repository\com\tele2\salestool\presentation\0.1\presentation-0.1.
war
[INFO] Preparing javadoc:javadoc
[INFO] No goals needed for project - skipping
[INFO] [site:site]
[WARNING] Error loading report org.apache.maven.plugin.jxr.JxrReport - 
AbstractMethodError: canGenerateReport()
[INFO] Generate "Continuous Integration" report.
[INFO] Generate "Dependencies" report.
[INFO] Generate "Issue Tracking" report.
[INFO] Generate "Project License" report.
[INFO] Generate "Mailing Lists" report.
[INFO] Generate "Source Repository" report.
[INFO] Generate "Project Team" report.
[INFO] Generate "Source Xref" report.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org