0

I have a project with sample structure as :

jcr_root |_apps |_A |_B |_etc |_A |_B

What I need to do is while creating a package, I need to include either "apps/A & etc/A" or "apps/B & etc/B"

In my pom.xml, I tried something like :

<resources>
       <resource>
        <directory>src/main/content/jcr_root</directory>
            <excludes>
            <exclude>apps/A/**</exclude>
                        <exclude>etc/A/**</exclude>
                </excludes>
     </resource>
</resources>

But still both 'A' and 'B' under apps and etc get included while packaging. I'm using content-package-maven-plugin to build a package that would be deployed on CQ.

I tried putting entries in filter.xml but then it is used while deployment and not while packaging.

It seems, the include/exclude tags are not at all working. For testing, I tried:

<resources>
   <resource>
    <directory>src/main/content/jcr_root</directory>
        <excludes>
        <exclude>**/*.otf</exclude>
                    </excludes>
   </resource>
</resources>

But still fonts.otf file was getting included in the packaged zip.

Some help or hints please. Let me know if any more info is required.

Many Thanks in Advance.

Racil Hilan
  • 24,690
  • 13
  • 50
  • 55
San7988
  • 106
  • 1
  • 7

2 Answers2

1

So finally I was able to create a package with the excluded resources.

The issue was not with the include/exclude tag(they always worked fine.)

The files after excluding some resource were copied to "target/classes" directory Issue was that the maven-content-package plugin took the resource to package from original source directory rather than the "target/classes" directory created.Thus it always included everything. This is the default behaviour of maven-content-package plugin.

Thus I had to explicitly tell the plugin that you need to pick the resource to package from "target/classes".

<builtContentDirectory>${basedir}/target/classes</builtContentDirectory>

Please let me know if anyone needs more detail. Thanks for all your answers:)

San7988
  • 106
  • 1
  • 7
0

Since you want to include jcr_root/app/A and jcr_root/etc/A Please you try using this in POM.xml:

<project>
    ...
    <resources>
    <resource>
        <directory>jcr_root</directory>
        <includes>
            <include>**/*A*</include>
        </includes>
        <excludes>
            <exclude>**/*B*</exclude>
        </excludes>
    </resource>
    <resources>
</project>

Similarly you can do it for getting jcr_root/app/B and jcr_root/etc/B.

Regards

Jyotsna

Leos Literak
  • 8,805
  • 19
  • 81
  • 156
Jyotsna Saroha
  • 678
  • 6
  • 13
  • Hi Jyotsana, thanx for your response. I tried the suggestion as above but it didn help. src/main/content/jcr_root **/*A* **/*B* – San7988 Mar 14 '14 at 05:52