mirror of
https://gitee.com/dcren/initializr.git
synced 2025-05-09 23:28:05 +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['types'] = projects.types.sort { it.name }
|
||||
model['packagings'] = projects.packagings.sort { it.name }
|
||||
model['javaVersions'] = projects.javaVersions
|
||||
template 'home.html', model
|
||||
}
|
||||
|
||||
@ -178,6 +179,7 @@ class MainController {
|
||||
model.description = request.description
|
||||
model.packageName = request.packageName
|
||||
model.packaging = request.packaging
|
||||
model.javaVersion = request.javaVersion
|
||||
|
||||
if (style==null || style.size()==0) {
|
||||
style = ['']
|
||||
@ -236,6 +238,7 @@ class PomRequest {
|
||||
String version = '0.0.1-SNAPSHOT'
|
||||
String packaging = 'jar'
|
||||
String packageName
|
||||
String javaVersion = '1.7'
|
||||
String getArtifactId() {
|
||||
artifactId == null ? name : artifactId
|
||||
}
|
||||
@ -250,6 +253,11 @@ class Projects {
|
||||
List<Map<String,Object>> styles
|
||||
List<Type> types
|
||||
List<Packaging> packagings
|
||||
List<JavaVersion> javaVersions
|
||||
static class JavaVersion {
|
||||
String value
|
||||
boolean selected
|
||||
}
|
||||
static class Packaging {
|
||||
String name
|
||||
String value
|
||||
|
@ -80,3 +80,10 @@ projects:
|
||||
- name: War
|
||||
value: war
|
||||
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"' : ''}/>
|
||||
${it.name}
|
||||
</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>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -24,6 +24,8 @@ apply plugin: 'war'
|
||||
baseName = '${artifactId}'
|
||||
version = '${version}'
|
||||
}
|
||||
sourceCompatibility = ${javaVersion}
|
||||
targetCompatibility = ${javaVersion}
|
||||
|
||||
repositories {
|
||||
mavenCentral()<% if (!bootVersion.contains("RELEASE")) { %>
|
||||
|
@ -33,7 +33,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<start-class>${packageName}.Application</start-class>
|
||||
<java.version>1.7</java.version>
|
||||
<java.version>${javaVersion}</java.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
Loading…
Reference in New Issue
Block a user