Add .groovy lang support

This commit is contained in:
Dave Syer
2014-05-30 09:50:24 +01:00
parent eeb6a762a8
commit 113b864e4b
9 changed files with 128 additions and 12 deletions
+16
View File
@@ -0,0 +1,16 @@
package ${packageName}
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan
@EnableAutoConfiguration
class Application {
static void main(String[] args) {
SpringApplication.run Application, args
}
}
+16
View File
@@ -0,0 +1,16 @@
package ${packageName}
import org.junit.Test
import org.junit.runner.RunWith
${testImports}import org.springframework.boot.test.SpringApplicationConfiguration
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
@RunWith(SpringJUnit4ClassRunner)
@SpringApplicationConfiguration(classes = Application)
${testAnnotations}class ApplicationTests {
@Test
void contextLoads() {
}
}
+13
View File
@@ -0,0 +1,13 @@
package ${packageName}
import org.springframework.boot.builder.SpringApplicationBuilder
import org.springframework.boot.context.web.SpringBootServletInitializer
class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
application.sources(Application)
}
}
+6
View File
@@ -64,6 +64,12 @@
<input type="radio" name="javaVersion" value="${it.value}"${it.selected==true ? ' checked="true"' : ''}/>
${it.value}
</label><% } %>
<label>Language:</label>
<% languages.each { %>
<label class="radio">
<input type="radio" name="language" value="${it.value}"${it.selected==true ? ' checked="true"' : ''}/>
${it.name}
</label><% } %>
<button type="submit" class="btn">Generate</button>
</form>
</div>
+4 -3
View File
@@ -13,7 +13,7 @@ buildscript {
}
}
apply plugin: 'java'
apply plugin: '${language}'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot' <% if (packaging=='war') { %>
@@ -35,8 +35,9 @@ repositories {
}
dependencies {<% styles.each { %>
compile("org.springframework.boot:spring-boot-starter${it}:\${springBootVersion}")<% } %>
testCompile("org.springframework.boot:spring-boot-starter-test:\${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter${it}")<% } %>
<% if (language=='groovy') { %>compile("org.codehaus.groovy:groovy")<% } %>
testCompile("org.springframework.boot:spring-boot-starter-test")
}
task wrapper(type: Wrapper) {
+29 -1
View File
@@ -22,6 +22,10 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter${it}</artifactId>
</dependency><% } %><% if (language=='groovy') { %>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency><% } %>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -41,7 +45,31 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugin><% if (language=='groovy') { %>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.8.0-01</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.1.8-01</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.8.0-01</version>
<extensions>true</extensions>
</plugin><% } %>
</plugins>
</build><% if (!bootVersion.contains("RELEASE")) { %>