Sunday 15 February 2015

properties - How to filter with maven on only one property -


I want to filter with Maven on a single property with maven-war-plugin

I have properties:

  • key1 = value1
  • key2 = value2

    and a file: index.html

    • Hello $ {key1} - $ {key2}

      Actual results after filtering:

      • Hello price1 - value2 < Expected Result: I only want to filter property on 'key1'
        • Hello price 1 - $ {key2}

          My pom.xml:

            & lt; Plugin & gt; & Lt; Group & gt; Org.apache.maven.plugins & lt; / Group & gt; & Lt; ArtifactId & gt; Maven War Plugin & lt; / ArtifactId> & Lt; Configuration & gt; & Lt; WebResources & gt; & Lt; Resources & gt; & Lt; Filtering & gt; True & lt; / Filtering & gt; & Lt; Directory & gt; $ {Project.basedir} / src / home / webapp & lt; / Directory & gt; & Lt; / Resources & gt; & Lt; / WebResources & gt; & Lt; / Configuration & gt; & Lt; / Plugin & gt;   

          Please help me, thank you

          from your properties file There is a clear way to remove key2 . If this is not an option, the filtering mechanism provides an escoststring (read more about it). By default, this is a backslash.

          In the index.html file

            will be $ {key1} - \ $ {key2}   

          and filtering output

            Hello value1 - $ {key2}   

          I have not really seen it with web resources, although I know this is a regular project resources works with.

No comments:

Post a Comment