'How to exclude referenced libraries from being exported when you export jar in VS Code for Java project (no build tool)

I have a Java Project for a JavaBean (multiple classes in a single project) with no build tools. In eclipse, I can export this project as JAR and I can select to export only the compiled classes without the referenced libraries.

In VS Code, when I select "Export JAR" from the JAVA Project tab, I am unable to remove the selection of the referenced libraries which is always copied to the output according to this config {"java.project.outputPath":"bin"}. Note that the referenced libraries are referenced using the .classpath file, not using the .vscode settings file with the section "java.project.referencedLibraries".

Is it possible to export JAR in vscode the same way we export jar in eclipse?

What is the command line to export the needed jar?

I appreciate your help.

Tarek

enter image description here

enter image description here



Solution 1:[1]

There is an advanced way to export Jar in VS Code. See: https://github.com/microsoft/vscode-java-dependency/wiki/Export-Your-Project-to-a-Jar#advanced-custom-export-task

You can use the glob pattern here to customize the exclude list. e.g., a new rule like !${compileOutput}/referenced.jar.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shi Chen