Skip to content
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

Specify Java version; Load default Java version; #146

Merged
merged 5 commits into from
Aug 4, 2020

Conversation

osmarcf
Copy link
Contributor

@osmarcf osmarcf commented Aug 2, 2020

Pulling a "Specify Java version" feature.
It is simple to change the Java version when the project is created (issue 136 is closed with that comment - #136 ), but I added this feature since VSCode is turning to use Java 11, so it is helpful to choose Java version when creating the project.

@ghost
Copy link

ghost commented Aug 2, 2020

CLA assistant check
All CLA requirements met.

@Eskibear
Copy link
Member

Eskibear commented Aug 3, 2020

Thanks for the contribution.
Basically we only allow to specify the most important properties, in order to decrease the number of steps (as currently we cannot go backward among steps). You can always change below properties in pom.xml after the project is created.

  • Java Version: As Java on VS Code now requires JDK 11 to run, I agree that we should allow users to specify it. Suggest to change the default value to "11".
  • Name: By default it's the same as "artifact id". Note that in start.spring.io, once you change the artifact id, the name is also changed. So we follow the behavior. Suggest to remove this setting.

BTW we're switching to consume the latest (v2.2) metadata. Ideally we don't have to have the settings to hardcode the options, as they can be retrieved by querying the service.

@osmarcf
Copy link
Contributor Author

osmarcf commented Aug 3, 2020

Thanks for the contribution.

Thanks for reviewing!

Basically we only allow to specify the most important properties, in order to decrease the number of steps (as currently we cannot go backward among steps). You can always change below properties in pom.xml after the project is created.

I see that to decrease the steps, the user should set default values. The user change the pom.xml is always a choice, but I also see that this extension should replace the need for it (and even the access the start.spring.io)

* **Java Version**: As Java on VS Code now requires JDK 11 to run, I agree that we should allow users to specify it.  **Suggest to change the default value to "11".**

Fine! I will commit that later!

* **Name**: By default it's the same as "artifact id". Note that in start.spring.io, once you change the artifact id, the name is also changed. So we follow the behavior. **Suggest to remove this setting.**

I have a comment about setting the "Name": in the current version, changing the ArtifactId change the pom.xml file, but it doesn't affect the Application Name, that is, the "main" class will have the default name "DemoApplication" (and also the filename DemoApplication.java).

BTW we're switching to consume the latest (v2.2) metadata. Ideally we don't have to have the settings to hardcode the options, as they can be retrieved by querying the service.

Nice!

Copy link
Member

@Eskibear Eskibear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it's ok. For the "name" issue, let's simply reuse the value of artifact id.

package.json Outdated
@@ -108,6 +120,12 @@
"scope": "window",
"description": "Default value for Artifact Id."
},
"spring.initializr.defaultName": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have to have this setting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

README.md Outdated
// Default value for Artifact Id.
"spring.initializr.defaultArtifactId": "demo",

// Default value for Name.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

TestPlan.md Outdated
@@ -64,6 +64,13 @@ After that, verify `build.gradle` instead of `pom.xml`.
1. Verify:
1. `GroupId` and `ArtifactId` are filled by the specified default values.

### Default value of Name.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this section

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -114,6 +114,10 @@ export function artifactIdValidation(value: string): string {
return (/^[a-z_][a-z0-9_]*(-[a-z_][a-z0-9_]*)*$/.test(value)) ? null : "Invalid Artifact Id";
}

export function nameValidation(value: string): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

placeHolder: "e.g. demo (will turn into DemoApplication class - mostly the same as ArtifactId)",
prompt: "Input project name.",
validateInput: nameValidation,
value: defaultName,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you mentioned:

mostly the same as ArtifactId

Let's remove this step, just re-use the value of artifactId.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

`groupId=${this.groupId}`,
`artifactId=${this.artifactId}`,
`name=${this.name}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name=${this.artifactId}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@osmarcf osmarcf requested a review from Eskibear August 3, 2020 16:49
Copy link
Member

@Eskibear Eskibear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Eskibear Eskibear merged commit f03111c into microsoft:master Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants