mirror of
https://gitee.com/dcren/initializr.git
synced 2026-02-26 13:43:15 +08:00
Add support for WAR packaging
This commit is contained in:
13
templates/ServletInitializer.java
Normal file
13
templates/ServletInitializer.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package ${packageName};
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.web.SpringBootServletInitializer;
|
||||
|
||||
public class ServletInitializer extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(Application.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,7 +49,13 @@
|
||||
<label>Type:</label>
|
||||
<% types.each { %>
|
||||
<label class="radio">
|
||||
<input type="radio" name="type" value="${it.value}"${it.selected ? ' checked="true"' : ''} onclick="javascript:this.form.action='/${it.value}'"/>
|
||||
<input type="radio" name="type" value="${it.value}"${it.selected==true ? ' checked="true"' : ''} onclick="javascript:this.form.action='${it.action}'"/>
|
||||
${it.name}
|
||||
</label><% } %>
|
||||
<label>Packaging:</label>
|
||||
<% packagings.each { %>
|
||||
<label class="radio">
|
||||
<input type="radio" name="packaging" value="${it.value}"${it.selected==true ? ' checked="true"' : ''}/>
|
||||
${it.name}
|
||||
</label><% } %>
|
||||
<button type="submit" class="btn">Generate</button>
|
||||
|
||||
@@ -16,9 +16,11 @@ buildscript {
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'spring-boot'
|
||||
apply plugin: 'spring-boot' <% if (packaging=='war') { %>
|
||||
apply plugin: 'war'
|
||||
<% } %>
|
||||
|
||||
jar {
|
||||
<% if (packaging=='war') { %>war<% } else { %>jar<% } %> {
|
||||
baseName = '${artifactId}'
|
||||
version = '${version}'
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
<packaging>${packaging}</packaging>
|
||||
|
||||
<name>${name}</name>
|
||||
<description>${description}</description>
|
||||
@@ -82,4 +83,4 @@
|
||||
</pluginRepositories>
|
||||
<% } %>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user