You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Hugo de Oude <Hd...@allshare.nl> on 2011/04/07 11:03:21 UTC

Maven surefire plugin run twice with different argLine setttings

Within our build process we would like to run all unittests twice. Because we
would like to test everything against SQL Server and Oracle.

To achieve this I added the maven-surefire-plugin to the pom twice. The
first one has id 'run_tests_oracle_id' and the second one is called
'run_tests_sqlserver_id'.
Now in the configuration I use the argLine to set which database has to be
used. 
But each time when the build is executed the latest configuration of
maven-surefire-plugin is used. So it seems not possible to load two
maven-surefire-plugins with two different configurations?

Does somebody know a solution for this? Main purpose is running all unittest
twice on two different databases using maven-surefire-plugin and the
itblast-plugin.

Thx in advance.


			run_tests_oracle_id
			
				
					run_tests_oracle
				
			
			
				
					
            org.apache.maven.plugins
            maven-surefire-plugin
            2.8
						
						  false
							${VMARGS__TEST_PROPERTY_FILE_ORACLE}
${VMARGS__MAVEN_SUREFIRE_PLUGIN_1}
							false
							
               
c:/_composer/_config/libraries/picketlink-bindings-1.0.4.final.jar
              
						
					

					
						org.twdata.maven
						maven-itblast-plugin
						0.5
						
							
                itblast_oracle
								post-integration-test
								
									execute
								
								
									tomcat5x
									${APPSERVER_DB_ORACLE__PORT__HTTP}
									${APPSERVER_DB_ORACLE__PORT__RMI}
									${junit.test.pattern}
									
								
							
						
					

				
			
		


			run_tests_sqlserver_id
			
				
					run_tests_sqlserver
				
			
			
				

					
						org.apache.maven.plugins
            maven-surefire-plugin
            2.8
						
							false
							${VMARGS__TEST_PROPERTY_FILE_SQLSERVER}
${VMARGS__MAVEN_SUREFIRE_PLUGIN_2}
							false
						
					

					
						org.twdata.maven
						maven-itblast-plugin
						0.5
						
							
                itblast_sqlserver
								verify
								
									execute
								
								
									jetty6x
									${APPSERVER_DB_SQLSRV__PORT__HTTP}
									${APPSERVER_DB_SQLSRV__PORT__RMI}
									${junit.test.pattern}
									
								
							
						
					

				
			
		

--
View this message in context: http://maven.40175.n5.nabble.com/Maven-surefire-plugin-run-twice-with-different-argLine-setttings-tp4288014p4288014.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Maven surefire plugin run twice with different argLine setttings

Posted by Hugo de Oude <Hd...@allshare.nl>.
Thanks for your information.
At the moment we cannot switch to Maven 3 yet.

I understand the part to take up multiple executions within the same
surefire plugin. 
But how will this work combined with the itblast-plugin.
Normally the itblast-plugin sets the goal (execute) and to be able to run
the itblast-plugin it uses the surefire plugin. Then itblast is instructed
to run the tests against for instance a jetty6x container. 
And to use the itblast-plugin a surefire plugin is needed. But I don't know
if adding more executions to the surefire plugin will work for me. Because
actually the itblast-plugin should have two executions if I understand his
correctly.




--
View this message in context: http://maven.40175.n5.nabble.com/Maven-surefire-plugin-run-twice-with-different-argLine-setttings-tp4288014p4288333.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Maven surefire plugin run twice with different argLine setttings

Posted by Stephen Connolly <st...@gmail.com>.
On 7 April 2011 12:08, Stephen Connolly <st...@gmail.com> wrote:
> still bad...
>
> i'm going to guess that you defined the plugin twice, e.g.
>
> <plugin>
> <artifactId>maven-surefire-plugin</artifactId>
> ...
> </plugin>
> <plugin>
> <artifactId>maven-surefire-plugin</artifactId>
> ...
> </plugin>

Forgot to mention... I can conclude you are using Maven 2.x... Maven
3.x will tell you to take a long walk off a short pier if you attempt
to duplicate the same plugin in the pom.

Maven 2.x will just merge the two which is why the last one wins for you
>
> instead of adding an extra execution to the plugin
>
> <plugin>
> <artifactId>maven-surefire-plugin</artifactId>
> <executions>
>  <execution>
>    <id>ora</id>
>    <configuration>
>      ...
>    </configuration>
>  </execution>
>  <execution>
>    <id>mssql</id>
>    <configuration>
>      ...
>    </configuration>
>  </execution>
> </execution>
> </plugin>
>
> Now you should note that the above will run the tests three times!
> (there is a default execution of the plugin)
>
> In Maven 3.x you can disable the default execution with
>
>          <execution>
>            <id>default-test</id>
>            <configuration>
>              <skipTests>true</skipTests>
>            </configuration>
>          </execution>
>
> That won't work for Maven 2.x so if you need to support building with
> Maven 2.x then you either define one execution's configuration in the
> plugin configuration and reset the configuration back in the second
> configuration (i.e. you only have one execution defined in your pom)
> <plugin>
> <artifactId>maven-surefire-plugin</artifactId>
>    <!-- by default use ora config -->
>    <configuration>
>      ...
>    </configuration>
> <executions>
>  <execution> <!-- add one execution for mssql -->
>    <id>mssql</id>
>    <configuration>
>      ...
>    </configuration>
>  </execution>
> </execution>
> </plugin>
>
> or you do something like
>
> <plugin>
> <artifactId>maven-surefire-plugin</artifactId>
> <configuration>
>  <skipTests>true</skipTests>
> </configuration>
> <executions>
>  <execution>
>    <id>ora</id>
>    <configuration>
>      <skipTests>${skipTests}</skipTests>
>      ...
>    </configuration>
>  </execution>
>  <execution>
>    <id>mssql</id>
>    <configuration>
>      <skipTests>${skipTests}</skipTests>
>      ...
>    </configuration>
>  </execution>
> </execution>
> </plugin>
>
> which will disable surefire by default and re-enable it based on the
> skipTests property for the two executions.
>
> On 7 April 2011 10:55, Hugo de Oude <Hd...@allshare.nl> wrote:
>> Oh I'm sorry. I tried to correct the problem and hopefully it is ok now?
>>
>> --
>> View this message in context: http://maven.40175.n5.nabble.com/Maven-surefire-plugin-run-twice-with-different-argLine-setttings-tp4288014p4288110.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>

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


Re: Maven surefire plugin run twice with different argLine setttings

Posted by Stephen Connolly <st...@gmail.com>.
still bad...

i'm going to guess that you defined the plugin twice, e.g.

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
...
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
...
</plugin>

instead of adding an extra execution to the plugin

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
  <execution>
    <id>ora</id>
    <configuration>
      ...
    </configuration>
  </execution>
  <execution>
    <id>mssql</id>
    <configuration>
      ...
    </configuration>
  </execution>
</execution>
</plugin>

Now you should note that the above will run the tests three times!
(there is a default execution of the plugin)

In Maven 3.x you can disable the default execution with

          <execution>
            <id>default-test</id>
            <configuration>
              <skipTests>true</skipTests>
            </configuration>
          </execution>

That won't work for Maven 2.x so if you need to support building with
Maven 2.x then you either define one execution's configuration in the
plugin configuration and reset the configuration back in the second
configuration (i.e. you only have one execution defined in your pom)
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
    <!-- by default use ora config -->
    <configuration>
      ...
    </configuration>
<executions>
  <execution> <!-- add one execution for mssql -->
    <id>mssql</id>
    <configuration>
      ...
    </configuration>
  </execution>
</execution>
</plugin>

or you do something like

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
  <skipTests>true</skipTests>
</configuration>
<executions>
  <execution>
    <id>ora</id>
    <configuration>
      <skipTests>${skipTests}</skipTests>
      ...
    </configuration>
  </execution>
  <execution>
    <id>mssql</id>
    <configuration>
      <skipTests>${skipTests}</skipTests>
      ...
    </configuration>
  </execution>
</execution>
</plugin>

which will disable surefire by default and re-enable it based on the
skipTests property for the two executions.

On 7 April 2011 10:55, Hugo de Oude <Hd...@allshare.nl> wrote:
> Oh I'm sorry. I tried to correct the problem and hopefully it is ok now?
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Maven-surefire-plugin-run-twice-with-different-argLine-setttings-tp4288014p4288110.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: Maven surefire plugin run twice with different argLine setttings

Posted by Hugo de Oude <Hd...@allshare.nl>.
Oh I'm sorry. I tried to correct the problem and hopefully it is ok now?

--
View this message in context: http://maven.40175.n5.nabble.com/Maven-surefire-plugin-run-twice-with-different-argLine-setttings-tp4288014p4288110.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Maven surefire plugin run twice with different argLine setttings

Posted by Tamás Cservenák <ta...@cservenak.net>.
Hi Hugo,

Your XML from both of your mails is garbled, unreadable (by Nabble UI if I'm
right).

Please use proper MUA or even better paste (http://pastebin.com/)  or gist (
https://gist.github.com/) them and send the links to them instead.


Thanks,
~t~

On Thu, Apr 7, 2011 at 11:03 AM, Hugo de Oude <Hd...@allshare.nl> wrote:

> Within our build process we would like to run all unittests twice. Because
> we
> would like to test everything against SQL Server and Oracle.
>
> To achieve this I added the maven-surefire-plugin to the pom twice. The
> first one has id 'run_tests_oracle_id' and the second one is called
> 'run_tests_sqlserver_id'.
> Now in the configuration I use the argLine to set which database has to be
> used.
> But each time when the build is executed the latest configuration of
> maven-surefire-plugin is used. So it seems not possible to load two
> maven-surefire-plugins with two different configurations?
>
> Does somebody know a solution for this? Main purpose is running all
> unittest
> twice on two different databases using maven-surefire-plugin and the
> itblast-plugin.
>
> Thx in advance.
>
>
>                        run_tests_oracle_id
>
>
>                                        run_tests_oracle
>
>
>
>
>
>            org.apache.maven.plugins
>            maven-surefire-plugin
>            2.8
>
>                                                  false
>
>  ${VMARGS__TEST_PROPERTY_FILE_ORACLE}
> ${VMARGS__MAVEN_SUREFIRE_PLUGIN_1}
>                                                        false
>
>
> c:/_composer/_config/libraries/picketlink-bindings-1.0.4.final.jar
>
>
>
>
>
>                                                org.twdata.maven
>                                                maven-itblast-plugin
>                                                0.5
>
>
>                itblast_oracle
>
>  post-integration-test
>
>
>  execute
>
>
>
>  tomcat5x
>
>  ${APPSERVER_DB_ORACLE__PORT__HTTP}
>
>  ${APPSERVER_DB_ORACLE__PORT__RMI}
>
>  ${junit.test.pattern}
>
>
>
>
>
>
>
>
>
>
>
>                        run_tests_sqlserver_id
>
>
>                                        run_tests_sqlserver
>
>
>
>
>
>
>                                                org.apache.maven.plugins
>            maven-surefire-plugin
>            2.8
>
>                                                        false
>
>  ${VMARGS__TEST_PROPERTY_FILE_SQLSERVER}
> ${VMARGS__MAVEN_SUREFIRE_PLUGIN_2}
>                                                        false
>
>
>
>
>                                                org.twdata.maven
>                                                maven-itblast-plugin
>                                                0.5
>
>
>                itblast_sqlserver
>                                                                verify
>
>
>  execute
>
>
>
>  jetty6x
>
>  ${APPSERVER_DB_SQLSRV__PORT__HTTP}
>
>  ${APPSERVER_DB_SQLSRV__PORT__RMI}
>
>  ${junit.test.pattern}
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Maven-surefire-plugin-run-twice-with-different-argLine-setttings-tp4288014p4288014.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>