Problem reading maven profile property

I have a profile in a pom file as shown below:

<profile>
            <id>local</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <application.domain>mydomain.com</application.domain>
                <application.name>MyApp</application.name>
            </properties>
 </profile>

and I read this value in the properties file as follows:

${application.name}
first.key =\u0627\u0644\u062E\u0627\u0635 \u0628\u0643 ${application.name} \u0627\u0633\u062A\u0645\u0631 \u0645\u0639 \u062D\u0633\u0627\u0628
second.key=\u061F ${application.name} \u0644\u064A\u0633 \u0644\u062F\u064A\u0643 \u062D\u0633\u0627\u0628 \u0639\u0644\u0649

it works fine with the first key, and the value is successfully replaced, but with the second and other similar keys it does not work, I don’t know why, any ideas?

+3
source share
3 answers

It worked fine with me after adding the following plugin to the pom file:

http://maven.apache.org/plugins/maven-resources-plugin/examples/encoding.html

+2
source

If you want to replace the application name in the properties file with a value in Maven pom, you must:

  • Use @variable @format in your properties file! I understand the Maven variable.
  • ( )

( UTF-8, ascii-7 ).

+1

Perhaps Maven's filtering mechanism gets confused in Unicode screens. Why not just write it to UTF-8?

first.key =الخاص بك ${application.name} استمر مع حساب
second.key${application.name} ليس لديك حساب على
0
source

All Articles