Search code examples
javaeclipseantjarexecutable-jar

Eclipse: Export Runnable Jar file should include specific files


I am trying to export a jar file via this command: Export -> Runnable JAR file -> Copy required libraries into a sub-folder next to the generated JAR.

I was trying to minimize the size of my JAR file and I want to exclude the xtend files since this has already been converted to java. The build.properties in my plugin.xml contains this:

source.. = src/,\
          src-gen/,\
          xtend-gen/
bin.includes = META-INF/,\
               .,\
               plugin.xml
src.excludes = **/*.xtend
bin.excludes = **/*.xtend
exclude.. = **/*.xtend

The problem is, the xtend files still get added into the JAR file. How can I exclude specific files from being added into the JAR file?

Update: I ticked the "Save as ANT script" option. I have modified the ANT script to exclude those files I do not want.

<fileset dir="D:/xtext/bin">
    <exclude name="**/*.xtend" />
</fileset>

But everytime I generate the JAR file, it just overwrites the script. How can I generate the JAR file using the modified ANT script?


Solution

  • when you do the export you have the option to store the export process as an ant file. in this ant file you can find a section that adds the bin folder to file files. there you could exclude the xtend files.

    the build.properties only counts for osgi/plugin export - the runnable jar file wizard does not know it.