unable to read system properties inside jar which is in classpath of another java project

StackOverflow https://stackoverflow.com/questions/23128048

  •  05-07-2023
  •  | 
  •  

Question

My project has a jar in classpath with some utilities in it. When I run the program using ant on Red Hat linux, it's unable to read the system properties using System.getProperty(key), but it works perfectly fine when ran on Ubuntu.

Any suggestion to why this might be happening is appreciated.

ant target

<target name="test">
    <property environment="env"/>
    <echo message="PATH_ROOT set  =>  ${env.PATH_ROOT}" />
    <echo message="CUSTOM_REPORT_PATH set  =>  ${env.CUSTOM_REPORT_PATH}" />
    <testng classpathref="compile.classpath" haltOnfailure="false" outputDir="${testng.output.dir}/xxx">
        <sysproperty key="PATH_ROOT" value="${env.PATH_ROOT}"/>
        <sysproperty key="CUSTOM_REPORT_PATH" value="${env.CUSTOM_REPORT_PATH}"/>
        <xmlfileset dir="src/com/xxx" includes="suite.xml" />
    </testng>
</target>

================

Était-ce utile?

La solution

Guys it was a silly mistake. The framework was not executing the file which had the statements to fetch system variables as the listener was missing in testng suite which is a must for testng to invoke that

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top