This works great! However, it causes the Eclipse plugin to see the
project root as the source directory. I tried to get around it to set at
least the source directory to src and use the basedir variable on the
includes like this:

        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                    <includes>
                         <include
implementation="java.lang.String">${basedir}/src/**/*.java</include>
                         <include
implementation="java.lang.String">${basedir}/gen-src/**/*.java</include>
                    </includes>
                </configuration>
            </plugin>

The Maven log reports "No sources to compile" so it doesn't work. How
come? I noticed the eclipse plugin generates a source directory entry
for every resource you include. I managed to get my gen-src directory
added using this:

    <resources>
      <resource>
        <directory>gen-src</directory>
        <includes>
          <include>**/*.java</include>
        </includes>
      </resource>
    </resources>

This works but has an unwanted side effect as it also adds the source
code in gen-src to the artifact. 

All of the above are just hacks of get multiple source directories per
artifact in Maven. Is there a clean solution that compiles multiple
source directories, and generates the proper Eclipse projects files for
said source directories?


-----Oorspronkelijk bericht-----
Van: Aleksandar Likic [mailto:[EMAIL PROTECTED] 
Verzonden: zondag 6 november 2005 19:49
Aan: [email protected]
Onderwerp: RE: Multiple source directories (again)

OK, I found it:

        <sourceDirectory>.</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                    <includes>
                        <include
implementation="java.lang.String">src/main/java/**/*.java</include>
                        <include
implementation="java.lang.String">target/schema-src/**/*.java</include>
                    </includes>
                    <testIncludes>
                        <testInclude
implementation="java.lang.String">src/test/java/**/*.java</testInclude>
                    </testIncludes>
                </configuration>
            </plugin>

-----Original Message-----
From: Aleksandar Likic [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 06, 2005 12:50 PM
To: [email protected]
Subject: Multiple source directories (again)


I am trying to find out how to tell maven 2 to compile multiple source
directories. I am using JAXB to generate code in target/src, and then
compile it together with the rest of the code. I could have multiple
projects, but it simply doesn't make sense to me to in this particular
case.
The build process would become more complex to manage, with an extra
artifact that I don't want to have. Any ideas?


---------------------------------------------------------------------
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