Search code examples
javaantbuild.xml

Files specified in include tag in build.xml are not getting added to the jar


I want to include config.properties file and all the json files present in resources folder in my jar. But none of the file is getting added to the jar. If I use only one include tag then those files are getting added to the jar. Please help me add all jsonm and config.properties file to the jar.

<!-- Export configuration files to build directory -->
  <copy todir="${output.dir}/configuration">
    <fileset dir="configuration">
      <include name="**/config.properties"/>
      <include name="**/*.json"/>
    </fileset>
  </copy>

  <!-- Put exported configuration files on classpath -->
  <fileset id="extra.jar.files" dir="${output.dir}/configuration">
    <filename name="**/config.properties"/>
    <filename name="**/*.json" />
  </fileset>

Solution

  • Try this:

    <copy todir="${output.dir}/configuration">
        <fileset dir="configuration" includes="*/.json"/>
        <fileset dir="configuration" includes="**/config.properties"/> 
    </copy>
    

    Refer this link