egervari
egervari

Reputation: 22512

With Maven, how do you filter a file that is not a resource but you want it to use the same filters as resources?

With Maven, how do you filter a file that is not a resource but you want it to use the same filters as resources?

Here is my resources tag in my pom.xml. The first two are working fine, because I ultimately want these files to go into the classpath. However, with the 3rd and final resource tag, I want to make sure it goes into the WEB-INF directory rather than the classes directory. My code, which I thought ought to work, actually doesn't work. How can I make this happen?

    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
        <resource>
            <directory>src/main/dict</directory>
            <filtering>false</filtering>
        </resource>
        <resource>
            <directory>src/main/webapp/WEB-INF</directory>
            <targetPath>WEB-INF</targetPath>
            <includes>
                <include>myapplication-servlet.xml</include>
            </includes>
            <filtering>true</filtering>
        </resource>
    </resources>

Upvotes: 1

Views: 178

Answers (1)

Ryan Stewart
Ryan Stewart

Reputation: 128899

That's a webapp resource and should be dealt with as such by configuring the maven war plugin appropriately. Define the resource there and turn on filtering, and you'll get the results you expect.

Upvotes: 1

Related Questions