I have a scenario where I try to reuse the same build.xml file for multiple projects. In each case, the ultimate goal is to dist that the JARs are all up. The only difference is that some of the projects have a src/main/java/META-INF/* , while others do not (and just have a src/main/java/* directory).
I want to use the Ant -Contrib <if/> task to optionally define the META-INF/ directory if the assembly sees the src/main/java/META-INF/* . So something like this:
<jar jarfile="myapp.jar"> <if> <available file="src/main/java/META-INF" /> <then> <echo message="I'm trying to copy META-INF!" /> </then> </if> </jar>
But I'm choking on two things here:
- When I run this target, I get an assembly exception, stating that I cannot nest
<if/> inside the <jar/> task; and - I'm not sure how to configure the
<jar/> task to create the META-INF at the root of the class path and copy the entire contents of src/main/java/META-INF .
Any thoughts? Thanks in advance.
user1768830
source share