IDEA-25934 (Maven: Webapp resources filtering) does not appear to work

Answered

My plugin configuration is as follows. Resources are not being filterd. Perhaps alternate delimiter support was not included?  I am using build 134.1007 :

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1.1</version>
        <configuration>
          <failOnMissingWebXml>false</failOnMissingWebXml>
          <webappDirectory>${application.war.directory}</webappDirectory>
          <delimiters>
            <delimiter>${*}</delimiter>
            <delimiter>@</delimiter>
          </delimiters>
          <webResources>
            <resource>
              <directory>src/main/${project.webapp.directory}</directory>
              <targetPath />
            </resource>
            <resource>
              <directory>src/main/${project.resources.directory}</directory>
              <targetPath>WEB-INF/classes</targetPath>
            </resource>
            <resource>
              <filtering>true</filtering>
              <directory>src/main/webapp/META-INF</directory>
              <includes>
                <include>context.xml</include>
              </includes>
              <targetPath>META-INF</targetPath>
            </resource>
          </webResources>
        </configuration>
      </plugin>

14 comments
Comment actions Permalink

"${*}" and "@" are default delimiters, not an alternate.
Could you provide small sample project?

0
Comment actions Permalink

You're correct, those are indeed default delimeters that we just havppen to specify. Included a small maven project with just a context.xml. Under IntelliJ, this file is copied over with @app.name@ unfiltered, whereas a mvn clean install always filters it.



Attachment(s):
testApp.tar.gz
0
Comment actions Permalink

I tried after updating to the latest build, but no luck. Perhaps I am doing something wrong in the build process. I am using a Local Tomcat server, with "Make" and "Build war" artifact before deployment. The target directory is being created, but the resources are not being resolved.

0
Comment actions Permalink

I have tried pretty much every configuration I can think of, and this feature is still not working with the latest build. Can you confirm the steps you are taking to get it to work?

Thanks

0
Comment actions Permalink

I download attached project, open it in IDEA, press "Reimport All projects", select Menu -> Build -> Build Artifacts... -> testApp:war , open "target/testApp-1.0.0-testApp/META-INF/context.xml"
The content is:
<Context path="/testApp" docBase="/home/user/tttProjects/ideaProject/target/testApp-1.0.0-testApp" debug="0" useHttpOnly="false">
</Context>

0
Comment actions Permalink

Thanks. Recreating the project worked for me for the test app (invalidating caches had not). For my actual applicaiton, properties not defined in the pom still don't work however. I have attached a new version of the previous test project where the property "testProperty" is not resolved for me, but the other now are.



Attachment(s):
ideaProject.tar.gz
0
Comment actions Permalink

Thanks for sample, fixed. Fix will be available in 13.1.2

0
Comment actions Permalink

Is that 13.1.RC2? (Want to make sure the right version has been released before I get another trial license).

0
Comment actions Permalink

No, I can't port fix to 13.1.0 , because it is not a critical fix. Fix will be available in the next EAP after release 13.1.0

0
Comment actions Permalink

I have 13.1.2 and my previous issue was successfully fixed. I now am realizing that my filtered overlays (also in the maven-war-plugin) are not working - should these be working, or is this not implemented yet?

0
Comment actions Permalink

IntelliJ IDEA's Make features are capable of filtering Maven resources. However, IntelliJ IDEA yet does not support filtering web resources.

 

https://www.jetbrains.com/help/idea/2016.3/maven.html#d1332169e308

 

0
Comment actions Permalink

What's the status here? This was reported 3 years ago. When can we expected a fix?

0

Please sign in to leave a comment.