diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java index b0a80609223..4b22d9e4ee4 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java @@ -134,7 +134,7 @@ class InitializrService { */ private CloseableHttpResponse executeInitializrMetadataRetrieval(String url) { HttpGet request = new HttpGet(url); - request.setHeader(new BasicHeader(HttpHeaders.ACCEPT, "application/json")); + request.setHeader(new BasicHeader(HttpHeaders.ACCEPT, "application/vnd.initializr.v2+json")); return execute(request, url, "retrieve metadata"); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java index e15a429de54..7b72139ac08 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java @@ -19,6 +19,7 @@ package org.springframework.boot.cli.command.init; import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import org.json.JSONArray; @@ -34,11 +35,9 @@ class InitializrServiceMetadata { private static final String DEPENDENCIES_EL = "dependencies"; - private static final String TYPES_EL = "types"; + private static final String TYPE_EL = "type"; - private static final String DEFAULTS_EL = "defaults"; - - private static final String CONTENT_EL = "content"; + private static final String VALUES_EL = "values"; private static final String NAME_ATTRIBUTE = "name"; @@ -123,7 +122,8 @@ class InitializrServiceMetadata { if (!root.has(DEPENDENCIES_EL)) { return result; } - JSONArray array = root.getJSONArray(DEPENDENCIES_EL); + JSONObject dependencies = root.getJSONObject(DEPENDENCIES_EL); + JSONArray array = dependencies.getJSONArray(VALUES_EL); for (int i = 0; i < array.length(); i++) { JSONObject group = array.getJSONObject(i); parseGroup(group, result); @@ -133,13 +133,15 @@ class InitializrServiceMetadata { private MetadataHolder parseProjectTypes(JSONObject root) { MetadataHolder result = new MetadataHolder(); - if (!root.has(TYPES_EL)) { + if (!root.has(TYPE_EL)) { return result; } - JSONArray array = root.getJSONArray(TYPES_EL); + JSONObject type = root.getJSONObject(TYPE_EL); + JSONArray array = type.getJSONArray(VALUES_EL); + String defaultType = type.has(DEFAULT_ATTRIBUTE) ? type.getString(DEFAULT_ATTRIBUTE) : null; for (int i = 0; i < array.length(); i++) { JSONObject typeJson = array.getJSONObject(i); - ProjectType projectType = parseType(typeJson); + ProjectType projectType = parseType(typeJson, defaultType); result.getContent().put(projectType.getId(), projectType); if (projectType.isDefaultType()) { result.setDefaultItem(projectType); @@ -150,17 +152,23 @@ class InitializrServiceMetadata { private Map parseDefaults(JSONObject root) { Map result = new HashMap(); - if (!root.has(DEFAULTS_EL)) { - return result; + Iterator keys = root.keys(); + while (keys.hasNext()) { + String key = (String) keys.next(); + Object o = root.get(key); + if (o instanceof JSONObject) { + JSONObject child = (JSONObject) o; + if (child.has(DEFAULT_ATTRIBUTE)) { + result.put(key, child.getString(DEFAULT_ATTRIBUTE)); + } + } } - JSONObject defaults = root.getJSONObject(DEFAULTS_EL); - result.putAll(parseStringItems(defaults)); return result; } private void parseGroup(JSONObject group, Map dependencies) { - if (group.has(CONTENT_EL)) { - JSONArray content = group.getJSONArray(CONTENT_EL); + if (group.has(VALUES_EL)) { + JSONArray content = group.getJSONArray(VALUES_EL); for (int i = 0; i < content.length(); i++) { Dependency dependency = parseDependency(content.getJSONObject(i)); dependencies.put(dependency.getId(), dependency); @@ -175,11 +183,11 @@ class InitializrServiceMetadata { return new Dependency(id, name, description); } - private ProjectType parseType(JSONObject object) { + private ProjectType parseType(JSONObject object, String defaultId) { String id = getStringValue(object, ID_ATTRIBUTE, null); String name = getStringValue(object, NAME_ATTRIBUTE, null); String action = getStringValue(object, ACTION_ATTRIBUTE, null); - boolean defaultType = getBooleanValue(object, DEFAULT_ATTRIBUTE, false); + boolean defaultType = id.equals(defaultId); Map tags = new HashMap(); if (object.has("tags")) { JSONObject jsonTags = object.getJSONObject("tags"); @@ -192,10 +200,6 @@ class InitializrServiceMetadata { return object.has(name) ? object.getString(name) : defaultValue; } - private boolean getBooleanValue(JSONObject object, String name, boolean defaultValue) { - return object.has(name) ? object.getBoolean(name) : defaultValue; - } - private Map parseStringItems(JSONObject json) { Map result = new HashMap(); for (Object k : json.keySet()) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java index a6a1a6ec403..7564f9e2e29 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java @@ -26,6 +26,8 @@ import java.util.Map; import org.apache.http.client.utils.URIBuilder; +import org.springframework.util.StringUtils; + /** * Represent the settings to apply to generating the project. * @@ -205,8 +207,9 @@ class ProjectGenerationRequest { if (this.bootVersion != null) { builder.setParameter("bootVersion", this.bootVersion); } - for (String dependency : this.dependencies) { - builder.addParameter("style", dependency); + + if (!this.dependencies.isEmpty()) { + builder.setParameter("dependencies", StringUtils.collectionToCommaDelimitedString(this.dependencies)); } if (this.javaVersion != null) { builder.setParameter("javaVersion", this.javaVersion); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java index 1f3c6e06841..180e90f4d34 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java @@ -49,7 +49,7 @@ public abstract class AbstractHttpClientMockTests { protected final CloseableHttpClient http = mock(CloseableHttpClient.class); protected void mockSuccessfulMetadataGet() throws IOException { - mockSuccessfulMetadataGet("1.1.0"); + mockSuccessfulMetadataGet("2.0.0"); } protected void mockSuccessfulMetadataGet(String version) throws IOException { @@ -57,9 +57,9 @@ public abstract class AbstractHttpClientMockTests { Resource resource = new ClassPathResource("metadata/service-metadata-" + version + ".json"); byte[] content = StreamUtils.copyToByteArray(resource.getInputStream()); - mockHttpEntity(response, content, "application/json"); + mockHttpEntity(response, content, "application/vnd.initializr.v2+json"); mockStatus(response, 200); - given(this.http.execute(argThat(getForJsonData()))).willReturn(response); + given(this.http.execute(argThat(getForJsonMetadata()))).willReturn(response); } protected void mockSuccessfulProjectGeneration( @@ -72,7 +72,7 @@ public abstract class AbstractHttpClientMockTests { String header = (request.fileName != null ? contentDispositionValue(request.fileName) : null); mockHttpHeader(response, "Content-Disposition", header); - given(this.http.execute(argThat(getForNonJsonData()))).willReturn(response); + given(this.http.execute(argThat(getForNonJsonMetadata()))).willReturn(response); } protected void mockProjectGenerationError(int status, String message) @@ -122,12 +122,12 @@ public abstract class AbstractHttpClientMockTests { given(response.getFirstHeader(headerName)).willReturn(header); } - protected Matcher getForJsonData() { - return new HasAcceptHeader("application/json", true); + protected Matcher getForJsonMetadata() { + return new HasAcceptHeader("application/vnd.initializr.v2+json", true); } - protected Matcher getForNonJsonData() { - return new HasAcceptHeader("application/json", false); + protected Matcher getForNonJsonMetadata() { + return new HasAcceptHeader("application/vnd.initializr.v2+json", false); } private String contentDispositionValue(String fileName) { diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceMetadataTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceMetadataTests.java index 32f2f8ef060..5ece7c2078c 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceMetadataTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/InitializrServiceMetadataTests.java @@ -38,15 +38,24 @@ public class InitializrServiceMetadataTests { @Test public void parseDefaults() { - InitializrServiceMetadata metadata = createInstance("1.0.0"); - assertEquals("maven-project", metadata.getDefaults().get("type")); + InitializrServiceMetadata metadata = createInstance("2.0.0"); + assertEquals("1.1.8.RELEASE", metadata.getDefaults().get("bootVersion")); + assertEquals("1.7", metadata.getDefaults().get("javaVersion")); + assertEquals("org.test", metadata.getDefaults().get("groupId")); + assertEquals("demo", metadata.getDefaults().get("name")); + assertEquals("Demo project for Spring Boot", metadata.getDefaults().get("description")); assertEquals("jar", metadata.getDefaults().get("packaging")); assertEquals("java", metadata.getDefaults().get("language")); + assertEquals("demo", metadata.getDefaults().get("artifactId")); + assertEquals("demo", metadata.getDefaults().get("packageName")); + assertEquals("maven-project", metadata.getDefaults().get("type")); + assertEquals("0.0.1-SNAPSHOT", metadata.getDefaults().get("version")); + assertEquals("Wrong number of defaults", 11, metadata.getDefaults().size()); } @Test public void parseDependencies() { - InitializrServiceMetadata metadata = createInstance("1.0.0"); + InitializrServiceMetadata metadata = createInstance("2.0.0"); assertEquals(5, metadata.getDependencies().size()); // Security description @@ -60,16 +69,8 @@ public class InitializrServiceMetadataTests { } @Test - public void parseTypesNoTag() { - InitializrServiceMetadata metadata = createInstance("1.0.0"); - ProjectType projectType = metadata.getProjectTypes().get("maven-project"); - assertNotNull(projectType); - assertEquals(0, projectType.getTags().size()); - } - - @Test - public void parseTypesWithTags() { - InitializrServiceMetadata metadata = createInstance("1.1.0"); + public void parseTypes() { + InitializrServiceMetadata metadata = createInstance("2.0.0"); ProjectType projectType = metadata.getProjectTypes().get("maven-project"); assertNotNull(projectType); assertEquals("maven", projectType.getTags().get("build")); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java index e194a660979..5347f178680 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java @@ -60,7 +60,7 @@ public class ProjectGenerationRequestTests { this.request.setServiceUrl(customServerUrl); this.request.getDependencies().add("security"); assertEquals(new URI(customServerUrl - + "/starter.zip?style=security&type=test-type"), + + "/starter.zip?dependencies=security&type=test-type"), this.request.generateUrl(createDefaultMetadata())); } @@ -74,7 +74,7 @@ public class ProjectGenerationRequestTests { @Test public void singleDependency() { this.request.getDependencies().add("web"); - assertEquals(createDefaultUrl("?style=web&type=test-type"), + assertEquals(createDefaultUrl("?dependencies=web&type=test-type"), this.request.generateUrl(createDefaultMetadata())); } @@ -82,7 +82,7 @@ public class ProjectGenerationRequestTests { public void multipleDependencies() { this.request.getDependencies().add("web"); this.request.getDependencies().add("data-jpa"); - assertEquals(createDefaultUrl("?style=web&style=data-jpa&type=test-type"), + assertEquals(createDefaultUrl("?dependencies=web%2Cdata-jpa&type=test-type"), this.request.generateUrl(createDefaultMetadata())); } @@ -108,7 +108,7 @@ public class ProjectGenerationRequestTests { this.request.setType("custom"); this.request.getDependencies().add("data-rest"); assertEquals(new URI(ProjectGenerationRequest.DEFAULT_SERVICE_URL - + "/foo?style=data-rest&type=custom"), this.request.generateUrl(metadata)); + + "/foo?dependencies=data-rest&type=custom"), this.request.generateUrl(metadata)); } @Test @@ -187,7 +187,7 @@ public class ProjectGenerationRequestTests { } private static InitializrServiceMetadata readMetadata() { - return readMetadata("1.1.0"); + return readMetadata("2.0.0"); } private static InitializrServiceMetadata readMetadata(String version) { diff --git a/spring-boot-cli/src/test/resources/metadata/service-metadata-1.0.0.json b/spring-boot-cli/src/test/resources/metadata/service-metadata-1.0.0.json deleted file mode 100644 index 99a80e0043a..00000000000 --- a/spring-boot-cli/src/test/resources/metadata/service-metadata-1.0.0.json +++ /dev/null @@ -1,134 +0,0 @@ -{"dependencies": [ - { - "name": "Core", - "content": [ - { - "name": "Security", - "id": "security", - "description": "Security description" - }, - { - "name": "AOP", - "id": "aop" - } - ] - }, - { - "name": "Data", - "content": [ - { - "name": "JDBC", - "id": "jdbc" - }, - { - "name": "JPA", - "id": "data-jpa" - }, - { - "name": "MongoDB", - "id": "data-mongodb" - } - ] - } -], "types": [ - { - "name": "Maven POM", - "id": "maven-build", - "action": "/pom.xml", - "default": false - }, - { - "name": "Maven Project", - "id": "maven-project", - "action": "/starter.zip", - "default": true - }, - { - "name": "Gradle Config", - "id": "gradle-build", - "action": "/build.gradle", - "default": false - }, - { - "name": "Gradle Project", - "id": "gradle-project", - "action": "/starter.zip", - "default": false - } -], "packagings": [ - { - "name": "Jar", - "id": "jar", - "default": true - }, - { - "name": "War", - "id": "war", - "default": false - } -], "javaVersions": [ - { - "name": "1.6", - "id": "1.6", - "default": false - }, - { - "name": "1.7", - "id": "1.7", - "default": true - }, - { - "name": "1.8", - "id": "1.8", - "default": false - } -], "languages": [ - { - "name": "Groovy", - "id": "groovy", - "default": false - }, - { - "name": "Java", - "id": "java", - "default": true - } -], "bootVersions": [ - { - "name": "1.2.0 M2", - "id": "1.2.0.M2", - "default": false - }, - { - "name": "1.2.0 (SNAPSHOT)", - "id": "1.2.0.BUILD-SNAPSHOT", - "default": false - }, - { - "name": "1.1.8", - "id": "1.1.8.RELEASE", - "default": true - }, - { - "name": "1.1.8 (SNAPSHOT)", - "id": "1.1.8.BUILD-SNAPSHOT", - "default": false - }, - { - "name": "1.0.2", - "id": "1.0.2.RELEASE", - "default": false - } -], "defaults": { - "groupId": "org.test", - "artifactId": "demo", - "version": "0.0.1-SNAPSHOT", - "name": "demo", - "description": "Demo project for Spring Boot", - "packageName": "demo", - "type": "maven-project", - "packaging": "jar", - "javaVersion": "1.7", - "language": "java", - "bootVersion": "1.1.8.RELEASE" -}} diff --git a/spring-boot-cli/src/test/resources/metadata/service-metadata-1.1.0.json b/spring-boot-cli/src/test/resources/metadata/service-metadata-1.1.0.json deleted file mode 100644 index d18786d0bc8..00000000000 --- a/spring-boot-cli/src/test/resources/metadata/service-metadata-1.1.0.json +++ /dev/null @@ -1,150 +0,0 @@ -{"dependencies": [ - { - "name": "Core", - "content": [ - { - "name": "Security", - "id": "security", - "description": "Security description" - }, - { - "name": "AOP", - "id": "aop" - } - ] - }, - { - "name": "Data", - "content": [ - { - "name": "JDBC", - "id": "jdbc" - }, - { - "name": "JPA", - "id": "data-jpa" - }, - { - "name": "MongoDB", - "id": "data-mongodb" - } - ] - } -], "types": [ - { - "name": "Maven POM", - "id": "maven-build", - "action": "/pom.xml", - "tags": { - "build": "maven", - "format": "build" - }, - "default": false - }, - { - "name": "Maven Project", - "id": "maven-project", - "action": "/starter.zip", - "tags": { - "build": "maven", - "format": "project" - }, - "default": true - }, - { - "name": "Gradle Config", - "id": "gradle-build", - "action": "/build.gradle", - "tags": { - "build": "gradle", - "format": "build" - }, - "default": false - }, - { - "name": "Gradle Project", - "id": "gradle-project", - "action": "/starter.zip", - "tags": { - "build": "gradle", - "format": "project" - }, - "default": false - } -], "packagings": [ - { - "name": "Jar", - "id": "jar", - "default": true - }, - { - "name": "War", - "id": "war", - "default": false - } -], "javaVersions": [ - { - "name": "1.6", - "id": "1.6", - "default": false - }, - { - "name": "1.7", - "id": "1.7", - "default": true - }, - { - "name": "1.8", - "id": "1.8", - "default": false - } -], "languages": [ - { - "name": "Groovy", - "id": "groovy", - "default": false - }, - { - "name": "Java", - "id": "java", - "default": true - } -], "bootVersions": [ - { - "name": "1.2.0 M2", - "id": "1.2.0.M2", - "default": false - }, - { - "name": "1.2.0 (SNAPSHOT)", - "id": "1.2.0.BUILD-SNAPSHOT", - "default": false - }, - { - "name": "1.1.8", - "id": "1.1.8.RELEASE", - "default": true - }, - { - "name": "1.1.8 (SNAPSHOT)", - "id": "1.1.8.BUILD-SNAPSHOT", - "default": false - }, - { - "name": "1.0.2", - "id": "1.0.2.RELEASE", - "default": false - } -], "defaults": { - "groupId": "org.test", - "artifactId": "demo", - "version": "0.0.1-SNAPSHOT", - "name": "demo", - "description": "Demo project for Spring Boot", - "packageName": "demo", - "type": "maven-project", - "packaging": "jar", - "javaVersion": "1.7", - "language": "java", - "bootVersion": "1.1.8.RELEASE" -}} diff --git a/spring-boot-cli/src/test/resources/metadata/service-metadata-2.0.0.json b/spring-boot-cli/src/test/resources/metadata/service-metadata-2.0.0.json new file mode 100644 index 00000000000..9cbec6fec7a --- /dev/null +++ b/spring-boot-cli/src/test/resources/metadata/service-metadata-2.0.0.json @@ -0,0 +1,190 @@ +{ + "_links": { + "maven-build": { + "href": "http://localhost:8080/pom.xml?{dependencies,type,packaging,javaVersion,language,bootVersion,groupId,artifactId,version,name,description,packageName}", + "templated": true + }, + "maven-project": { + "href": "http://localhost:8080/starter.zip{?dependencies,type,packaging,javaVersion,language,bootVersion,groupId,artifactId,version,name,description,packageName}", + "templated": true + }, + "gradle-build": { + "href": "http://localhost:8080/build.gradle{?dependencies,type,packaging,javaVersion,language,bootVersion,groupId,artifactId,version,name,description,packageName}", + "templated": true + }, + "gradle-project": { + "href": "http://localhost:8080/starter.zip{?dependencies,type,packaging,javaVersion,language,bootVersion,groupId,artifactId,version,name,description,packageName}", + "templated": true + } + }, + "dependencies": { + "type": "hierarchical-multi-select", + "values": [ + { + "name": "Core", + "values": [ + { + "name": "Security", + "id": "security", + "description": "Security description" + }, + { + "name": "AOP", + "id": "aop" + } + ] + }, + { + "name": "Data", + "values": [ + { + "name": "JDBC", + "id": "jdbc" + }, + { + "name": "JPA", + "id": "data-jpa" + }, + { + "name": "MongoDB", + "id": "data-mongodb" + } + ] + } + ] + }, + "type": { + "type": "action", + "default": "maven-project", + "values": [ + { + "id": "maven-build", + "name": "Maven POM", + "action": "/pom.xml", + "tags": { + "build": "maven", + "format": "build" + } + }, + { + "id": "maven-project", + "name": "Maven Project", + "action": "/starter.zip", + "tags": { + "build": "maven", + "format": "project" + } + }, + { + "id": "gradle-build", + "name": "Gradle Config", + "action": "/build.gradle", + "tags": { + "build": "gradle", + "format": "build" + } + }, + { + "id": "gradle-project", + "name": "Gradle Project", + "action": "/starter.zip", + "tags": { + "build": "gradle", + "format": "project" + } + } + ] + }, + "packaging": { + "type": "single-select", + "default": "jar", + "values": [ + { + "id": "jar", + "name": "Jar" + }, + { + "id": "war", + "name": "War" + } + ] + }, + "javaVersion": { + "type": "single-select", + "default": "1.7", + "values": [ + { + "id": "1.6", + "name": "1.6" + }, + { + "id": "1.7", + "name": "1.7" + }, + { + "id": "1.8", + "name": "1.8" + } + ] + }, + "language": { + "type": "single-select", + "default": "java", + "values": [ + { + "id": "groovy", + "name": "Groovy" + }, + { + "id": "java", + "name": "Java" + } + ] + }, + "bootVersion": { + "type": "single-select", + "default": "1.1.8.RELEASE", + "values": [ + { + "id": "1.2.0.BUILD-SNAPSHOT", + "name": "1.2.0 (SNAPSHOT)" + }, + { + "id": "1.1.8.RELEASE", + "name": "1.1.8" + }, + { + "id": "1.1.8.BUILD-SNAPSHOT", + "name": "1.1.8 (SNAPSHOT)" + }, + { + "id": "1.0.2.RELEASE", + "name": "1.0.2" + } + ] + }, + "groupId": { + "type": "text", + "default": "org.test" + }, + "artifactId": { + "type": "text", + "default": "demo" + }, + "version": { + "type": "text", + "default": "0.0.1-SNAPSHOT" + }, + "name": { + "type": "text", + "default": "demo" + }, + "description": { + "type": "text", + "default": "Demo project for Spring Boot" + }, + "packageName": { + "type": "text", + "default": "demo" + } +} \ No newline at end of file diff --git a/spring-boot-cli/src/test/resources/metadata/service-metadata-types-conflict.json b/spring-boot-cli/src/test/resources/metadata/service-metadata-types-conflict.json index b5a18aa0968..803450cb305 100644 --- a/spring-boot-cli/src/test/resources/metadata/service-metadata-types-conflict.json +++ b/spring-boot-cli/src/test/resources/metadata/service-metadata-types-conflict.json @@ -1,169 +1,207 @@ -{"dependencies": [ - { - "name": "Core", - "content": [ - { - "name": "Security", - "id": "security", - "description": "Security description" - }, - { - "name": "AOP", - "id": "aop" - } - ] - }, - { - "name": "Data", - "content": [ - { - "name": "JDBC", - "id": "jdbc" - }, - { - "name": "JPA", - "id": "data-jpa" - }, - { - "name": "MongoDB", - "id": "data-mongodb" - } - ] - } -], "types": [ - { - "name": "Maven POM", - "id": "maven-build", - "action": "/pom.xml", - "tags": { - "build": "maven", - "format": "build" - }, - "default": false - }, - { - "name": "Maven Project", - "id": "maven-project", - "action": "/starter.zip", - "tags": { - "build": "maven", - "format": "project" - }, - "default": false - }, - { - "name": "Another Maven Project", - "id": "maven-project-2", - "action": "/starter.zip", - "tags": { - "build": "maven", - "format": "project" - }, - "default": false - }, - { - "name": "Gradle Config", - "id": "gradle-build", - "action": "/build.gradle", - "tags": { - "build": "gradle", - "format": "build" - }, - "default": false - }, - { - "name": "Gradle Project", - "id": "gradle-project", - "action": "/starter.zip", - "tags": { - "build": "gradle", - "format": "project" - }, - "default": false - }, - { - "name": "Another gradle Project", - "id": "gradle-project-2", - "action": "/starter.zip", - "tags": { - "build": "gradle", - "format": "project" - }, - "default": false - } -], "packagings": [ - { - "name": "Jar", - "id": "jar", - "default": true - }, - { - "name": "War", - "id": "war", - "default": false - } -], "javaVersions": [ - { - "name": "1.6", - "id": "1.6", - "default": false - }, - { - "name": "1.7", - "id": "1.7", - "default": true - }, - { - "name": "1.8", - "id": "1.8", - "default": false - } -], "languages": [ - { - "name": "Groovy", - "id": "groovy", - "default": false - }, - { - "name": "Java", - "id": "java", - "default": true - } -], "bootVersions": [ - { - "name": "1.2.0 M2", - "id": "1.2.0.M2", - "default": false - }, - { - "name": "1.2.0 (SNAPSHOT)", - "id": "1.2.0.BUILD-SNAPSHOT", - "default": false - }, - { - "name": "1.1.8", - "id": "1.1.8.RELEASE", - "default": true - }, - { - "name": "1.1.8 (SNAPSHOT)", - "id": "1.1.8.BUILD-SNAPSHOT", - "default": false - }, - { - "name": "1.0.2", - "id": "1.0.2.RELEASE", - "default": false - } -], "defaults": { - "groupId": "org.test", - "artifactId": "demo", - "version": "0.0.1-SNAPSHOT", - "name": "demo", - "description": "Demo project for Spring Boot", - "packageName": "demo", - "packaging": "jar", - "javaVersion": "1.7", - "language": "java", - "bootVersion": "1.1.8.RELEASE" -}} +{ + "_links": { + "maven-build": { + "href": "http://localhost:8080/pom.xml?style={dependencies}{&type,packaging,javaVersion,language,bootVersion,groupId,artifactId,version,name,description,packageName}", + "templated": true + }, + "maven-project": { + "href": "http://localhost:8080/starter.zip?style={dependencies}{&type,packaging,javaVersion,language,bootVersion,groupId,artifactId,version,name,description,packageName}", + "templated": true + }, + "gradle-build": { + "href": "http://localhost:8080/build.gradle?style={dependencies}{&type,packaging,javaVersion,language,bootVersion,groupId,artifactId,version,name,description,packageName}", + "templated": true + }, + "gradle-project": { + "href": "http://localhost:8080/starter.zip?style={dependencies}{&type,packaging,javaVersion,language,bootVersion,groupId,artifactId,version,name,description,packageName}", + "templated": true + } + }, + "dependencies": { + "type": "hierarchical-multi-select", + "values": [ + { + "name": "Core", + "values": [ + { + "name": "Security", + "id": "security", + "description": "Security description" + }, + { + "name": "AOP", + "id": "aop" + } + ] + }, + { + "name": "Data", + "values": [ + { + "name": "JDBC", + "id": "jdbc" + }, + { + "name": "JPA", + "id": "data-jpa" + }, + { + "name": "MongoDB", + "id": "data-mongodb" + } + ] + } + ] + }, + "type": { + "type": "action", + "values": [ + { + "id": "maven-build", + "name": "Maven POM", + "action": "/pom.xml", + "tags": { + "build": "maven", + "format": "build" + } + }, + { + "id": "maven-project", + "name": "Maven Project", + "action": "/starter.zip", + "tags": { + "build": "maven", + "format": "project" + } + }, + { + "id": "maven-project-2", + "name": "Another Maven Project", + "action": "/starter.zip", + "tags": { + "build": "maven", + "format": "project" + } + }, + { + "id": "gradle-build", + "name": "Gradle Config", + "action": "/build.gradle", + "tags": { + "build": "gradle", + "format": "build" + } + }, + { + "id": "gradle-project", + "name": "Gradle Project", + "action": "/starter.zip", + "tags": { + "build": "gradle", + "format": "project" + } + }, + { + "id": "gradle-project-2", + "name": "Another Gradle Project", + "action": "/starter.zip", + "tags": { + "build": "gradle", + "format": "project" + } + } + ] + }, + "packaging": { + "type": "single-select", + "default": "jar", + "values": [ + { + "id": "jar", + "name": "Jar" + }, + { + "id": "war", + "name": "War" + } + ] + }, + "javaVersion": { + "type": "single-select", + "default": "1.7", + "values": [ + { + "id": "1.6", + "name": "1.6" + }, + { + "id": "1.7", + "name": "1.7" + }, + { + "id": "1.8", + "name": "1.8" + } + ] + }, + "language": { + "type": "single-select", + "default": "java", + "values": [ + { + "id": "groovy", + "name": "Groovy" + }, + { + "id": "java", + "name": "Java" + } + ] + }, + "bootVersion": { + "type": "single-select", + "default": "1.1.8.RELEASE", + "values": [ + { + "id": "1.2.0.BUILD-SNAPSHOT", + "name": "1.2.0 (SNAPSHOT)" + }, + { + "id": "1.1.8.RELEASE", + "name": "1.1.8" + }, + { + "id": "1.1.8.BUILD-SNAPSHOT", + "name": "1.1.8 (SNAPSHOT)" + }, + { + "id": "1.0.2.RELEASE", + "name": "1.0.2" + } + ] + }, + "groupId": { + "type": "text", + "default": "org.test" + }, + "artifactId": { + "type": "text", + "default": "demo" + }, + "version": { + "type": "text", + "default": "0.0.1-SNAPSHOT" + }, + "name": { + "type": "text", + "default": "demo" + }, + "description": { + "type": "text", + "default": "Demo project for Spring Boot" + }, + "packageName": { + "type": "text", + "default": "demo" + } +} \ No newline at end of file