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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/product-codes-at-java-1.4%2C-test-sources-at-java-1.5-tf2213975.html#a6133902
Sent from the Maven - Users forum at Nabble.com.


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

Reply via email to