ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, Rob H - VSCM" <Anderson....@vectorscm.com>
Subject RE: File dependency
Date Wed, 12 Feb 2003 22:40:24 GMT
You want to use the Available and Fail tasks. Something like....

<target name="check-hub.jar">
	<available property="hub.jar-exists" file="${manifest}/hub.jar"/>
	<fail unless="hub.jar-exists">${manifest}/hub.jar does not
exist</fail>
</target>

  <target name="test.compile"
          depends="init,check-hub.jar" >
    <javac srcdir="${src}" destdir="${classes}" deprecation="off" >
       <classpath refid="test.classpath" />
    </javac>
  </target>

-Rob A

-----Original Message-----
From: Mike Ayers [mailto:mayers@NEVIKNETWORKS.com]
Sent: Wednesday, February 12, 2003 1:48 PM
To: user@ant.apache.org
Subject: File dependency



	Hello,

	I feel rather embarassed to be asking what I would expect to be a
trivial question, but I can't seem to figure out how to create a file
dependency.  There is an external jar file that needs to be built (it is the
product of another archive module) before my module can be built, and I want
to check if it exists before compiling, because things go quite badly if
it's not there, and the error messages thus generated aren't terribly
helpful.  I tried:

=======SNIP==========8<-----------------------------------------

  <target name="test.compile"
          depends="init,${maindist}/hub.jar" >
    <javac srcdir="${src}" destdir="${classes}" deprecation="off" >
       <classpath refid="test.classpath" />
    </javac>
  </target>

=======SNIP==========8<-----------------------------------------

	...where init is an ant target (that works fine), maindist is a
property with the path to the jar, and hub.jar is its name.  I get:


=======SNIP==========8<-----------------------------------------

C:\test>ant
Buildfile: build.xml

BUILD FAILED
Target `${maindist}/hub.jar' does not exist in this project. It is used from
target `test.compile'.

Total time: 0 seconds

=======SNIP==========8<-----------------------------------------

	...which is consistent with the ant documentation, which states that
dependencies are ant targets.  So, I think the question here is: how do I
get a file to be an ant target?

	Am I missing something here?


	TiA,

/|/|ike

Mime
View raw message