You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mike Ayers <ma...@NEVIKNETWORKS.com> on 2003/02/12 22:47:42 UTC

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