Tengo un problema para get properties con ant desde un file de properties. Con un objective simple como este en mi build.xml, me gustaría get al less dos properties path1 y path2. Me gustaría tener un objective genérico para get estas dos properties … para evitar modificar el build.xml (simplemente agregue un nuevo accesorio)
¿Alguna sugerencia? Gracias por adelantado !
build.xml:
<target name="TEST" description="test ant"> <property file="dependencies.properties"/> <svn> <export srcUrl="${path.prop}" destPath="${workspace}/rep/" /> </svn> </target>
dependencies.properties:
path1.prop = /path/to/src1 path2.prop = /path/to/src2
Gracias, funciona Además, puede usar la propiedad document de ant-contrib para get otras properties del file.
dependencies.list=path1,path2 path1.prop1=val1 path1.prop2=val2 path2.prop1=val3 path2.prop2=val4
Me gusta esto :
<target name="main"> <property file="dependencies.properties"/> <foreach list="${dependencies.list}" delimiter="," param="name" target="doExtract" inheritall="true"/> </target> <target name="doExtract"> <propertycopy name="prop1" from="${name}.prop1" silent="true"/> <propertycopy name="prop2" from="${name}.prop2" silent="true"/> <svn> <export srcUrl="${prop1}" destPath="${workspace}/rep/"" /> </svn> </target>
Puede escribir la configuration de su ruta en una list separada por comas en una sola propiedad y usar un bucle foreach