mirror of
https://gitee.com/dcren/initializr.git
synced 2025-05-10 07:38:03 +08:00
Add JavaVersion feature
This commit is contained in:
parent
d6c77bb9ef
commit
ba480960c3
@ -30,6 +30,7 @@ class MainController {
|
|||||||
model['styles'] = projects.styles.sort { it.name }
|
model['styles'] = projects.styles.sort { it.name }
|
||||||
model['types'] = projects.types.sort { it.name }
|
model['types'] = projects.types.sort { it.name }
|
||||||
model['packagings'] = projects.packagings.sort { it.name }
|
model['packagings'] = projects.packagings.sort { it.name }
|
||||||
|
model['javaVersions'] = projects.javaVersions
|
||||||
template 'home.html', model
|
template 'home.html', model
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,6 +179,7 @@ class MainController {
|
|||||||
model.description = request.description
|
model.description = request.description
|
||||||
model.packageName = request.packageName
|
model.packageName = request.packageName
|
||||||
model.packaging = request.packaging
|
model.packaging = request.packaging
|
||||||
|
model.javaVersion = request.javaVersion
|
||||||
|
|
||||||
if (style==null || style.size()==0) {
|
if (style==null || style.size()==0) {
|
||||||
style = ['']
|
style = ['']
|
||||||
@ -236,6 +238,7 @@ class PomRequest {
|
|||||||
String version = '0.0.1-SNAPSHOT'
|
String version = '0.0.1-SNAPSHOT'
|
||||||
String packaging = 'jar'
|
String packaging = 'jar'
|
||||||
String packageName
|
String packageName
|
||||||
|
String javaVersion = '1.7'
|
||||||
String getArtifactId() {
|
String getArtifactId() {
|
||||||
artifactId == null ? name : artifactId
|
artifactId == null ? name : artifactId
|
||||||
}
|
}
|
||||||
@ -250,6 +253,11 @@ class Projects {
|
|||||||
List<Map<String,Object>> styles
|
List<Map<String,Object>> styles
|
||||||
List<Type> types
|
List<Type> types
|
||||||
List<Packaging> packagings
|
List<Packaging> packagings
|
||||||
|
List<JavaVersion> javaVersions
|
||||||
|
static class JavaVersion {
|
||||||
|
String value
|
||||||
|
boolean selected
|
||||||
|
}
|
||||||
static class Packaging {
|
static class Packaging {
|
||||||
String name
|
String name
|
||||||
String value
|
String value
|
||||||
|
@ -80,3 +80,10 @@ projects:
|
|||||||
- name: War
|
- name: War
|
||||||
value: war
|
value: war
|
||||||
selected: false
|
selected: false
|
||||||
|
javaVersions:
|
||||||
|
- value: 1.6
|
||||||
|
selected: false
|
||||||
|
- value: 1.7
|
||||||
|
selected: true
|
||||||
|
- value: 1.8
|
||||||
|
selected: false
|
||||||
|
@ -58,6 +58,12 @@
|
|||||||
<input type="radio" name="packaging" value="${it.value}"${it.selected==true ? ' checked="true"' : ''}/>
|
<input type="radio" name="packaging" value="${it.value}"${it.selected==true ? ' checked="true"' : ''}/>
|
||||||
${it.name}
|
${it.name}
|
||||||
</label><% } %>
|
</label><% } %>
|
||||||
|
<label>Java Version:</label>
|
||||||
|
<% javaVersions.each { %>
|
||||||
|
<label class="radio">
|
||||||
|
<input type="radio" name="packaging" value="${it.value}"${it.selected==true ? ' checked="true"' : ''}/>
|
||||||
|
${it.value}
|
||||||
|
</label><% } %>
|
||||||
<button type="submit" class="btn">Generate</button>
|
<button type="submit" class="btn">Generate</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,6 +24,8 @@ apply plugin: 'war'
|
|||||||
baseName = '${artifactId}'
|
baseName = '${artifactId}'
|
||||||
version = '${version}'
|
version = '${version}'
|
||||||
}
|
}
|
||||||
|
sourceCompatibility = ${javaVersion}
|
||||||
|
targetCompatibility = ${javaVersion}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()<% if (!bootVersion.contains("RELEASE")) { %>
|
mavenCentral()<% if (!bootVersion.contains("RELEASE")) { %>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<start-class>${packageName}.Application</start-class>
|
<start-class>${packageName}.Application</start-class>
|
||||||
<java.version>1.7</java.version>
|
<java.version>${javaVersion}</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
Loading…
Reference in New Issue
Block a user