0

I am trying to make a jar of a simple inventory program using ant and eclipse. I have the xml file built, but I need to add something to the buildjar target that will cause ant to include the itemdatabase file - that is currently sitting in the base directory - in the jar. What I have so far.

<target name="buildjar" depends="clean">
    <jar jarfile="${build.dir}/StudioCat.jar">
        <fileset dir="${basedir}">
            <include name="config/*"/>
            </fileset>
            <fileset dir="${bin.dir}">
                <include name="**/*.class"/>
            </fileset>
            <manifest>
                <attribute name="Main-Class" value="presentation.CreateInventoryUI"/>
            </manifest>
    </jar>

    <copy todir="${build.dir}">
    <fileset dir="${basedir}">
        <include name="config*/**/*"/>
        </fileset>
        </copy>

        </target>
Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Expecto
  • 511
  • 3
  • 18
  • 34

2 Answers2

0

1) You use the .jar task (as you're already doing):

2) You'd commonly have several subfolders under "src/" in your project:

src/
    css/
    java/
    html/
    images/
    config/

3) Your XML would live in src/config (for example). Your

<target name="buildjar" depends="clean">
  <jar jarfile="${build.dir}/StudioCat.jar">
    <fileset dir="${basedir}"
         includes="config.xml"
         fullpath="config/config.xml"/>
    </fileset>
...

A couple of links:

Q: Are you using an IDE like Eclipse?

Community
  • 1
  • 1
paulsm4
  • 114,292
  • 17
  • 138
  • 190
0

Similar to how you included 'config' directory and its contents.

<fileset dir="${basedir}">
  <include name="config/*"/>
  <include name="itemdatabase"/> <!-- To include itemdatabase -->
</fileset>
sperumal
  • 1,499
  • 10
  • 14