The wiki page explain a solution I've found to compile for a target 1.3 Jre
with using another JRE to support dev tools, like some testing / mock tools
that require java5.

The goal is not to test under various JRE, just to assert the binaries will
not reference methods that do not exist under java1.3 (or other target JRE)

To run tests under an alternative JRE, you will have to launch another
process with target JRE java.exe. This is not supported by surefire now. I
don't know how difficult it would be to add such a feature, as surefire runs
as a maven plugin and not as a standalone process...

The simpliest way should be to use some continuous integration build server
with various JRE to run tests.


2007/2/19, JC Walmetz <[EMAIL PROTECTED]>:


What I'd like to do is to execute tests in  1.5 and 1.6. Changing the
rt.jar
is not enough. By the past we had trouble with bugs in JDK. Just changing
the rt.jar is not enough. We really need to use another JDK.

What I'd like to do is during the dev to use JDK 1.5, to release with the
JDK 1.5 and then to perform tests using the jar created during the
release.

It means that for the release, tests uses the classes compile in the
compile
phase. When tested in JDK, I'd like to use the jar for sources deploy in
my
repository.

To do that I have tried several solutions:
1- Generate a jar for sources and tests. Unfortunatelly, I have not been
able to configure surefire plugin to search for JUnit tests in a Jar. It
looks like the plugin searches only tests in the test directory.
2- Write another project just for tests. It uses tests sources and
recompile
it (no very convenient solution in the SCM). Problem with that solution is
that I have to write for each module two projects (one for the dev and
another for the tests in JDK 1.6).
3-Try to use profile: I do not want to recompile sources. With profile I
have not been able to disable generation of jar.

None of this solution looks really friendly.


Wayne Fay wrote:
>
> This is discussed now and then on this list with various approaches
> posted, so search the Archives.
>
> Also, this is discussed in the Wiki:
>
http://docs.codehaus.org/display/MAVENUSER/Compile+and+Test+with+Different+JDK+Versions
>
> I have to imagine you could utilize various configurations in multiple
> profiles to achieve your goals without a lot of trouble.
>
> Wayne
>
> On 2/15/07, JC Walmetz <[EMAIL PROTECTED]> wrote:
>>
>> I need to compile and deploy my sources in JDK1.4. Tests are executed
>> with
>> JDK 1.4.
>>
>> Now I'd like to run all the tests without recompiling sources (I'd like
>> to
>> recompile only tests) I'd like to test my jars compile with JDK1.4 with
>> other JDK (1.5 and 1.6).
>>
>> The only solution I found is to create another project for tests in
>> JDK1.5
>> and to play with my SCM to create alias over test sources. That's
>> definitively a bad solution. A lot of code of the pom.xml is duplicated
>> and
>> I have to maintain the alias in the SCM.
>>
>> Do you have a better solution ?
>>
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/Compile-with-one-JDK-and-tests-with-several-tf3235157s177.html#a8990300
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

--
View this message in context:
http://www.nabble.com/Compile-with-one-JDK-and-tests-with-several-tf3235157s177.html#a9038690
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to