maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wiltshire, James" <jwiltsh...@atg.com>
Subject Compiling with different configurations for main src and test src
Date Fri, 02 Feb 2007 10:41:26 GMT
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

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message