Polish
This commit is contained in:
@@ -130,19 +130,15 @@ public class InitCommand extends OptionParsingCommand {
|
||||
|
||||
private void projectGenerationOptions() {
|
||||
this.groupId = option(Arrays.asList("groupId", "g"),
|
||||
"Project coordinates (for example 'org.test')")
|
||||
.withRequiredArg();
|
||||
"Project coordinates (for example 'org.test')").withRequiredArg();
|
||||
this.artifactId = option(Arrays.asList("artifactId", "a"),
|
||||
"Project coordinates; infer archive name (for example 'test')")
|
||||
.withRequiredArg();
|
||||
this.version = option(Arrays.asList("version", "v"),
|
||||
"Project version (for example '0.0.1-SNAPSHOT')")
|
||||
.withRequiredArg();
|
||||
"Project version (for example '0.0.1-SNAPSHOT')").withRequiredArg();
|
||||
this.name = option(Arrays.asList("name", "n"),
|
||||
"Project name; infer application name")
|
||||
.withRequiredArg();
|
||||
this.description = option("description",
|
||||
"Project description")
|
||||
"Project name; infer application name").withRequiredArg();
|
||||
this.description = option("description", "Project description")
|
||||
.withRequiredArg();
|
||||
this.packaging = option(Arrays.asList("packaging", "p"),
|
||||
"Project packaging (for example 'jar')").withRequiredArg();
|
||||
@@ -162,8 +158,7 @@ public class InitCommand extends OptionParsingCommand {
|
||||
this.javaVersion = option(Arrays.asList("java-version", "j"),
|
||||
"Language level (for example '1.8')").withRequiredArg();
|
||||
this.language = option(Arrays.asList("language", "l"),
|
||||
"Programming language (for example 'java')")
|
||||
.withRequiredArg();
|
||||
"Programming language (for example 'java')").withRequiredArg();
|
||||
this.bootVersion = option(Arrays.asList("boot-version", "b"),
|
||||
"Spring Boot version (for example '1.2.0.RELEASE')")
|
||||
.withRequiredArg();
|
||||
@@ -240,22 +235,22 @@ public class InitCommand extends OptionParsingCommand {
|
||||
if (options.has(this.type)) {
|
||||
request.setType(options.valueOf(this.type));
|
||||
}
|
||||
if(options.has(this.language)) {
|
||||
if (options.has(this.language)) {
|
||||
request.setLanguage(options.valueOf(this.language));
|
||||
}
|
||||
if(options.has(this.groupId)) {
|
||||
if (options.has(this.groupId)) {
|
||||
request.setGroupId(options.valueOf(this.groupId));
|
||||
}
|
||||
if (options.has(this.artifactId)) {
|
||||
request.setArtifactId(options.valueOf(this.artifactId));
|
||||
}
|
||||
if(options.has(this.name)) {
|
||||
if (options.has(this.name)) {
|
||||
request.setName(options.valueOf(this.name));
|
||||
}
|
||||
if(options.has(this.version)) {
|
||||
if (options.has(this.version)) {
|
||||
request.setVersion(options.valueOf(this.version));
|
||||
}
|
||||
if(options.has(this.description)) {
|
||||
if (options.has(this.description)) {
|
||||
request.setDescription(options.valueOf(this.description));
|
||||
}
|
||||
request.setExtract(options.has(this.extract));
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -392,7 +391,7 @@ class ProjectGenerationRequest {
|
||||
private static void filter(Map<String, ProjectType> projects, String tag,
|
||||
String tagValue) {
|
||||
for (Iterator<Map.Entry<String, ProjectType>> it = projects.entrySet().iterator(); it
|
||||
.hasNext(); ) {
|
||||
.hasNext();) {
|
||||
Map.Entry<String, ProjectType> entry = it.next();
|
||||
String value = entry.getValue().getTags().get(tag);
|
||||
if (!tagValue.equals(value)) {
|
||||
|
||||
@@ -81,7 +81,6 @@ public abstract class CompilerAutoConfiguration {
|
||||
|
||||
/**
|
||||
* Apply any additional configuration.
|
||||
*
|
||||
* @param loader the class loader being used during compilation
|
||||
* @param configuration the compiler configuration
|
||||
* @param generatorContext the current context
|
||||
@@ -93,4 +92,5 @@ public abstract class CompilerAutoConfiguration {
|
||||
GroovyCompilerConfiguration configuration, GeneratorContext generatorContext,
|
||||
SourceUnit source, ClassNode classNode) throws CompilationFailedException {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -100,11 +100,9 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans
|
||||
|
||||
private List<Map<String, String>> createDependencyMaps(Expression valueExpression) {
|
||||
Map<String, String> dependency = null;
|
||||
|
||||
List<ConstantExpression> constantExpressions = getConstantExpressions(valueExpression);
|
||||
List<Map<String, String>> dependencies = new ArrayList<Map<String, String>>(
|
||||
constantExpressions.size());
|
||||
|
||||
for (ConstantExpression expression : constantExpressions) {
|
||||
Object value = expression.getValue();
|
||||
if (value instanceof String) {
|
||||
@@ -122,7 +120,6 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
@@ -130,12 +127,10 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans
|
||||
if (valueExpression instanceof ListExpression) {
|
||||
return getConstantExpressions((ListExpression) valueExpression);
|
||||
}
|
||||
|
||||
if (valueExpression instanceof ConstantExpression
|
||||
&& ((ConstantExpression) valueExpression).getValue() instanceof String) {
|
||||
return Arrays.asList((ConstantExpression) valueExpression);
|
||||
}
|
||||
|
||||
reportError("@DependencyManagementBom requires an inline constant that is a "
|
||||
+ "string or a string array", valueExpression);
|
||||
return Collections.emptyList();
|
||||
@@ -166,16 +161,13 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans
|
||||
List<Map<String, String>> bomDependencies) {
|
||||
URI[] uris = Grape.getInstance().resolve(null,
|
||||
bomDependencies.toArray(new Map[bomDependencies.size()]));
|
||||
|
||||
DefaultModelBuilder modelBuilder = new DefaultModelBuilderFactory().newInstance();
|
||||
|
||||
for (URI uri : uris) {
|
||||
try {
|
||||
DefaultModelBuildingRequest request = new DefaultModelBuildingRequest();
|
||||
request.setModelResolver(new GrapeModelResolver());
|
||||
request.setModelSource(new UrlModelSource(uri.toURL()));
|
||||
Model model = modelBuilder.build(request).getEffectiveModel();
|
||||
|
||||
this.resolutionContext
|
||||
.addDependencyManagement(new MavenModelDependencyManagement(model));
|
||||
}
|
||||
@@ -236,4 +228,5 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,23 +28,21 @@ public interface DependencyManagement {
|
||||
|
||||
/**
|
||||
* Returns the managed dependencies.
|
||||
*
|
||||
* @return the managed dependencies
|
||||
*/
|
||||
List<Dependency> getDependencies();
|
||||
|
||||
/**
|
||||
* Returns the managed version of Spring Boot. May be {@code null}.
|
||||
*
|
||||
* @return the Spring Boot version, or {@code null}
|
||||
*/
|
||||
String getSpringBootVersion();
|
||||
|
||||
/**
|
||||
* Finds the managed dependency with the given {@code artifactId}.
|
||||
*
|
||||
* @param artifactId The artifact ID of the dependency to find
|
||||
* @return the dependency, or {@code null}
|
||||
*/
|
||||
Dependency find(String artifactId);
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ package org.springframework.boot.cli.compiler.dependencies;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link ArtifactCoordinatesResolver} backed by {@link SpringBootDependenciesDependencyManagement}.
|
||||
* {@link ArtifactCoordinatesResolver} backed by
|
||||
* {@link SpringBootDependenciesDependencyManagement}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Andy Wilkinson
|
||||
@@ -70,4 +71,5 @@ public class DependencyManagementArtifactCoordinatesResolver implements
|
||||
Dependency dependency = find(module);
|
||||
return dependency == null ? null : dependency.getVersion();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -75,4 +75,5 @@ public class MavenModelDependencyManagement implements DependencyManagement {
|
||||
public Dependency find(String artifactId) {
|
||||
return this.byArtifactId.get(artifactId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user