0
votes

I have an intellij project where I am trying to create 2 jars. I have setup my buildfile and run build ALL artifacts. However, only my FIRST jar comes up. To try to get more information I ran the command line command: ant -buildfile buildfile.xml

In the result I get the following:

artifact.jar1:jar:

[mkdir] Created dir: ~/Projects/proj1/__artifacts_temp/jar1_jar

[jar] Building jar: ~/Projects/proj1/__artifacts_temp/jar1.jar

[copy] Copying 1 file to ~/Projects/proj1/__artifacts_temp/jar1_jar

artifact.jar2:jar:

[mkdir] Created dir: ~/Projects/proj1/__artifacts_temp/jar2_jar

[jar] Building jar: ~/Projects/proj1/__artifacts_temp/1/jar2.jar

[copy] Copying 1 file to ~/Projects/proj1/__artifacts_temp/jar2_jar

So it looks like both jars will be created. However... the next output is more discouraging.

build.all.artifacts:

[copy] Copying 1 file to ~/Projects/proj1

[delete] Deleting directory ~/Projects/proj1/__artifacts_temp

I have absolutely no idea why it would only copy 1 of the jars back. Any thoughts or ideas on how to get more information would be greatly appreciated.

Edit: Here is what the build.all.artifacts section of my build script looks like

<target name="build.all.artifacts" depends="artifact.jar1:jar, artifact.jar2:jar" description="Build all artifacts">
  <mkdir dir="${artifact.output.jar1:jar}"/>
  <copy todir="${artifact.output.jar1:jar}">
    <fileset dir="${artifact.temp.output.jar1:jar}"/>
  </copy>
  <mkdir dir="${artifact.output.jar2:jar}"/>
  <copy todir="${artifact.output.jar2:jar}">
    <fileset dir="${artifact.temp.output.jar2:jar}"/>
  </copy>

  <!-- Delete temporary files -->
  <delete dir="${artifacts.temp.dir}"/>
</target>
1

1 Answers

1
votes

Check buildfile.xml, there should be a <copy> task for the first jar and not for the second.

Update: Try using <fileset dir="${artifact.temp.output.jar2:jar}" erroronmissingdir="true"/> to see if there's something wrong with the path. Also try to print the paths to check if they are correct:

<echo>${artifact.output.jar2:jar}</echo>
<echo>${artifact.temp.output.jar2:jar}</echo>