You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Roberto UserList <rc...@gmail.com> on 2007/01/15 11:58:00 UTC

Excluding source directory branches during compilation

Hi, all!
I'd like to compile a subproject with Maven2 but i'd like not to compile
files of all directory branches. How can I exclude a specific source
directory?
Tahnks in advance for help.
Regards,
Roberto.

Re: Excluding source directory branches during compilation

Posted by franz see <fr...@gmail.com>.
Good day to you, Roberto,

If you have only one source directory, you can use

<project>
  ...
  <build>
    <sourceDirectory>some/path/to/your/java/files</sourceDirectory>
  </build>
</project>

But if have several directories, on top of my head, I guess you'd have to
use the resources plugin. In your case, if you have

.
 `-- src
      `-- main
           `-- java
                |-- trash1
                |-- traxh2
                |-- trunk
                `-- branches

and you want to compile two source directories: src/main/java/trunk and
src/main/java/branches, you can try something like...

<project>
  ...

  <build>
    <resources>
      <resource>
        <directory>src/main/java/trunk</directory>
        <targetPath>../../src/main/java/merge</targetPath>
      </resource>
      <resource>
        <directory>src/main/java/branches</directory>
        <targetPath>../../src/main/java/merge</targetPath>
      </resource>
    </resources>

    <sourceDirectory>src/main/java/merge</sourceDirectory>
  </build>

</project>

This would copy your java files from trunk and branches into merge, and
compile those.

Furthermore, to ensure that the merged files are deleted when you do a mvn
clean, add this to your pom as well

<project>
  ...
  <build>
    ...

    <plugins>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>src/main/java/merge</directory>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

This will add src/main/java/merge to the list of directories maven will
delete with mvn clean.

Cheers,
Franz


Roberto UserList wrote:
> 
> Franz, what can I do if there are, for example, two more directories:
> src/main/java/trash1
> src/main/java/traxh2
> and I'd like only to compile the files inside trunk and branches
> directories?
> How can I tell Maven  not to compile files in trash1 and trash2
> directories?
> Tanks a lot in advance.
> Regards,
> Roberto.
> 
> 
> On 1/15/07, franz see <fr...@gmail.com> wrote:
>>
>>
>> Good day to you, Roberto,
>>
>> If you have something like src/main/java/trunk and
>> src/main/java/branches,
>> you can simply do
>>
>> <project>
>> ...
>> <build>
>>    <sourceDirectory>src/main/java/trunk</sourceDirectory>
>> </build>
>> </project>
>>
>> Cheers,
>> Franz
>>
>>
>> Roberto UserList wrote:
>> >
>> > Hi, all!
>> > I'd like to compile a subproject with Maven2 but i'd like not to
>> compile
>> > files of all directory branches. How can I exclude a specific source
>> > directory?
>> > Tahnks in advance for help.
>> > Regards,
>> > Roberto.
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Excluding-source-directory-branches-during-compilation-tf3013910s177.html#a8373047
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Excluding-source-directory-branches-during-compilation-tf3013910s177.html#a8382087
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Excluding source directory branches during compilation

Posted by Roberto UserList <rc...@gmail.com>.
Franz, what can I do if there are, for example, two more directories:
src/main/java/trash1
src/main/java/traxh2
and I'd like only to compile the files inside trunk and branches
directories?
How can I tell Maven  not to compile files in trash1 and trash2 directories?
Tanks a lot in advance.
Regards,
Roberto.


On 1/15/07, franz see <fr...@gmail.com> wrote:
>
>
> Good day to you, Roberto,
>
> If you have something like src/main/java/trunk and src/main/java/branches,
> you can simply do
>
> <project>
> ...
> <build>
>    <sourceDirectory>src/main/java/trunk</sourceDirectory>
> </build>
> </project>
>
> Cheers,
> Franz
>
>
> Roberto UserList wrote:
> >
> > Hi, all!
> > I'd like to compile a subproject with Maven2 but i'd like not to compile
> > files of all directory branches. How can I exclude a specific source
> > directory?
> > Tahnks in advance for help.
> > Regards,
> > Roberto.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Excluding-source-directory-branches-during-compilation-tf3013910s177.html#a8373047
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Excluding source directory branches during compilation

Posted by franz see <fr...@gmail.com>.
Good day to you, Roberto,

If you have something like src/main/java/trunk and src/main/java/branches,
you can simply do

<project>
  ...
  <build>
    <sourceDirectory>src/main/java/trunk</sourceDirectory>
  </build>
</project>

Cheers,
Franz


Roberto UserList wrote:
> 
> Hi, all!
> I'd like to compile a subproject with Maven2 but i'd like not to compile
> files of all directory branches. How can I exclude a specific source
> directory?
> Tahnks in advance for help.
> Regards,
> Roberto.
> 
> 

-- 
View this message in context: http://www.nabble.com/Excluding-source-directory-branches-during-compilation-tf3013910s177.html#a8373047
Sent from the Maven - Users mailing list archive at Nabble.com.


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