Thanks.
I had just stumbled across that article too. I think I've figured out how to
achieve what I want without having to do the bootclasspath trick detailed in
that article.
The following seems to work for me now...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>java-1.3-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<source>1.3</source>
<target>1.3</target>
</configuration>
</execution>
<execution>
<id>java-1.5-compile</id>
<phase>process-test-sources</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Regards
James Wiltshire
Wayne Fay wrote:
>
> This is already documented in the Maven User Confluence:
> http://docs.codehaus.org/display/MAVENUSER/Compile+and+Test+with+Different+JDK+Versions
>
> Wayne
>
> On 2/2/07, Wiltshire, James <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I'm trying to get maven to compile the main Java source code of a
>> project using the default configuration of source=1.3, target=1.3, and
>> then to compile my test source using source=1.5, target=1.5
>>
>> My test source uses JUnit4 annotations, and so needs the JDK 1.5
>> compiler.
>>
>>
>>
>> I can get my entire project to compile with 1.5 using the following
>> configuration...
>>
>>
>>
>> <plugin>
>>
>> <groupId>org.apache.maven.plugins</groupId>
>>
>> <artifactId>maven-compiler-plugin</artifactId>
>>
>> <configuration>
>>
>> <source>1.5</source>
>>
>> <target>1.5</target>
>>
>> </configuration>
>>
>> </plugin>
>>
>>
>>
>> This works fine, however I need my main application source to use JDK1.4
>> compatible classes, and the configuration compiles everything as 1.5.
>> Here's how I'm trying to do it...
>>
>>
>>
>> <plugin>
>>
>> <groupId>org.apache.maven.plugins</groupId>
>>
>> <artifactId>maven-compiler-plugin</artifactId>
>>
>> <executions>
>>
>> <execution>
>>
>> <phase>test-compile</phase>
>>
>> <configuration>
>>
>> <source>1.5</source>
>>
>> <target>1.5</target>
>>
>> </configuration>
>>
>> <goals>
>>
>> <goal>testCompile</goal>
>>
>> </goals>
>>
>> </execution>
>>
>> </executions>
>>
>> </plugin>
>>
>>
>>
>> This doesn't work - the test-compile phase complains with errors like
>> this...
>>
>>
>>
>>
>>
>> "static import declarations are not supported in -source 1.3 (try
>> -source 1.5 to enable static import declarations)"
>>
>>
>>
>> Any idea how I can get this compiler configuration to bind to the
>> test-compile phase of the build?
>>
>>
>>
>> Thanks in advance.
>>
>> James Wiltshire
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Compiling-with-different-configurations-for-main-src-and-test-src-tf3160284s177.html#a8770432
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]