Revert GMavenPlus migration

GMavenPlus is not properly supported on Eclipse so a Groovy-based
project using Maven now breaks in that IDE. Let's revert the support
until we find a better solution.
This commit is contained in:
Stephane Nicoll 2015-12-31 15:15:35 +01:00
parent 8783ce013a
commit b8f8a43323
6 changed files with 50 additions and 43 deletions

View File

@ -8,7 +8,6 @@ order.
=== Release 1.0.0 (In progress)
* https://github.com/spring-io/initializr/issues/114[#114]: clean package name if necessary
* https://github.com/spring-io/initializr/issues/90[#90]: migrate Groovy maven-based builds to GMavenPlus
* https://github.com/spring-io/initializr/issues/140[#140]: expose dependencies meta-data
* https://github.com/spring-io/initializr/issues/168[#168]: support for dependency versions mapping
* https://github.com/spring-io/initializr/issues/165[#165]: improve resources caching

View File

@ -152,29 +152,30 @@
</dependencyManagement>
<build>
<sourceDirectory>src/main/groovy</sourceDirectory>
<testSourceDirectory>src/test/groovy</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.9.1-01</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.3.7-01</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -189,6 +190,12 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.9.1-01</version>
<extensions>true</extensions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
@ -197,11 +204,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.5</version>
</plugin>
</plugins>
</pluginManagement>
</build>

View File

@ -102,7 +102,7 @@ class ProjectGenerator {
def applicationName = request.applicationName
def language = request.language
String codeLocation = language.equals("groovy") ? 'groovy': 'java'
String codeLocation = ((language.equals("groovy") && gradleBuild) ? 'groovy': 'java')
def src = new File(new File(dir, "src/main/$codeLocation"), request.packageName.replace('.', '/'))
src.mkdirs()
write(new File(src, "${applicationName}.${language}"), "Application.$language", model)

View File

@ -78,23 +78,28 @@
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin><% if (language=='groovy') { %>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>testGenerateStubs</goal>
<goal>testCompile</goal>
<goal>removeStubs</goal>
<goal>removeTestStubs</goal>
</goals>
</execution>
</executions>
<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.9.1-01</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.3.7-01</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.9.1-01</version>
<extensions>true</extensions>
</plugin><% } %>
</plugins>
</build>

View File

@ -217,7 +217,7 @@ class ProjectGeneratorTests {
request.bootVersion = '1.1.9.RELEASE'
request.name = 'MyDemo'
request.packageName = 'foo'
generateProject(request).sourceCodeAssert('src/main/groovy/foo/MyDemoApplication.groovy')
generateProject(request).sourceCodeAssert('src/main/java/foo/MyDemoApplication.groovy')
.hasImports(EnableAutoConfiguration.class.name, ComponentScan.class.name, Configuration.class.name)
.doesNotHaveImports(SpringBootApplication.class.name)
.contains('@EnableAutoConfiguration', '@Configuration', '@ComponentScan')
@ -231,7 +231,7 @@ class ProjectGeneratorTests {
request.bootVersion = '1.2.0.RC1'
request.name = 'MyDemo'
request.packageName = 'foo'
generateProject(request).sourceCodeAssert('src/main/groovy/foo/MyDemoApplication.groovy')
generateProject(request).sourceCodeAssert('src/main/java/foo/MyDemoApplication.groovy')
.hasImports(SpringBootApplication.class.name)
.doesNotHaveImports(EnableAutoConfiguration.class.name, ComponentScan.class.name, Configuration.class.name)
.contains('@SpringBootApplication')
@ -257,7 +257,7 @@ class ProjectGeneratorTests {
}
@Test
void groovyWithMavenUsesGroovyDir() {
void groovyWithMavenUsesJavaDir() {
def request = createProjectRequest('web')
request.type = 'maven-project'
request.language = 'groovy'

View File

@ -109,9 +109,10 @@ class ProjectAssert {
}
ProjectAssert isGroovyProject(String expectedPackageName, String expectedApplicationName) {
String codeLocation = (mavenProject ? 'java' : 'groovy')
String packageName = expectedPackageName.replace('.', '/')
hasFile("src/main/groovy/$packageName/${expectedApplicationName}.groovy",
"src/test/groovy/$packageName/${expectedApplicationName}Tests.groovy",
hasFile("src/main/$codeLocation/$packageName/${expectedApplicationName}.groovy",
"src/test/$codeLocation/$packageName/${expectedApplicationName}Tests.groovy",
'src/main/resources/application.properties')
}