<?xml version="1.0" encoding="UTF-8"?> <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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
<groupId>localdomain.localhost</groupId> <artifactId>localtest</artifactId> <version>0.1-SNAPSHOT</version> <build> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>META-INF/**/*</include> </includes> </resource> </resources> </build> </project> works for me $ find . . ./pom.xml ./src ./src/main ./src/main/resources ./src/main/resources/foo ./src/main/resources/META-INF ./src/main/resources/META-INF/sample $ mvn clean package ... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.696s [INFO] Finished at: Mon Jun 27 12:18:10 IST 2011 [INFO] Final Memory: 4M/81M [INFO] ------------------------------------------------------------------------ $ unzip -l target/localtest-0.1-SNAPSHOT.jar Archive: target/localtest-0.1-SNAPSHOT.jar Length Date Time Name -------- ---- ---- ---- 0 06-27-11 12:18 META-INF/ 127 06-27-11 12:18 META-INF/MANIFEST.MF 0 06-27-11 12:18 META-INF/sample 0 06-27-11 12:18 META-INF/maven/ 0 06-27-11 12:18 META-INF/maven/localdomain.localhost/ 0 06-27-11 12:18 META-INF/maven/localdomain.localhost/localtest/ 607 06-27-11 12:14 META-INF/maven/localdomain.localhost/localtest/pom.xml 122 06-27-11 12:18 META-INF/maven/localdomain.localhost/localtest/pom.properties -------- ------- 856 8 files No foo file in the jar On 27 June 2011 12:02, Guillaume Polet <guillaume.po...@gmail.com> wrote: > Indeed, this is probably what we should do, but yet (for some probably poor > reason) I would like to keep everything in the same folder (actually the > other resources will be embedded in an additional artifact created with > Maven assembly). My only question is why do I get everything when I use the > following patterns > > <build> > <resources> > <resource> > <directory>src/main/resources</directory> > <includes> > <include>META-INF/**/*</include> > </includes> > </resource> > </resources> > ... > </build> > > while according to what you said, this should not be the case? > > Anyway, I found the solution to my problem (although I hardly understand why > I get the expected result) but using : > <resources> > <resource> > <directory>src/main/resources</directory> > <excludes> > <exclude>**/*</exclude> > </excludes> > </resource> > <resource> > <directory>src/main/resources</directory> > <includes> > <include>META-INF/**/*</include> > </includes> > </resource> > </resources> > > gives me exactly what I expected. > > -- > Guillaume > Le 27/06/2011 10:58, Stephen Connolly a écrit : >> >> If they are files that are not needed in the final package, don't keep >> them in src/main/resources >> >> On 27 June 2011 09:56, Guillaume Polet<guillaume.po...@gmail.com> wrote: >>> >>> Ok, sorry about that but I did not see my e-mails coming back to my >>> posting >>> address so I thought the e-mails had been blacklisted for some reason; I >>> didn't know that we don't receive the e-mails we send to the ML. >>> >>> For the second part, I do want my files within META-INF to be embedded in >>> my >>> final package. However, the ones that are next to my META-INF directory >>> should not be included and I was unable to perform this so far. >>> It just seems that my inclusion pattern is not considered and it embeds >>> everything anyway although I specifically indicated to embed only >>> META-INF/**/*. >>> >>> Again sorry for the spam, it was never my intent to flood the ML. >>> >>> Cheers, >>> >>> Guillaume >>> >>> Le 27/06/2011 10:50, Stephen Connolly a écrit : >>>> >>>> Please stop reposting the same question in a different thread. This is >>>> not >>>> the way to get attention... even just replying to your initial question >>>> would be better. >>>> >>>> Includes are applied first followed by excludes to trim out the stuff >>>> you >>>> added in the includes... >>>> >>>> If you don't specify includes, the default is to include everything. >>>> >>>> I'm not seeing your problem myself... if you don't want the files to be >>>> included, then don't put the files in src/main/resources/META-INF in the >>>> first place >>>> >>>> if they are test resources, you should be putting them in >>>> src/test/resources/META-INF and that way they won't end up in the jar. >>>> >>>> if they are required files in META-INF, e.g. META-INF/MANIFEST.MF then >>>> don't >>>> create a jar create a zip instead (hint maven assembly plugin) >>>> >>>> -Stephen >>>> >>>> On 27 June 2011 09:21, Guillaume Polet<macha...@hotmail.com> wrote: >>>> >>>>> Hi All, >>>>> >>>>> >>>>> >>>>> I am working on a project were I would like to exclude all resources >>>>> >>>>> except the ones located within META-INF. After reading carefuly the >>>>> >>>>> documentation, it appears that excludes always beats includes, so >>>>> doing >>>>> >>>>> what would only be natural, does not work: >>>>> >>>>> <build> >>>>> >>>>> <resources> >>>>> >>>>> <resource> >>>>> >>>>> <directory>src/main/resources</directory> >>>>> >>>>> <excludes> >>>>> >>>>> <exclude>**/*</exclude> >>>>> >>>>> </excludes> >>>>> >>>>> <includes> >>>>> >>>>> <include>META-INF/**/*</include> >>>>> >>>>> </includes> >>>>> >>>>> </resource> >>>>> >>>>> </resources> >>>>> >>>>> ... >>>>> >>>>> </build> >>>>> >>>>> >>>>> >>>>> So my second guess was to do the following: >>>>> >>>>> >>>>> >>>>> <build> >>>>> >>>>> <resources> >>>>> >>>>> <resource> >>>>> >>>>> <directory>src/main/resources</directory> >>>>> >>>>> <includes> >>>>> >>>>> <include>META-INF/**/*</include> >>>>> >>>>> </includes> >>>>> >>>>> </resource> >>>>> >>>>> </resources> >>>>> >>>>> ... >>>>> >>>>> </build> >>>>> >>>>> >>>>> >>>>> but still not what I want because I end up with everything. >>>>> >>>>> --> what is the purpose of include patterns, if they embed >>>>> everything >>>>> >>>>> anyway? >>>>> >>>>> >>>>> >>>>> Is there a way to do what I want without having to use an additional >>>>> >>>>> resource directory? >>>>> >>>>> >>>>> >>>>> My configuration details : >>>>> >>>>> Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100) >>>>> >>>>> Maven home: D:\apache-maven-3.0.3\bin\.. >>>>> >>>>> Java version: 1.6.0_16, vendor: Sun Microsystems Inc. >>>>> >>>>> Java home: C:\Program Files\Java\jdk1.6.0_16\jre >>>>> >>>>> Default locale: fr_BE, platform encoding: Cp1252 >>>>> >>>>> OS name: "windows xp", version: "5.1", arch: "x86", family: >>>>> "windows" >>>>> >>>>> >>>>> >>>>> Many thanks, >>>>> >>>>> >>>>> >>>>> Guillaume >>>>> >>>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >>> For additional commands, e-mail: users-h...@maven.apache.org >>> >>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org