You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Christian Goetze <ch...@sensage.com> on 2006/12/05 02:17:20 UTC

How to ignore certain files in the source tree

Sorry if this is another FAQ, but I can't find an easy answer...

I would like to systematically ignore certain source files in the build. 
I don;t want them to appear in my jars or any other artifacts. Is there 
a global way to exclude them?
--
cg

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


Re: How to ignore certain files in the source tree

Posted by Neeraj Bisht <ne...@daffodildb.com>.
use exclude inside the resource tag for the file which you not needed

and in resource directory use the src\main\java

it is worked in maven 1.x

but not sure about in maven 2.x

i think it will work on it also


Regards
Neeraj


On 12/5/06, Christian Goetze <ch...@sensage.com> wrote:
>
> Wendy Smoak wrote:
>
> > On 12/4/06, Christian Goetze <ch...@sensage.com> wrote:
> >
> >> > Where are the files located, and what type of files are they?
> >>
> >> They are "." files generated by the build system into which I'm
> >> embedding maven. They contain additional metadata about the files and I
> >> do not have the option of moving them around. They will appear wherever
> >> source files exist, and they seem to end up in the jars generated by
> the
> >> packaging.
> >
> >
> > If they are under src/main/java, it's odd that they're getting
> > included.  IME only .java files from there get compiled, everything
> > else is ignored.  (For example, if you have .properties files stored
> > with your source code, you have to add a <resource> to pick them up.)
> >
> You're right - the file ended up included via a filtered resource, and
> my exclude didn't immediately do the job because I didn't say "mvn
> clean"...
> ... which leads me to another gripe about maven, namely that
> incremental builds are not very robust ... but I know quite well that
> this is a very hard problem (hence the metadata files of the embedding
> build system etc... )
> --
> cg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: How to ignore certain files in the source tree

Posted by Christian Goetze <ch...@sensage.com>.
Wendy Smoak wrote:

> On 12/4/06, Christian Goetze <ch...@sensage.com> wrote:
>
>> > Where are the files located, and what type of files are they?
>>
>> They are "." files generated by the build system into which I'm
>> embedding maven. They contain additional metadata about the files and I
>> do not have the option of moving them around. They will appear wherever
>> source files exist, and they seem to end up in the jars generated by the
>> packaging.
>
>
> If they are under src/main/java, it's odd that they're getting
> included.  IME only .java files from there get compiled, everything
> else is ignored.  (For example, if you have .properties files stored
> with your source code, you have to add a <resource> to pick them up.)
>
You're right - the file ended up included via a filtered resource, and 
my exclude didn't immediately do the job because I didn't say "mvn clean"...
 ... which leads me to another gripe about maven, namely that 
incremental builds are not very robust ... but I know quite well that 
this is a very hard problem (hence the metadata files of the embedding 
build system etc... )
--
cg

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


Re: How to ignore certain files in the source tree

Posted by Wendy Smoak <ws...@gmail.com>.
On 12/4/06, Christian Goetze <ch...@sensage.com> wrote:

> > Where are the files located, and what type of files are they?
>
> They are "." files generated by the build system into which I'm
> embedding maven. They contain additional metadata about the files and I
> do not have the option of moving them around. They will appear wherever
> source files exist, and they seem to end up in the jars generated by the
> packaging.

If they are under src/main/java, it's odd that they're getting
included.  IME only .java files from there get compiled, everything
else is ignored.  (For example, if you have .properties files stored
with your source code, you have to add a <resource> to pick them up.)

> I'm wondering if there isn't an option for the maven-jar-plugin, but I
> can't seem to find any.

The location of sources and resources is a <build> level thing, not
specific to the jar plugin.

-- 
Wendy

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


Re: How to ignore certain files in the source tree

Posted by Christian Goetze <ch...@sensage.com>.
Wendy Smoak wrote:

> On 12/4/06, Christian Goetze <ch...@sensage.com> wrote:
>
>> I would like to systematically ignore certain source files in the build.
>> I don;t want them to appear in my jars or any other artifacts. Is there
>> a global way to exclude them?
>
>
> Where are the files located, and what type of files are they?

They are "." files generated by the build system into which I'm 
embedding maven. They contain additional metadata about the files and I 
do not have the option of moving them around. They will appear wherever 
source files exist, and they seem to end up in the jars generated by the 
packaging.

> If they are under src/main/resources, you can use <resource><excludes>
> to ignore them.
>
>   http://maven.apache.org/ref/2.0.4/maven-model/maven.html
>
I'm wondering if there isn't an option for the maven-jar-plugin, but I 
can't seem to find any.
--
cg


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


Re: How to ignore certain files in the source tree

Posted by Wendy Smoak <ws...@gmail.com>.
On 12/4/06, Christian Goetze <ch...@sensage.com> wrote:

> I would like to systematically ignore certain source files in the build.
> I don;t want them to appear in my jars or any other artifacts. Is there
> a global way to exclude them?

Where are the files located, and what type of files are they?

One option is to move them to a directory structure that is not used
by default.  For example, I put Selenium tests in src/test/selenium,
and Maven ignores them (unless I activate a profile that is
specifically configured to do something with them.)

If they are under src/main/resources, you can use <resource><excludes>
to ignore them.

   http://maven.apache.org/ref/2.0.4/maven-model/maven.html

-- 
Wendy

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