maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wayne Fay" <wayne...@gmail.com>
Subject Re: Compiling with different configurations for main src and test src
Date Fri, 02 Feb 2007 15:10:16 GMT
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 <jwiltshire@atg.com> 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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message