Repository navigation
Support exporting jar with custom task - #350
Conversation
78a3f66 to
69f1266
Compare
Do we have this field? |
It's a VS Code built-in field. Its value is in this format: |
Sheng Chen (jdneo)
left a comment
There was a problem hiding this comment.
very close, just a few more comments
| "configuration.java.project.exportJar.targetPath": "The default output path of export jar", | ||
| "taskDefinitions.java.project.exportJar.elements": "The content list of export jar.", | ||
| "taskDefinitions.java.project.exportJar.mainMethod": "The main method in the manifest of exported jar.", | ||
| "taskDefinitions.java.project.exportJar.targetPath": "The output path of the exported jar. This will override configuration.java.project.exportJar.targetPath." |
There was a problem hiding this comment.
It seems that VS Code does not support markdown description in the taskDefinitions currently. So I couldn't find a way to link to the settings in the tasks.json file.
It seems that |
|
Shi Chen (@CsCherrYY) Please resolve the conflict |
| { | ||
| "type": "java", | ||
| "properties": { | ||
| "elements": { |
There was a problem hiding this comment.
A reference about how to support intellisense for constant literals when configuring elements.
https://github.com/microsoft/vscode-java-debug/blob/master/package.json#L346-L373
1. Rearranged the order of the task properties 2. Rename: mainMethod -> mainClass in many places to avoid any misunderstanding, including renaming ResolveMainClassExecutor to ResolveMainMethodExecutor 3. Support intellisense in tasks.json 4. Fix a bug on invisible project
| "taskDefinitions.java.project.exportJar.elements": "The content list of the exported jar.", | ||
| "taskDefinitions.java.project.exportJar.mainClass": "The main class in the manifest of the exported jar.", | ||
| "taskDefinitions.java.project.exportJar.targetPath": "The output path of the exported jar. This will override configuration.java.project.exportJar.targetPath.", | ||
| "taskDefinitions.java.project.exportJar.compileOutput": "All of the output folders in the runtime scope.", |
There was a problem hiding this comment.
Sheng Chen (@jdneo) What do you think of the wording here, including output folders and dependencies ? Are them the proper ones? Or could you please give some suggestions?
Signed-off-by: Shi Chen <chenshi@microsoft.com>
1. Rename "runtimeDependencies" to "dependencies". 2. Rename "Runtime" to "runtime" and "Test" to "test" in the export jar wizard. 3. When configure default task, only "compileOutput" and "dependencies" are provided by default. 4. Add a new try-catch in jdtls.ext so that some exceptions such as duplicate files during export can be collected and the export process will not abort by them.
Sheng Chen (jdneo)
left a comment
There was a problem hiding this comment.
Thanks Shi Chen (@CsCherrYY)



This PR enables the Java Project Manager to support exporting jar with custom task. In this PR, you can change the value of the fields to customize what to export. The available template of tasks can be found at
Terminal->Configure Tasks.... Here is an example of tasks.json including an export jar task:The following attributes are mandatory for every task configuration:
type- the type of export jar task, should always bejava.label- the name of export jar task. When you are going to run a task fromTerminal->Run Task..., the labels of all available tasks will appear in the list.Here are some optional attributes available to all launch configurations:
mainClass- the mainClass inMANIFEST.MF. If this attribute is not specified, the wizard to select the mainClass will appear during the export process.targetPath- the target path of jar. VS Code variables is available in this attribute. If this attribute is not specified, the export process will apply the settingjava.project.exportJar.targetPath.elements- The array of elements to export. If this attribute is not specified, the wizard to select the elements will appear during the export process. This attribute is using glob patterns so you can also use!to specify which not to include. Both absolute path and relative path to the project folder are supported here.These reserved words are available in the
elements:${compileOutput}- the folders containing output class files in the runtime scope.${testCompileOutput}- the folders containing output class files in the test scope.${dependencies}- the artifact dependencies in the runtime scope.${testDependencies}- the artifact dependencies in the test scope.Note: The reserved words can be used to stand for a specific project. For example, if your workspace includes more than one workspace folder, one of them is
demo. The${compileOutput}will stand for the folders containing output class files in the runtime scope of all the workspace folders while the${compileOutput:demo}stands for those of folderdemoonly.You can run the custom task by clicking
Terminal->Run Taskand select thejavatype. Then the wizard will show all the available export jar tasks.