我知道我的build.xml包含至少十个目标,但在我运行ant -p
时只显示两个:
$ ant -p build.xml
Buildfile: /home/nico/myproject/build.xml
Main targets:
clean clean
Default target: deploy
如何显示所有目标?
答案 0 :(得分:2)
ant -p
仅显示具有说明的目标。
要显示所有目标,请运行ant -p -v
。这将生成相当多的行,但在输出结束时很容易找到完整的目标列表:
Apache Ant(TM) version 1.9.6 compiled on July 8 2015
Trying the default build file: build.xml
Buildfile: /home/nico/myproject/build.xml
Detected Java version: 1.7 in: /usr/lib/jvm/java-7-openjdk-amd64/jre
Detected OS: Linux
parsing buildfile /home/nico/myproject/build.xml with URI = file:/home/nico/myproject/build.xml
Project base dir set to: /home/nico/myproject
parsing buildfile jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
Importing file /home/nico/ide/build-common-portlet.xml from /home/nico/myproject/build.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile /home/nico/ide/build-common-portlet.xml with URI = file:/home/nico/ide/build-common-portlet.xml
Importing file /home/nico/ide/build-common-plugin.xml from /home/nico/ide/build-common-portlet.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile /home/nico/ide/build-common-plugin.xml with URI = file:/home/nico/ide/build-common-plugin.xml
Already defined in main or a previous import, ignore war
Importing file /home/nico/ide/build-common.xml from /home/nico/ide/build-common-plugin.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile /home/nico/ide/build-common.xml with URI = file:/home/nico/ide/build-common.xml
[property] Loading Environment env.
parsing buildfile jar:file:/home/nico/ide/lib/ant-contrib.jar!/net/sf/antcontrib/antlib.xml with URI = jar:file:/home/nico/ide/lib/ant-contrib.jar!/net/sf/antcontrib/antlib.xml from a zip file
parsing buildfile jar:file:/home/nico/ide/lib/antelopetasks.jar!/ise/antelope/tasks/antlib.xml with URI = jar:file:/home/nico/ide/lib/antelopetasks.jar!/ise/antelope/tasks/antlib.xml from a zip file
[property] Loading /home/nico/ide/build.nico.properties
Property "env.COMPUTERNAME" has not been set
[property] Loading /home/nico/ide/build.${env.COMPUTERNAME}.properties
[property] Unable to find property file: /home/nico/ide/build.${env.COMPUTERNAME}.properties
Property "env.HOST" has not been set
[property] Loading /home/nico/ide/build.${env.HOST}.properties
[property] Unable to find property file: /home/nico/ide/build.${env.HOST}.properties
Property "env.HOSTNAME" has not been set
[property] Loading /home/nico/ide/build.${env.HOSTNAME}.properties
[property] Unable to find property file: /home/nico/ide/build.${env.HOSTNAME}.properties
[property] Loading /home/nico/ide/build.properties
Override ignored for property "app.server.type"
Override ignored for property "app.server.tomcat.dir"
Override ignored for property "app.server.tomcat.portal.dir"
Override ignored for property "app.server.tomcat.deploy.dir"
Override ignored for property "app.server.tomcat.lib.global.dir"
Override ignored for property "app.server.parent.dir"
Importing file /home/nico/ide/build-common-ivy.xml from /home/nico/ide/build-common.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile /home/nico/ide/build-common-ivy.xml with URI = file:/home/nico/ide/build-common-ivy.xml
[available] Found: /home/nico/ide/.ivy/ivy-2.3.0.jar
parsing buildfile jar:file:/home/nico/ide/.ivy/ivy-2.3.0.jar!/org/apache/ivy/ant/antlib.xml with URI = jar:file:/home/nico/ide/.ivy/ivy-2.3.0.jar!/org/apache/ivy/ant/antlib.xml from a zip file
[available] Unable to find ivy.xml
[available] Found: /home/nico/ide/ivy.xml
Overriding previous definition of reference to ant.projectHelper
[whichresource] Searching for org/eclipse/jdt/core/JDTCompilerAdapter.class
Overriding previous definition of reference to ant.projectHelper
[available] Found: docroot/WEB-INF/liferay-plugin-package.properties
[property] Loading /home/nico/myproject/docroot/WEB-INF/liferay-plugin-package.properties
[antlib:ise.antelope.tasks] Could not load definitions from resource ise/antelope/tasks/antlib.xml. It could not be found.
Property "plugin.full.version" has not been set
Property "plugin.full.version" has not been set
Property "plugin.full.version" has not been set
Property "plugin.full.version" has not been set
Property "plugin.full.version" has not been set
[available] Unable to find src
[available] Unable to find tmp
[macrodef] creating macro classpath-to-jar
Overriding previous definition of reference to ant.projectHelper
Overriding previous definition of reference to ant.projectHelper
Main targets:
clean clean
Other targets:
all
build-client
build-common-plugin.war
build-css
build-db
build-lang
build-lang-cmd
build-service
build-wsdd
build-wsdl
build-xsd
clean-portal-dependencies
compile
compile-import-shared
compile-java
compile-test
compile-test-cmd
compile-test-integration
compile-test-unit
create
deploy
direct-deploy
format-javadoc
format-source
format-wsdl
format-xsd
jar-javadoc
jar-source
javadoc
merge
merge-unzip
patch
print-current-time
publish
publish-local-m2-release
publish-local-m2-snapshot
publish-remote-m2-release
publish-remote-m2-snapshot
setup-eclipse
setup-jrebel
shrink-zip-cmd
sort-xml-attributes
test
test-class
test-cmd
test-integration
test-unit
war
Default target: deploy
答案 1 :(得分:0)
实际上,有一个简单的答案。 ' ant -p'命令将仅输出具有描述集的目标。 例如:
<target name="target1" description="My first target">
我一直认为这是一种控制&#39;哪些目标是公开可见的,非常像Java在方法上使用公共和私有等等。