How can get multi value from java class and use it as property in ant task (build.xml)

33 views Asked by At

exampleClass.java

String key1 = "my.test.key1";
String value1 = "my.test.value1";
String key2 = "my.test.key2";
String value2 = "my.test.value2";

Properties systemProperties = System.getProperties();
systemProperties.put(key1, value1);
systemProperties.put(key2, value2);
System.setProperties(systemProperties);

build.xml

  <macrodef name="nexDecryptingPwds">
    <sequential>
      <java classname="my.util.exec.exampleClass" fork="true" failonerror="false">
        <classpath>
          <fileset dir="${install.dir}/lib/">
            <include name="**/*.jar" />
          </fileset>
          <pathelement location="${basedir}" />
        </classpath>
      </java>
    </sequential>
  </macrodef>

<echo message="my.test.key1: ${my.test.key1}" />
<echo message="my.test.key2: ${my.test.key2}" />

How can I get the value of both keys above? The attribute 'resultproperty' can get only 1 value at a time.

0

There are 0 answers