-
Notifications
You must be signed in to change notification settings - Fork 82
Support exporting jar with custom task #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
jdtls.ext/com.microsoft.jdtls.ext.core/src/com/microsoft/jdtls/ext/core/ProjectCommand.java
Outdated
Show resolved
Hide resolved
Do we have this field? |
It's a VS Code built-in field. Its value is in this format: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very close, just a few more comments
package.nls.json
Outdated
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
@CsCherrYY Please resolve the conflict |
package.json
Outdated
{ | ||
"type": "java", | ||
"properties": { | ||
"elements": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A reference about how to support intellisense for constant literals when configuring elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@testforstephen beautiful!
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
package.nls.json
Outdated
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 <[email protected]>
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @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 folderdemo
only.You can run the custom task by clicking
Terminal->Run Task
and select thejava
type. Then the wizard will show all the available export jar tasks.