You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Emmanuel Hugonnet <eh...@orange-ftgroup.com> on 2007/03/02 10:38:33 UTC

Compilation and

Hi,
I have to compile with a different JDK in my tests from the one to 
compile my code.
I know about the codehaus wiki page ;o)
My project is a multi module project.
In some modules I need to use a jdk > 1.5 to compile the sources and the 
tests,
in some I compile the sources in 1.4 and the tests in 1.5 and last but 
not least in
the modules left I compile sources and tests in 1.4.
So I tried to put a default configuration in my project parent POM, for 
example to excludes package-info.java, etc.
Then I defined 2 executions like this (depending on my module) :
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
       <executions>
          <execution>
            <id>source-compiler</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>-->
            <configuration>
              <source>1.4</source>
              <target>1.4</target>
              <compilerArguments>
                <verbose />
                
<bootclasspath>${settings.localRepository}/com/sun/rt/1.4.2_13/rt-1.4.2_13.jar:${java.home}/lib/jsse.jar:${java.home}/lib/jce.jar</bootclasspath>
              </compilerArguments>
            </configuration>
         </execution>
          <execution>
            <id>test-compiler</id>
            <phase>process-test-sources</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <source>1.5</source>
              <target>1.5</target>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>com.sun</groupId>
            <artifactId>rt</artifactId>
            <version>1.4.2_13</version>
          </dependency>           
        </dependencies>
      </plugin>
But when I run a clean install the source-compiler execution 
configuration is not used to compile the sources while the tests are 
correctly compiled using the test-compiler configuration.
Can somebody explain this to me ?
Why is execution configuration not used on the compile phase ?
Thanks

Emmanuel

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Compilation and

Posted by Emmanuel Hugonnet <eh...@orange-ftgroup.com>.
zze-HUGONNET E ext RD-BIZZ a écrit :
> Hi,
> I have to compile with a different JDK in my tests from the one to 
> compile my code.
> I know about the codehaus wiki page ;o)
> My project is a multi module project.
> In some modules I need to use a jdk > 1.5 to compile the sources and 
> the tests,
> in some I compile the sources in 1.4 and the tests in 1.5 and last but 
> not least in
> the modules left I compile sources and tests in 1.4.
> So I tried to put a default configuration in my project parent POM, 
> for example to excludes package-info.java, etc.
> Then I defined 2 executions like this (depending on my module) :
> <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-compiler-plugin</artifactId>
>       <executions>
>          <execution>
>            <id>source-compiler</id>
>            <phase>compile</phase>
>            <goals>
>              <goal>compile</goal>
>            </goals>-->
>            <configuration>
>              <source>1.4</source>
>              <target>1.4</target>
>              <compilerArguments>
>                <verbose />
>                
> <bootclasspath>${settings.localRepository}/com/sun/rt/1.4.2_13/rt-1.4.2_13.jar:${java.home}/lib/jsse.jar:${java.home}/lib/jce.jar</bootclasspath> 
>
>              </compilerArguments>
>            </configuration>
>         </execution>
>          <execution>
>            <id>test-compiler</id>
>            <phase>process-test-sources</phase>
>            <goals>
>              <goal>testCompile</goal>
>            </goals>
>            <configuration>
>              <source>1.5</source>
>              <target>1.5</target>
>            </configuration>
>          </execution>
>        </executions>
>        <dependencies>
>          <dependency>
>            <groupId>com.sun</groupId>
>            <artifactId>rt</artifactId>
>            <version>1.4.2_13</version>
>          </dependency>                  </dependencies>
>      </plugin>
> But when I run a clean install the source-compiler execution 
> configuration is not used to compile the sources while the tests are 
> correctly compiled using the test-compiler configuration.
> Can somebody explain this to me ?
> Why is execution configuration not used on the compile phase ?
> Thanks
>
> Emmanuel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Ok I understand my error :
The compilation in execution is run after the compilation of the compile 
phase. Since i the code as already been compiled, it is not recompiled. 
that 's why the tests compilation is done on phase process-test-sources 
and not on test.
Emmanuel

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org