mirror of
https://gitee.com/dcren/initializr.git
synced 2026-02-25 21:22:58 +08:00
Properly harmonize groupId and package name
The service now links the groupId to the package name by default. Also, renamed default value (`org.test`) to `com.example`. Closes gh-141
This commit is contained in:
@@ -52,7 +52,7 @@ class InitializrMetadata {
|
||||
|
||||
final TextCapability version = new TextCapability('version', 'Version', 'project version')
|
||||
|
||||
final TextCapability packageName = new PackageCapability(name)
|
||||
final TextCapability packageName = new PackageCapability(groupId)
|
||||
|
||||
InitializrMetadata() {
|
||||
this(new InitializrConfiguration())
|
||||
|
||||
@@ -129,7 +129,7 @@ class InitializrMetadataBuilder {
|
||||
metadata.description.content = 'Demo project for Spring Boot'
|
||||
}
|
||||
if (!metadata.groupId.content) {
|
||||
metadata.groupId.content = 'org.test'
|
||||
metadata.groupId.content = 'com.example'
|
||||
}
|
||||
if (!metadata.version.content) {
|
||||
metadata.version.content = '0.0.1-SNAPSHOT'
|
||||
|
||||
@@ -48,7 +48,7 @@ class InitializrProperties extends InitializrConfiguration {
|
||||
final List<DefaultMetadataElement> bootVersions = []
|
||||
|
||||
@JsonIgnore
|
||||
final SimpleElement groupId = new SimpleElement(value: 'org.test')
|
||||
final SimpleElement groupId = new SimpleElement(value: 'com.example')
|
||||
|
||||
@JsonIgnore
|
||||
final SimpleElement artifactId = new SimpleElement()
|
||||
|
||||
@@ -96,8 +96,8 @@ class ProjectAssert {
|
||||
}
|
||||
|
||||
ProjectAssert isJavaProject(String expectedApplicationName) {
|
||||
hasFile("src/main/java/demo/${expectedApplicationName}.java",
|
||||
"src/test/java/demo/${expectedApplicationName}Tests.java",
|
||||
hasFile("src/main/java/com/example/${expectedApplicationName}.java",
|
||||
"src/test/java/com/example/${expectedApplicationName}Tests.java",
|
||||
'src/main/resources/application.properties')
|
||||
}
|
||||
|
||||
@@ -107,8 +107,8 @@ class ProjectAssert {
|
||||
|
||||
ProjectAssert isGroovyProject(String expectedApplicationName) {
|
||||
String codeLocation = (mavenProject ? 'java' : 'groovy')
|
||||
hasFile("src/main/$codeLocation/demo/${expectedApplicationName}.groovy",
|
||||
"src/test/$codeLocation/demo/${expectedApplicationName}Tests.groovy",
|
||||
hasFile("src/main/$codeLocation/com/example/${expectedApplicationName}.groovy",
|
||||
"src/test/$codeLocation/com/example/${expectedApplicationName}Tests.groovy",
|
||||
'src/main/resources/application.properties')
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class ProjectAssert {
|
||||
|
||||
ProjectAssert isJavaWarProject(String expectedApplicationName) {
|
||||
isJavaProject(expectedApplicationName).hasStaticAndTemplatesResources(true)
|
||||
.hasFile('src/main/java/demo/ServletInitializer.java')
|
||||
.hasFile('src/main/java/com/example/ServletInitializer.java')
|
||||
}
|
||||
|
||||
ProjectAssert isJavaWarProject() {
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
"type": "TEXT"
|
||||
},
|
||||
"groupId": {
|
||||
"content": "org.test",
|
||||
"content": "com.example",
|
||||
"description": "project coordinates",
|
||||
"id": "groupId",
|
||||
"title": "Group",
|
||||
@@ -228,7 +228,7 @@
|
||||
"type": "TEXT"
|
||||
},
|
||||
"packageName": {
|
||||
"content": "demo",
|
||||
"content": "com.example",
|
||||
"description": "root package",
|
||||
"id": "packageName",
|
||||
"title": "Package Name",
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
},
|
||||
"groupId": {
|
||||
"type": "text",
|
||||
"default": "org.test"
|
||||
"default": "com.example"
|
||||
},
|
||||
"artifactId": {
|
||||
"type": "text",
|
||||
@@ -185,6 +185,6 @@
|
||||
},
|
||||
"packageName": {
|
||||
"type": "text",
|
||||
"default": "demo"
|
||||
"default": "com.example"
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@
|
||||
},
|
||||
"groupId": {
|
||||
"type": "text",
|
||||
"default": "org.test"
|
||||
"default": "com.example"
|
||||
},
|
||||
"artifactId": {
|
||||
"type": "text",
|
||||
@@ -195,6 +195,6 @@
|
||||
},
|
||||
"packageName": {
|
||||
"type": "text",
|
||||
"default": "demo"
|
||||
"default": "com.example"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user