2013-02-13 11 views
7

Załóżmy, że mam plik o nazwie build_dev_linux.xml.Jak zdobyć własną nazwę pliku mrówki xml?

Moje pytanie brzmi

Jak mogę znaleźć własną nazwę skryptu Ant pliku XML, w build_dev_linux.xml więc mogę umieścić go na zmienny lub mienia w tym pliku XML.?

+0

Dlaczego nie można bezpośrednio ustawić właściwość zawierającą nazwę – Shurmajee

+0

Aby zmniejszyć punktach obsługi –

Odpowiedz

13

Ant wyznacza użyteczną listę wbudowanej właściwości:

basedir    the absolute path of the project's basedir (as set 
        with the basedir attribute of <project>). 
ant.file   the absolute path of the buildfile. 
ant.version   the version of Ant 
ant.project.name the name of the project that is currently executing; 
        it is set in the name attribute of <project>. 
ant.project.default-target 
        the name of the currently executing project's 
        default target; it is set via the default 
        attribute of <project>. 
ant.project.invoked-targets 
        a comma separated list of the targets that have 
        been specified on the command line (the IDE, 
        an <ant> task ...) when invoking the current 
        project. 
ant.java.version the JVM version Ant detected; currently it can hold 
        the values "1.2", "1.3", 
        "1.4", "1.5" and "1.6". 
ant.core.lib  the absolute path of the ant.jar file. 

ant.file Obiekt jest to, czego potrzebujesz. Jeśli chcesz tylko nazwę pliku bez ścieżki następnie można użyć zadania basename jak

<basename file="${ant.file}" property="buildfile"/> 
+0

Dzięki. Nie wiedziałem, od czego zacząć, a teraz myślę, że mam. :) –