How to expand property references in jar resources?

前端 未结 5 1947
挽巷
挽巷 2021-01-12 06:47

I\'m using Gradle to build a jar containing an xml file in META-INF. This file has a row like



        
5条回答
  •  一个人的身影
    2021-01-12 07:12

    In addition to @emil-lundberg 's excellent solution, I'd limit the resource processing to just the desired target file:

    build.gradle

    processResources {
        filesMatching("**/applicationContext.xml") {
            expand(project: project)
        }
    }
    

    An additional note: if the ${...} parentheses are causing "Could not resolve placeholder" errors, you can alternatively use <%=...%>. N.B. tested with a *.properties file, not sure how this would work for an XML file.

提交回复
热议问题