Maduranga Siriwardena
Maduranga Siriwardena

Reputation: 1361

Regular expression not working Maven assembly fileset

I am trying use regular expression in maven-assembly-plugin as shown below. There are two files starts with httpcore.

I want to exclude httpcore-4.2.4.jar but include httpcore-nio-4.2.4.jar. When the version numbers change, I don't want to change this descriptor always. So I tried to create the descriptor like below.

<fileSet>
    <directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/lib/runtimes</directory>
    <outputDirectory>${pom.artifactId}-${pom.version}/lib/runtimes/</outputDirectory>
    <excludes>
        <exclude>%regex[httpcore-([0-9.]+)\.jar]</exclude>
    </excludes>
</fileSet>

But still both files are copied.

Upvotes: 1

Views: 767

Answers (1)

Maduranga Siriwardena
Maduranga Siriwardena

Reputation: 1361

As the regular expression was not working I used below descriptor.

<fileSet>
    <directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/lib/runtimes</directory>
    <outputDirectory>${pom.artifactId}-${pom.version}/lib/runtimes/</outputDirectory>
    <excludes>
        <exclude>*/httpclient*</exclude>
        <exclude>*/httpcore*</exclude>
        <exclude>*/commons-logging*</exclude>
    </excludes>
</fileSet>
<fileSet>
    <directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/lib/runtimes</directory>
    <outputDirectory>${pom.artifactId}-${pom.version}/lib/runtimes/</outputDirectory>
    <includes>
        <include>*/httpcore-nio*</include>
    </includes>
</fileSet>

Upvotes: 0

Related Questions