Yes it is odd, but I share jason's concern that sending the source
folders directly to the compiler plugin is bad because then tools that
look at the pom won't find the sources. (which btw is the case even with
the buildhelper)
-----Original Message-----
From: Paul Gier [mailto:[email protected]] 
Sent: Friday, March 13, 2009 4:51 PM
To: Maven Developers List
Subject: Re: svn commit: r753302 - in
/maven/plugins/trunk/maven-compiler-plugin/src:
it/alt-src-output-directories-MCOMPILER-91/
it/alt-src-output-directories-MCOMPILER-91/src/
it/alt-src-output-directories-MCOMPILER-91/src/my-classes/
it/alt-src-output-directori

Yeah, it probably could be done like that.  But it seems a little
strange way to 
accomplish it.
Also that would put all the output into a single directory, and I would
prefer 
to keep the classes separate in the output.

Brian E. Fox wrote:
> Can you do it with multiple compiler executions? I'm thinking
something
> like add all the src folders, and then exclude them in one execution
and
> vice-versa in the other. 
> 
> -----Original Message-----
> From: Paul Gier [mailto:[email protected]] 
> Sent: Friday, March 13, 2009 4:15 PM
> To: Maven Developers List
> Subject: Re: svn commit: r753302 - in
> /maven/plugins/trunk/maven-compiler-plugin/src:
> it/alt-src-output-directories-MCOMPILER-91/
> it/alt-src-output-directories-MCOMPILER-91/src/
> it/alt-src-output-directories-MCOMPILER-91/src/my-classes/
> it/alt-src-output-directori
> 
> The build helper plugin allows me to add more source directories, but
> doesn't 
> allow me to have different compiler configurations for the different 
> directories.  And also doesn't allow me to specify separate output
> directories.
> 
> I have some situations where it is useful to have two separate test
> sources that 
> are compiled differently and then output to different locations.  For
> the main 
> sources it's not as much of an issue.
> 
> Brian E. Fox wrote:
>> Why doesn't the buildhelper plugin work for this use case? That lets
> you
>> attach many source folders.
>>
>> -----Original Message-----
>> From: Paul Gier [mailto:[email protected]] 
>> Sent: Friday, March 13, 2009 2:58 PM
>> To: Maven Developers List
>> Subject: Re: svn commit: r753302 - in
>> /maven/plugins/trunk/maven-compiler-plugin/src:
>> it/alt-src-output-directories-MCOMPILER-91/
>> it/alt-src-output-directories-MCOMPILER-91/src/
>> it/alt-src-output-directories-MCOMPILER-91/src/my-classes/
>> it/alt-src-output-directori
>>
>> Do you have an issue with it in both the compile and test-compile
> mojos?
>> Or is 
>> the test-compile mojo ok?
>> The test-compile mojo is where I need it because I have multiple sets
> of
>> test 
>> classes that require different compile parameters.
>>
>> Jason van Zyl wrote:
>>> -1
>>>
>>> I don't want people to start abusing this and directly using
multiple
> 
>>> source directories. This will get abused so fast and is only
required
>> by 
>>> people who have messed up systems.
>>>
>>> On 13-Mar-09, at 8:37 AM, [email protected] wrote:
>>>
>>>> Author: pgier
>>>> Date: Fri Mar 13 15:37:13 2009
>>>> New Revision: 753302
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=753302&view=rev
>>>> Log:
>>>> [MCOMPILER-91] Allow source and output directories to be
configured.
>>>> Patch from Peter Janes (peterj).
>>>>
>>>> Added:
>>>>    
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/ 
>>>>    
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/pom.xml   
>>>> (with props)
>>>>    
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/src/ 
>>>>    
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/src/my-classes/ 
>>>>    
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/src/my-classes/java/ 
>>>>    
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/src/my-classes/java/MyTest.java   
>>>> (with props)
>>>>    
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/verify.bsh   
>>>> (with props)
>>>> Modified:
>>>>    
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven
>> /plugin/CompilerMojo.java 
>>>>    
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven
>> /plugin/TestCompilerMojo.java 
>>>> Added: 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/pom.xml 
>>>> URL: 
>>>>
>
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/s
>
rc/it/alt-src-output-directories-MCOMPILER-91/pom.xml?rev=753302&view=au
>> to 
>
========================================================================
>> ====== 
>>>> --- 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/pom.xml 
>>>> (added)
>>>> +++ 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/pom.xml 
>>>> Fri Mar 13 15:37:13 2009
>>>> @@ -0,0 +1,82 @@
>>>> +<?xml version="1.0" encoding="UTF-8"?>
>>>> +<!--
>>>> +  ~ Licensed to the Apache Software Foundation (ASF) under one
>>>> +  ~ or more contributor license agreements.  See the NOTICE file
>>>> +  ~ distributed with this work for additional information
>>>> +  ~ regarding copyright ownership.  The ASF licenses this file
>>>> +  ~ to you under the Apache License, Version 2.0 (the
>>>> +  ~ "License"); you may not use this file except in compliance
>>>> +  ~ with the License.  You may obtain a copy of the License at
>>>> +  ~
>>>> +  ~   http://www.apache.org/licenses/LICENSE-2.0
>>>> +  ~
>>>> +  ~ Unless required by applicable law or agreed to in writing,
>>>> +  ~ software distributed under the License is distributed on an
>>>> +  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> +  ~ KIND, either express or implied.  See the License for the
>>>> +  ~ specific language governing permissions and limitations
>>>> +  ~ under the License.
>>>> +  -->
>>>> +
>>>> +<project xmlns="http://maven.apache.org/POM/4.0.0";
>>>> +         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>>> +         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
>>>> http://maven.apache.org/maven-v4_0_0.xsd";>
>>>> +  <modelVersion>4.0.0</modelVersion>
>>>> +
>>>> +  <groupId>org.apache.maven.plugins.compiler</groupId>
>>>> +  <artifactId>altconfig</artifactId>
>>>> +  <version>1.0-SNAPSHOT</version>
>>>> +
>>>> +  <name>Test for alternative source/target configuration</name>
>>>> +
>>>> +  <properties>
>>>> +
>> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>>>> +  </properties>
>>>> +
>>>> +  <dependencies>
>>>> +    <dependency>
>>>> +      <groupId>junit</groupId>
>>>> +      <artifactId>junit</artifactId>
>>>> +      <version>3.8.2</version>
>>>> +    </dependency>
>>>> +  </dependencies>
>>>> +
>>>> +  <build>
>>>> +    <plugins>
>>>> +      <plugin>
>>>> +        <groupId>org.apache.maven.plugins</groupId>
>>>> +        <artifactId>maven-compiler-plugin</artifactId>
>>>> +        <version>@pom.version@</version>
>>>> +        <executions>
>>>> +          <execution>
>>>> +            <id>my-classes</id>
>>>> +            <phase>compile</phase>
>>>> +            <goals>
>>>> +              <goal>compile</goal>
>>>> +            </goals>
>>>> +            <configuration>
>>>> +              <compileSourceRoots>
>>>> +                
>>>> <compileSourceRoot>src/my-classes/java</compileSourceRoot>
>>>> +              </compileSourceRoots>
>>>> +              <outputDirectory>target/my-classes</outputDirectory>
>>>> +            </configuration>
>>>> +          </execution>
>>>> +          <execution>
>>>> +            <id>my-test-classes</id>
>>>> +            <phase>test-compile</phase>
>>>> +            <goals>
>>>> +              <goal>testCompile</goal>
>>>> +            </goals>
>>>> +            <configuration>
>>>> +              <compileSourceRoots>
>>>> +                
>>>> <compileSourceRoot>src/my-classes/java</compileSourceRoot>
>>>> +              </compileSourceRoots>
>>>> +
>> <outputDirectory>target/my-test-classes</outputDirectory>
>>>> +            </configuration>
>>>> +          </execution>
>>>> +        </executions>
>>>> +      </plugin>
>>>> +    </plugins>
>>>> +  </build>
>>>> +
>>>> +</project>
>>>>
>>>> Propchange: 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/pom.xml 
>
------------------------------------------------------------------------
>> ------ 
>>>>    svn:eol-style = native
>>>>
>>>> Propchange: 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/pom.xml 
>
------------------------------------------------------------------------
>> ------ 
>>>>    svn:keywords = Author Date Id Revision
>>>>
>>>> Added: 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/src/my-classes/java/MyTest.java 
>>>> URL: 
>>>>
>
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/s
>
rc/it/alt-src-output-directories-MCOMPILER-91/src/my-classes/java/MyTest
>> .java?rev=753302&view=auto 
>
========================================================================
>> ====== 
>>>> --- 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/src/my-classes/java/MyTest.java 
>>>> (added)
>>>> +++ 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/src/my-classes/java/MyTest.java 
>>>> Fri Mar 13 15:37:13 2009
>>>> @@ -0,0 +1,7 @@
>>>> +import junit.framework.TestCase;
>>>> +
>>>> +public class MyTest
>>>> +    extends TestCase
>>>> +{
>>>> +
>>>> +}
>>>>
>>>> Propchange: 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/src/my-classes/java/MyTest.java 
>
------------------------------------------------------------------------
>> ------ 
>>>>    svn:eol-style = native
>>>>
>>>> Propchange: 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/src/my-classes/java/MyTest.java 
>
------------------------------------------------------------------------
>> ------ 
>>>>    svn:keywords = Author Date Id Revision
>>>>
>>>> Added: 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/verify.bsh 
>>>> URL: 
>>>>
>
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/s
>
rc/it/alt-src-output-directories-MCOMPILER-91/verify.bsh?rev=753302&view
>> =auto 
>
========================================================================
>> ====== 
>>>> --- 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/verify.bsh 
>>>> (added)
>>>> +++ 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/verify.bsh 
>>>> Fri Mar 13 15:37:13 2009
>>>> @@ -0,0 +1,24 @@
>>>> +import java.io.*;
>>>> +
>>>> +try
>>>> +{
>>>> +    File outputClasses = new File( basedir, 
>>>> "target/my-classes/MyTest.class" );
>>>> +    if ( !outputClasses.isFile() )
>>>> +    {
>>>> +        System.out.println( "Test class not existent: " + 
>>>> outputClasses );
>>>> +        return false;
>>>> +    }
>>>> +    File outputTestClasses = new File( basedir, 
>>>> "target/my-test-classes/MyTest.class" );
>>>> +    if ( !outputTestClasses.isFile() )
>>>> +    {
>>>> +        System.out.println( "Test class not existent: " + 
>>>> outputTestClasses );
>>>> +        return false;
>>>> +    }
>>>> +}
>>>> +catch( Throwable t )
>>>> +{
>>>> +    t.printStackTrace();
>>>> +    return false;
>>>> +}
>>>> +
>>>> +return true;
>>>>
>>>> Propchange: 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/verify.bsh 
>
------------------------------------------------------------------------
>> ------ 
>>>>    svn:eol-style = native
>>>>
>>>> Propchange: 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/it/alt-src-output-director
>> ies-MCOMPILER-91/verify.bsh 
>
------------------------------------------------------------------------
>> ------ 
>>>>    svn:keywords = Author Date Id Revision
>>>>
>>>> Modified: 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven
>> /plugin/CompilerMojo.java 
>>>> URL: 
>>>>
>
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/s
>
rc/main/java/org/apache/maven/plugin/CompilerMojo.java?rev=753302&r1=753
>> 301&r2=753302&view=diff 
>
========================================================================
>> ====== 
>>>> --- 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven
>> /plugin/CompilerMojo.java 
>>>> (original)
>>>> +++ 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven
>> /plugin/CompilerMojo.java 
>>>> Fri Mar 13 15:37:13 2009
>>>> @@ -45,11 +45,18 @@
>>>>     extends AbstractCompilerMojo
>>>> {
>>>>     /**
>>>> +     * The default source directories containing the sources to be

>>>> compiled.
>>>> +     *
>>>> +     * @parameter default-value="${project.compileSourceRoots}"
>>>> +     *
>>>> +     */
>>>> +    private List defaultCompileSourceRoots;
>>>> +
>>>> +    /**
>>>>      * The source directories containing the sources to be
compiled.
>>>>      *
>>>> -     * @parameter expression="${project.compileSourceRoots}"
>>>> -     * @required
>>>> -     * @readonly
>>>> +     * @parameter
>>>> +     *
>>>>      */
>>>>     private List compileSourceRoots;
>>>>
>>>> @@ -65,9 +72,8 @@
>>>>     /**
>>>>      * The directory for compiled classes.
>>>>      *
>>>> -     * @parameter expression="${project.build.outputDirectory}"
>>>> +     * @parameter default-value="${project.build.outputDirectory}"
>>>>      * @required
>>>> -     * @readonly
>>>>      */
>>>>     private File outputDirectory;
>>>>
>>>> @@ -97,6 +103,10 @@
>>>>
>>>>     protected List getCompileSourceRoots()
>>>>     {
>>>> +        if( compileSourceRoots == null )
>>>> +        {
>>>> +            compileSourceRoots = defaultCompileSourceRoots;
>>>> +        }
>>>>         return compileSourceRoots;
>>>>     }
>>>>
>>>>
>>>> Modified: 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven
>> /plugin/TestCompilerMojo.java 
>>>> URL: 
>>>>
>
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/s
>
rc/main/java/org/apache/maven/plugin/TestCompilerMojo.java?rev=753302&r1
>> =753301&r2=753302&view=diff 
>
========================================================================
>> ====== 
>>>> --- 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven
>> /plugin/TestCompilerMojo.java 
>>>> (original)
>>>> +++ 
>>>>
>
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven
>> /plugin/TestCompilerMojo.java 
>>>> Fri Mar 13 15:37:13 2009
>>>> @@ -52,11 +52,18 @@
>>>>     private boolean skip;
>>>>
>>>>     /**
>>>> -     * The source directories containing the test-source to be
>> compiled.
>>>> +     * The default source directories containing the test-source
to
> 
>>>> be compiled.
>>>>      *
>>>> -     * @parameter expression="${project.testCompileSourceRoots}"
>>>> -     * @required
>>>> +     * @parameter
default-value="${project.testCompileSourceRoots}"
>>>>      * @readonly
>>>> +     * @required
>>>> +     */
>>>> +    private List defaultCompileSourceRoots;
>>>> +
>>>> +    /**
>>>> +     * The source directories containing the test-source to be
>> compiled.
>>>> +     *
>>>> +     * @parameter
>>>>      */
>>>>     private List compileSourceRoots;
>>>>
>>>> @@ -72,9 +79,8 @@
>>>>     /**
>>>>      * The directory where compiled test classes go.
>>>>      *
>>>> -     * @parameter
expression="${project.build.testOutputDirectory}"
>>>> +     * @parameter
>> default-value="${project.build.testOutputDirectory}"
>>>>      * @required
>>>> -     * @readonly
>>>>      */
>>>>     private File outputDirectory;
>>>>
>>>> @@ -149,6 +155,10 @@
>>>>
>>>>     protected List getCompileSourceRoots()
>>>>     {
>>>> +        if( compileSourceRoots == null )
>>>> +        {
>>>> +            compileSourceRoots = defaultCompileSourceRoots;
>>>> +        }
>>>>         return compileSourceRoots;
>>>>     }
>>>>
>>>>
>>>>
>>> Thanks,
>>>
>>> Jason
>>>
>>> ----------------------------------------------------------
>>> Jason van Zyl
>>> Founder,  Apache Maven
>>> http://twitter.com/jvanzyl
>>> ----------------------------------------------------------
>>>
>>>
>>>
>>>
---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to