Use a top level configuration based on Java5, and define an <execution>
with ID "default" for the compile phase, based on Java 1.4.
You should use the bootclasspath to avoid your compiled code to make
reference to Java5 methods that does not exist in Java 1.4. This is a
common bug using StringBuffers in Java 1.3/1.4. I don't yet know such
error in Java5
anarkhos a écrit :
thanks indeed for the answers, but i think i couldn't make my intent clear;
the first proposed solution doesn't help, because my unit tests are written
in java1.5 syntax, so 1.3 tools can not compile them
the second proposed solution doesn't help neither because I'll be needing
both 1.4 and 1.5 level of compilation because compile phase must output in
class version .48 and testCompile must output in class version .50 and run
in a jre1.5+ . as far as I know, profiles are active throught the whole
build process.
after a little search on executions, i figured out if I can give different
configuration parameters to compiler plugin for compile phase and
test-compile phases, i'll manage to obtain a 1.4 compatible package that is
tested with 1.5 dependent unit tests. thinking this solution, i have changed
maven compiler plugin configuration in my pom.xml as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.1</version>
<executions>
<execution>
<id>productClasses</id>
<goals>
<goal>compile</goal>
</goals>
<phase>compile</phase>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</execution>
<execution>
<id>testClasses</id>
<goals>
<goal>testCompile</goal>
</goals>
<phase>test-compile</phase>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</execution>
</executions>
</plugin>
but this doesn't help me to instruct maven compiler plugin to use 1.5 for
compiling tests. any idea how to configure those compile and testCompile
goals differently will be of great use for me.
cheers ..
Allan Ramirez wrote:
See profiles
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
-allan
anarkhos wrote:
hi,
i would like to use java 1.5 in my test classes but i have a constraint
to
use java 1.4 in my product code. how can i tell maven to compile and
execute
tests in 1.5 level, while compiling and testing product code in java 1.4
?
thanks in advance,
cheers
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This message contains information that may be privileged or confidential and is
the property of the Capgemini Group. It is intended only for the person to whom
it is addressed. If you are not the intended recipient, you are not authorized
to read, print, retain, copy, disseminate, distribute, or use this message or
any part thereof. If you receive this message in error, please notify the
sender immediately and delete all copies of this message.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]