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

已回答

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>

0

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

0

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

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

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

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

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

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

0

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

0

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

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

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

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

0

请先登录再写评论。