Alex Pritchard
Alex Pritchard

Reputation: 4250

Copied resources using ant in eclipse not appearing in jar

I'm using ant to build a project in eclipse. Before the jar is constructed, I want to move some files from another project into a resources folder in this project.

The problem I'm having is that none of the files show up in the jar.

Example:

<project>
   <target name="A">
      <copy file="../otherloc/file1" tofile="resources/file1" />
      <waitfor><available file="resources/file1" /></waitfor>
   </target>
   <target name="B" depends="A">
      <jar destfile="dist/jarfile.jar">
      ... (actually build the jar)
      </jar>
   </target>
</project>

So in the above case, "file1" doesn't actually make it into the jar, even though everything else in the resources directory does. Eclipse doesn't show the new file in the resources directory until I refresh, either. It's like, because eclipse doesn't know about it, it's not included in the build.

Any suggestions appreciated. I'm pretty much an Ant noob, so it's possible I'm going about this entirely wrong.

Edit: Alternately, is there some way to just include the file from the other project? I was a little unclear on the best way to get it into the jar. It needs to be in a directory along with some other existing project files.

Upvotes: 0

Views: 222

Answers (2)

Alex Pritchard
Alex Pritchard

Reputation: 4250

Unfortunately we haven't been able to resolve this, so we just work around it by separating the task into two steps and copying the files before running the build script. Not really a great "answer", but nothing else has been suggested.

Upvotes: 0

Jacques
Jacques

Reputation: 26

Did you check both tasks independently? First to have file1 copied in the proper location. Then, if B fails to put file1 in the archive, the issue could lie in the tag. Are you sure resource/file1 is handled by a fileset ?

Upvotes: 0

Related Questions