maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Connolly <>
Subject Re: Executing tests in a newer JVM version than the one used to build project.
Date Thu, 02 May 2013 21:12:13 GMT
On Thursday, 2 May 2013, Jean Tremblay wrote:

> Hi,
> I have a bit of a complicated setup. I need to build my jar file using
> java 1.6, but I need to execute my tests using Java 1.7, as my library need
> to connect to other libraries built for Java V1.7.
> How can I do that?
> I currently set my pom.xml with the following entries:
>   <properties>
>     <>UTF-8</>
>     <>1.6</>
>     <maven.compiler.source>1.6</maven.compiler.source>
>   </properties>
> Unfortunately when my test is executed it is also running using v1.6 but I
> would like to use version 1.7.
> Is there a way to tell sure fire (I guess this is the plugin I should look
> at) to use v1.7 when executing the tests?
> What is exactly choosing the target version of the Java being used for
> testing?
> I develop my project library using eclipse. I have set this project to use
> java 1.6 for this eclipse project. If I tell eclipse to use V1.7 my tests
> are executed in Maven using V1.7 and then my test are all fine. The problem
> is then that when I build my jar files there are conflicts between the java
> used by eclipse and the java used by Maven, and it can happen that suddenly
> the jar file is built with java classes being 1.7 instead of 1.6.
> Does anyone have an idea what I should do here?

See my answer here:

IIRC you then need to bind a second execution of tool chains after the
compile phase but before the test phase to switch to 1.7

> Thanks for your help.
> Jean

Sent from my phone

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message