6.1 KiB
6.1 KiB
Generate a Project
Generate a Maven Project
Quickstart with dependency search
- Open VS Code without opening any folder.
- Open
Command Palette
, execute commandSpring Initializr: Generate a Maven Project
. - Input a invalid
Group Id
, verify:- It doesn't pass the validation.
- Input a valid
Group Id
, e.g.com.microsoft.example
, press<Enter>
. - Input a invalid
Artifact Id
, verify:- It doesn't pass the validation.
- Input a valid
Artifact Id
, e.g.sample-artifact
, pressEnter
. - Select a version, verify:
- It lists compatible dependencies for the specified version you selected.
- Select some dependencies, verify:
- Selected dependency is entitled by a check mark, and is placed ahead of the dependency list.
- Can cancel the selection by pressing
<Enter>
on a selected dependency. - The first entry is
Selected # dependency(ies)
, and#
is the number of seleted entries.
- Press
<Enter>
onSelected # dependency(ies)
, verify:- It pops up a directory-selection dialog.
- Choose a target folder, verify:
- During generating, it shows process in status bar.
- After the process disappear, it shows a information message box on the top.
- Click
Open it
, verify:- It opens the project in current window.
- Open
pom.xml
in root folder, verify:Group Id
andArtifact Id
are correct.- Selected dependencies are added under
<dependencies>
tag.
- Verify the folder structure is organized as
Group Id
.
Quickstart with last settings
- Open
Command Palette
, execute commandSpring Initializr: Generate a Maven Project
. - Input a valid
Group Id
, e.g.com.microsoft.example
, press<Enter>
. - Input a valid
Artifact Id
, e.g.sample-artifact
, pressEnter
. - Press
<Enter>
onUse Last Settings
, verify:- The dialog shows the dependeny(ies) name in last settings.
- Choose a target folder, open it and verify the
pom.xml
, using same steps above.
Generate a Gradle Project
Same steps with above, but using command Spring Initializr: Generate a Gradle Project
.
After that, verify build.gradle
instead of pom.xml
.
Customized Spring Initializr Service URL
- Open
User settings
in VS Code. - Change value of entry
spring.initializr.serviceUrl
, e.g. "https://start.cfapps.io", or run the service locally (if the previous one doesn't work). - Verify:
- Can generate a project from the specified service URL.
- Change value of entry
spring.initializr.serviceUrl
to an array, e.g. ["https://start.cfapps.io", "https://start.spring.io"] - Verify:
- Before generating a project/editing starters, it requires users to select one from the list.
- Can generate a project from the selected service URL.
Default Values
Default value of GroupId and ArtifactId.
- Open
User settings
in VS Code. - Change values of entry
spring.initializr.defaultGroupId
,spring.initializr.defaultArtifactId
. - Open
Command Palette
, execute commandSpring Initializr: Generate a Maven Project
. - Verify:
GroupId
andArtifactId
are filled by the specified default values.
Default value of language.
- Open
User settings
in VS Code. - Change values of entry
spring.initializr.defaultLanguage
to""
. - Verify:
- It allows to select language during generating the project.
- Open the generated project, the language matches what you selected.
- Change values of entry
spring.initializr.defaultLanguage
to"Java"
. - Verify:
- It skips the step to select language, and directly uses the value you set.
Default value of Java version.
- Open
User settings
in VS Code. - Change values of entry
spring.initializr.defaultJavaVersion
to""
. - Verify:
- It allows to select Java version during generating the project.
- Open the generated project, the Java version matches what you selected.
- Change values of entry
spring.initializr.defaultJavaVersion
to"1.8"
. - Verify:
- It skips the step to select Java version, and directly uses the value you set.
Default value of packaging.
- Open
User settings
in VS Code. - Change values of entry
spring.initializr.defaultPackaging
to""
. - Verify:
- It allows to select packaging type during generating the project.
- Open the generated project, the packaging type matches what you selected.
- Change values of entry
spring.initializr.defaultPackaging
to"WAR"
. - Verify:
- It skips the step to select packaging type, and directly uses the value you set.
Ways of opening generated projects.
No workspace folder in current windows
- Open VS Code without any workspace folder.
- Generate a Maven/Gradle project.
- When it's completed, verify:
- It pops up a dialog with button
Open
. - Click
Open
, it opens the project in current window.
- It pops up a dialog with button
Has worksapce folder in current window.
- Open VS Code, and open a folder.
- Generate a Maven/Gradle project.
- When it's completed, verify:
- It pops up a dialog with buttons
Open
,Add to Workspace
. - Click
Open
, it opens the project in a new window. - Click
Add to Workspace
, it opens the project as a workspace folder in current window.
- It pops up a dialog with buttons
Edit Starters for Spring Boot Maven projects.
- Generate a maven project as above, select some dependencies.
- Open
pom.xml
file, verify current value ofdependencies
node. - Right click on the editing area of the file, choose
Edit starters
. - In the QuickPick box, do some selection and unselection, and proceed following the prompt messages.
- Verify:
- The
pom.xml
file is modified, and the project can still be built bymvn package
. - Corresponding
<dependency>
nodes are added/removed. - For dependencies with
bom
information, e.g.azure
, a<DependencyManagement>
node is added into the pom file. - For dependencies with
repository
information, e.g.Spring Shell
, a<repository>
node is added into the pom file.
- The