Damian created MENFORCER-370:
--------------------------------

             Summary: <condition/> should not take resolved properties as Java 
string, but escape backslashes
                 Key: MENFORCER-370
                 URL: https://issues.apache.org/jira/browse/MENFORCER-370
             Project: Maven Enforcer Plugin
          Issue Type: Bug
          Components: Plugin
    Affects Versions: 3.0.0-M2
         Environment: Apache Maven 3.6.3 
(cecedd343002696d0abb50b32b541b8a6ba2883f)
Java version: 11.0.9.1, vendor: ojdkbuild
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

            Reporter: Damian


Running Maven with {{${project.basedir}}} in the 
{{<evaluateBeanshell><condition>}} in a pom.xml fails under Windows, while 
Linux is fine.
Already
{code:xml}
    <evaluateBeanshell>
        <condition>
            print(java.nio.file.Paths.get("${project.basedir}/".replace("\\", 
"/"));
            1==1
        </condition>
    </evaluateBeanshell>
{code}
fails with {{Couldn't evaluate condition...}} as {{$\{project.basedir}}} is 
apparently taken as a Java string directly, w/o escaping the backslashes.
 While the {{message}} part
{code:xml}
    <evaluateBeanshell>
        <condition>
            1==0
        </condition>
        <message>condition failed, project.basedir=${project.basedir}</message>
    </evaluateBeanshell>
{code}
logs the Windows path correctly:
{code:bash}
    [WARNING] Rule 2: org.apache.maven.plugins.enforcer.EvaluateBeanshell 
failed with message:
    condition failed, project.basedir=C:\Users\me\git\project\dir_with_pom_file
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to