mirror of
https://gitee.com/dcren/initializr.git
synced 2025-04-05 17:38:06 +08:00
Remove support for Spring Boot 1.x
Closes gh-1152
This commit is contained in:
parent
a10c830fd5
commit
b8289de7e0
@ -40,7 +40,7 @@ import org.springframework.context.annotation.Bean;
|
||||
public class BuildProjectGenerationConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnPlatformVersion("[1.5.0.RELEASE,2.2.0.M3)")
|
||||
@ConditionalOnPlatformVersion("[2.0.0.RELEASE,2.2.0.M3)")
|
||||
public BuildCustomizer<Build> junit4TestStarterContributor() {
|
||||
return (build) -> build.dependencies().add("test", "org.springframework.boot", "spring-boot-starter-test",
|
||||
DependencyScope.TEST_COMPILE);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.spring.initializr.generator.spring.build.gradle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import io.spring.initializr.generator.buildsystem.gradle.GradleBuild;
|
||||
import io.spring.initializr.generator.project.contributor.ProjectContributor;
|
||||
|
||||
/**
|
||||
* {@link ProjectContributor} for the project's {@code settings.gradle} file when using
|
||||
* Gradle 3.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
class Gradle3SettingsGradleProjectContributor implements ProjectContributor {
|
||||
|
||||
private final GradleBuild build;
|
||||
|
||||
Gradle3SettingsGradleProjectContributor(GradleBuild build) {
|
||||
this.build = build;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contribute(Path projectRoot) throws IOException {
|
||||
Path file = Files.createFile(projectRoot.resolve("settings.gradle"));
|
||||
try (PrintWriter writer = new PrintWriter(Files.newOutputStream(file))) {
|
||||
writer.println("rootProject.name = '" + this.build.getSettings().getArtifact() + "'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -20,7 +20,6 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.spring.initializr.generator.buildsystem.BuildItemResolver;
|
||||
import io.spring.initializr.generator.buildsystem.gradle.Gradle3BuildWriter;
|
||||
import io.spring.initializr.generator.buildsystem.gradle.GradleBuild;
|
||||
import io.spring.initializr.generator.buildsystem.gradle.GradleBuildSystem;
|
||||
import io.spring.initializr.generator.buildsystem.gradle.GroovyDslGradleBuildWriter;
|
||||
@ -121,40 +120,6 @@ public class GradleProjectGenerationConfiguration {
|
||||
return new GradleBuildProjectContributor(buildWriter, build, this.indentingWriterFactory, "build.gradle.kts");
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration specific to projects using Gradle 3.
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnGradleVersion("3")
|
||||
@ConditionalOnBuildSystem(GradleBuildSystem.ID)
|
||||
static class Gradle3ProjectGenerationConfiguration {
|
||||
|
||||
@Bean
|
||||
Gradle3BuildWriter gradleBuildWriter() {
|
||||
return new Gradle3BuildWriter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
GradleWrapperContributor gradle3WrapperContributor() {
|
||||
return new GradleWrapperContributor("3");
|
||||
}
|
||||
|
||||
@Bean
|
||||
Gradle3SettingsGradleProjectContributor settingsGradleProjectContributor(GradleBuild build) {
|
||||
return new Gradle3SettingsGradleProjectContributor(build);
|
||||
}
|
||||
|
||||
@Bean
|
||||
BuildCustomizer<GradleBuild> springBootPluginContributor(ProjectDescription description) {
|
||||
return (build) -> {
|
||||
build.buildscript((buildscript) -> buildscript.dependency(
|
||||
"org.springframework.boot:spring-boot-gradle-plugin:" + description.getPlatformVersion()));
|
||||
build.plugins().apply("org.springframework.boot");
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration specific to projects using Gradle 4.
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -36,8 +36,6 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
*/
|
||||
public class OnGradleVersionCondition extends ProjectGenerationCondition {
|
||||
|
||||
private static final VersionRange GRADLE_3_VERSION_RANGE = VersionParser.DEFAULT.parseRange("[1.5.0.M1,2.0.0.M1)");
|
||||
|
||||
private static final VersionRange GRADLE_4_VERSION_RANGE = VersionParser.DEFAULT.parseRange("[2.0.0.M1, 2.1.0.M1)");
|
||||
|
||||
private static final VersionRange GRADLE_5_VERSION_RANGE = VersionParser.DEFAULT
|
||||
@ -61,9 +59,6 @@ public class OnGradleVersionCondition extends ProjectGenerationCondition {
|
||||
if (platformVersion == null) {
|
||||
return null;
|
||||
}
|
||||
else if (GRADLE_3_VERSION_RANGE.match(platformVersion)) {
|
||||
return "3";
|
||||
}
|
||||
else if (GRADLE_4_VERSION_RANGE.match(platformVersion)) {
|
||||
return "4";
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -43,7 +43,7 @@ public class SourceCodeProjectGenerationConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnPlatformVersion("[1.5.0.RELEASE,2.2.0.M3)")
|
||||
@ConditionalOnPlatformVersion("[2.0.0.RELEASE,2.2.0.M3)")
|
||||
public TestApplicationTypeCustomizer<TypeDeclaration> junit4SpringBootTestTypeCustomizer() {
|
||||
return (typeDeclaration) -> {
|
||||
typeDeclaration.annotate(Annotation.name("org.junit.runner.RunWith", (annotation) -> annotation
|
||||
@ -72,14 +72,6 @@ public class SourceCodeProjectGenerationConfiguration {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnPlatformVersion("[1.5.0.M1, 2.0.0.M1)")
|
||||
ServletInitializerContributor boot15ServletInitializerContributor(
|
||||
ObjectProvider<ServletInitializerCustomizer<?>> servletInitializerCustomizers) {
|
||||
return new ServletInitializerContributor(this.description.getPackageName(),
|
||||
"org.springframework.boot.web.support.SpringBootServletInitializer", servletInitializerCustomizers);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnPlatformVersion("2.0.0.M1")
|
||||
ServletInitializerContributor boot20ServletInitializerContributor(
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -61,7 +61,7 @@ class GroovyProjectGenerationDefaultContributorsConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnPlatformVersion("[1.5.0.RELEASE,2.2.0.M3)")
|
||||
@ConditionalOnPlatformVersion("[2.0.0.RELEASE,2.2.0.M3)")
|
||||
TestApplicationTypeCustomizer<GroovyTypeDeclaration> junit4TestMethodContributor() {
|
||||
return (typeDeclaration) -> {
|
||||
GroovyMethodDeclaration method = GroovyMethodDeclaration.method("contextLoads").modifiers(Modifier.PUBLIC)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -59,7 +59,7 @@ class JavaProjectGenerationDefaultContributorsConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnPlatformVersion("[1.5.0.RELEASE,2.2.0.M3)")
|
||||
@ConditionalOnPlatformVersion("[2.0.0.RELEASE,2.2.0.M3)")
|
||||
TestApplicationTypeCustomizer<JavaTypeDeclaration> junit4TestMethodContributor() {
|
||||
return (typeDeclaration) -> {
|
||||
typeDeclaration.modifiers(Modifier.PUBLIC);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -19,10 +19,7 @@ package io.spring.initializr.generator.spring.code.kotlin;
|
||||
import io.spring.initializr.generator.buildsystem.Build;
|
||||
import io.spring.initializr.generator.buildsystem.Dependency;
|
||||
import io.spring.initializr.generator.buildsystem.DependencyScope;
|
||||
import io.spring.initializr.generator.buildsystem.maven.MavenBuild;
|
||||
import io.spring.initializr.generator.spring.build.BuildCustomizer;
|
||||
import io.spring.initializr.generator.version.Version;
|
||||
import io.spring.initializr.generator.version.VersionReference;
|
||||
|
||||
/**
|
||||
* {@link BuildCustomizer} that adds the dependencies required by projects written in
|
||||
@ -32,27 +29,12 @@ import io.spring.initializr.generator.version.VersionReference;
|
||||
*/
|
||||
class KotlinDependenciesConfigurer implements BuildCustomizer<Build> {
|
||||
|
||||
private final Version springBootVersion;
|
||||
|
||||
KotlinDependenciesConfigurer(Version springBootVersion) {
|
||||
this.springBootVersion = springBootVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customize(Build build) {
|
||||
VersionReference version = determineDependencyVersion(build);
|
||||
build.dependencies().add("kotlin-stdlib",
|
||||
Dependency.withCoordinates("org.jetbrains.kotlin", "kotlin-stdlib-jdk8").version(version)
|
||||
.scope(DependencyScope.COMPILE));
|
||||
build.dependencies().add("kotlin-reflect", Dependency.withCoordinates("org.jetbrains.kotlin", "kotlin-reflect")
|
||||
.version(version).scope(DependencyScope.COMPILE));
|
||||
}
|
||||
|
||||
private VersionReference determineDependencyVersion(Build build) {
|
||||
if (build instanceof MavenBuild && this.springBootVersion.compareTo(Version.parse("2.0.0.M1")) <= 0) {
|
||||
return VersionReference.ofProperty("kotlin.version");
|
||||
}
|
||||
return null;
|
||||
build.dependencies().add("kotlin-stdlib", Dependency
|
||||
.withCoordinates("org.jetbrains.kotlin", "kotlin-stdlib-jdk8").scope(DependencyScope.COMPILE));
|
||||
build.dependencies().add("kotlin-reflect",
|
||||
Dependency.withCoordinates("org.jetbrains.kotlin", "kotlin-reflect").scope(DependencyScope.COMPILE));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -54,7 +54,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
class KotlinProjectGenerationDefaultContributorsConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnPlatformVersion("[1.5.0.RELEASE,2.2.0.M3)")
|
||||
@ConditionalOnPlatformVersion("[2.0.0.RELEASE,2.2.0.M3)")
|
||||
TestApplicationTypeCustomizer<KotlinTypeDeclaration> junit4TestMethodContributor() {
|
||||
return (typeDeclaration) -> {
|
||||
KotlinFunctionDeclaration function = KotlinFunctionDeclaration.function("contextLoads").body();
|
||||
@ -74,8 +74,8 @@ class KotlinProjectGenerationDefaultContributorsConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
BuildCustomizer<Build> kotlinDependenciesConfigurer(ProjectDescription description) {
|
||||
return new KotlinDependenciesConfigurer(description.getPlatformVersion());
|
||||
BuildCustomizer<Build> kotlinDependenciesConfigurer() {
|
||||
return new KotlinDependenciesConfigurer();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ -91,31 +91,6 @@ class KotlinProjectGenerationDefaultContributorsConfiguration {
|
||||
return new KotlinJpaMavenBuildCustomizer(metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration for Kotlin projects using Spring Boot 1.5.
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnPlatformVersion("[1.5.0.M1, 2.0.0.M1)")
|
||||
static class SpringBoot15KotlinProjectGenerationConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBuildSystem(MavenBuildSystem.ID)
|
||||
KotlinMavenFullBuildCustomizer kotlinBuildCustomizer(KotlinProjectSettings kotlinProjectSettings) {
|
||||
return new KotlinMavenFullBuildCustomizer(kotlinProjectSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
MainCompilationUnitCustomizer<KotlinTypeDeclaration, KotlinCompilationUnit> boot15MainFunctionContributor(
|
||||
ProjectDescription description) {
|
||||
return (compilationUnit) -> compilationUnit.addTopLevelFunction(
|
||||
KotlinFunctionDeclaration.function("main").parameters(new Parameter("Array<String>", "args"))
|
||||
.body(new KotlinExpressionStatement(
|
||||
new KotlinFunctionInvocation("org.springframework.boot.SpringApplication", "run",
|
||||
description.getApplicationName() + "::class.java", "*args"))));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration for Kotlin projects using Spring Boot 2.0 and later.
|
||||
*/
|
||||
|
Binary file not shown.
@ -1,6 +0,0 @@
|
||||
#Tue Nov 06 15:58:51 GMT 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5.1-bin.zip
|
@ -1,172 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save ( ) {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
@ -1,84 +0,0 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -57,16 +57,11 @@ class BuildComplianceTests extends AbstractComplianceTests {
|
||||
|
||||
private static final Language kotlin = new KotlinLanguage();
|
||||
|
||||
static Stream<Arguments> previousGenerationParameters() {
|
||||
return Stream.of(Arguments.arguments(BuildSystem.forId(MavenBuildSystem.ID), "pom.xml"),
|
||||
Arguments.arguments(BuildSystem.forId(GradleBuildSystem.ID), "build.gradle"));
|
||||
}
|
||||
|
||||
static Stream<Arguments> parameters() {
|
||||
return Stream.concat(previousGenerationParameters(),
|
||||
Stream.of(Arguments.arguments(
|
||||
BuildSystem.forIdAndDialect(GradleBuildSystem.ID, GradleBuildSystem.DIALECT_KOTLIN),
|
||||
"build.gradle.kts")));
|
||||
return Stream.of(Arguments.arguments(BuildSystem.forId(MavenBuildSystem.ID), "pom.xml"),
|
||||
Arguments.arguments(BuildSystem.forId(GradleBuildSystem.ID), "build.gradle"),
|
||||
Arguments.arguments(BuildSystem.forIdAndDialect(GradleBuildSystem.ID, GradleBuildSystem.DIALECT_KOTLIN),
|
||||
"build.gradle.kts"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ -143,30 +138,6 @@ class BuildComplianceTests extends AbstractComplianceTests {
|
||||
new ClassPathResource("project/" + language + "/next/" + getAssertFileName(fileName)));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("previousGenerationParameters")
|
||||
void previousGenerationJarJava(BuildSystem build, String fileName) {
|
||||
testPreviousGenerationJar(java, build, fileName);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("previousGenerationParameters")
|
||||
void previousGenerationJarGroovy(BuildSystem build, String fileName) {
|
||||
testPreviousGenerationJar(groovy, build, fileName);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("previousGenerationParameters")
|
||||
void previousGenerationJarKotlin(BuildSystem build, String fileName) {
|
||||
testPreviousGenerationJar(kotlin, build, fileName);
|
||||
}
|
||||
|
||||
private void testPreviousGenerationJar(Language language, BuildSystem build, String fileName) {
|
||||
ProjectStructure project = generateProject(language, build, "1.5.18.RELEASE");
|
||||
assertThat(project).textFile(fileName).hasSameContentAs(
|
||||
new ClassPathResource("project/" + language + "/previous/" + getAssertFileName(fileName)));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("parameters")
|
||||
void kotlinJava11(BuildSystem build, String fileName) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -36,14 +36,6 @@ public class ConditionalOnGradleVersionTests {
|
||||
private final ProjectAssetTester projectTester = new ProjectAssetTester()
|
||||
.withConfiguration(GradleVersionTestConfiguration.class);
|
||||
|
||||
@Test
|
||||
void outcomeWithSpringBoot15() {
|
||||
MutableProjectDescription description = new MutableProjectDescription();
|
||||
description.setPlatformVersion(Version.parse("1.5.18.RELEASE"));
|
||||
this.projectTester.configure(description, (context) -> assertThat(context).hasSingleBean(String.class)
|
||||
.getBean(String.class).isEqualTo("testGradle3"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void outcomeWithSpringBoot20() {
|
||||
MutableProjectDescription description = new MutableProjectDescription();
|
||||
@ -73,39 +65,25 @@ public class ConditionalOnGradleVersionTests {
|
||||
this.projectTester.configure(description, (context) -> assertThat(context).doesNotHaveBean(String.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void outcomeWithSpringBoot15AndMultipleGenerations() {
|
||||
MutableProjectDescription description = new MutableProjectDescription();
|
||||
description.setPlatformVersion(Version.parse("1.5.18.RELEASE"));
|
||||
this.projectTester.withConfiguration(Gradle3Or4TestConfiguration.class).configure(description,
|
||||
(context) -> assertThat(context).getBeanNames(String.class).containsOnly("gradle3", "gradle3AndLater"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void outcomeWithSpringBoot20AndMultipleGenerations() {
|
||||
MutableProjectDescription description = new MutableProjectDescription();
|
||||
description.setPlatformVersion(Version.parse("2.0.9.RELEASE"));
|
||||
this.projectTester.withConfiguration(Gradle3Or4TestConfiguration.class).configure(description,
|
||||
(context) -> assertThat(context).getBeanNames(String.class).containsOnly("gradle4", "gradle3AndLater"));
|
||||
this.projectTester.withConfiguration(Gradle4Or5TestConfiguration.class).configure(description,
|
||||
(context) -> assertThat(context).getBeanNames(String.class).containsOnly("gradle4", "gradle4Or5"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void outcomeWithSpringBoot21AndMultipleNonMatchingGenerations() {
|
||||
void outcomeWithSpringBoot24AndMultipleNonMatchingGenerations() {
|
||||
MutableProjectDescription description = new MutableProjectDescription();
|
||||
description.setPlatformVersion(Version.parse("2.1.3.RELEASE"));
|
||||
this.projectTester.withConfiguration(Gradle3Or4TestConfiguration.class).configure(description,
|
||||
(context) -> assertThat(context).getBeanNames(String.class).containsOnly("gradle5"));
|
||||
description.setPlatformVersion(Version.parse("2.4.0"));
|
||||
this.projectTester.withConfiguration(Gradle4Or5TestConfiguration.class).configure(description,
|
||||
(context) -> assertThat(context).getBeanNames(String.class).containsOnly("gradle6"));
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class GradleVersionTestConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnGradleVersion("3")
|
||||
String gradle3() {
|
||||
return "testGradle3";
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnGradleVersion("4")
|
||||
String gradle4() {
|
||||
@ -118,15 +96,21 @@ public class ConditionalOnGradleVersionTests {
|
||||
return "testGradle5";
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnGradleVersion("6")
|
||||
String gradle6() {
|
||||
return "testGradle6";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class Gradle3Or4TestConfiguration {
|
||||
static class Gradle4Or5TestConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnGradleVersion({ "3", "4" })
|
||||
String gradle3AndLater() {
|
||||
return "testGradle3AndLater";
|
||||
@ConditionalOnGradleVersion({ "4", "5" })
|
||||
String gradle4Or5() {
|
||||
return "testGradle4Or5";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -65,8 +65,7 @@ class GradleProjectGenerationConfigurationTests {
|
||||
}
|
||||
|
||||
static Stream<Arguments> supportedPlatformVersions() {
|
||||
return Stream.of(Arguments.arguments("1.5.17.RELEASE"), Arguments.arguments("2.1.3.RELEASE"),
|
||||
Arguments.arguments("2.2.3.RELEASE"));
|
||||
return Stream.of(Arguments.arguments("2.1.3.RELEASE"), Arguments.arguments("2.2.3.RELEASE"));
|
||||
}
|
||||
|
||||
@ParameterizedTest(name = "Spring Boot {0}")
|
||||
@ -84,8 +83,8 @@ class GradleProjectGenerationConfigurationTests {
|
||||
}
|
||||
|
||||
static Stream<Arguments> gradleWrapperParameters() {
|
||||
return Stream.of(Arguments.arguments("1.5.17.RELEASE", "3.5.1"), Arguments.arguments("2.0.6.RELEASE", "4.10.3"),
|
||||
Arguments.arguments("2.1.3.RELEASE", "5.6.4"), Arguments.arguments("2.2.3.RELEASE", "6.6.1"));
|
||||
return Stream.of(Arguments.arguments("2.0.6.RELEASE", "4.10.3"), Arguments.arguments("2.1.3.RELEASE", "5.6.4"),
|
||||
Arguments.arguments("2.2.3.RELEASE", "6.6.1"));
|
||||
}
|
||||
|
||||
@ParameterizedTest(name = "Spring Boot {0}")
|
||||
@ -200,8 +199,7 @@ class GradleProjectGenerationConfigurationTests {
|
||||
}
|
||||
|
||||
static Stream<Arguments> annotationProcessorScopeBuildParameters() {
|
||||
return Stream.of(Arguments.arguments("1.5.17.RELEASE", false), Arguments.arguments("2.0.6.RELEASE", true),
|
||||
Arguments.arguments("2.1.3.RELEASE", true));
|
||||
return Stream.of(Arguments.arguments("2.0.6.RELEASE", true), Arguments.arguments("2.1.3.RELEASE", true));
|
||||
}
|
||||
|
||||
@ParameterizedTest(name = "Spring Boot {0}")
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -41,7 +41,7 @@ class GradleWrapperContributorTests {
|
||||
Path directory;
|
||||
|
||||
static Stream<Arguments> parameters() {
|
||||
return Stream.of(Arguments.arguments("3"), Arguments.arguments("4"), Arguments.arguments("5"));
|
||||
return Stream.of(Arguments.arguments("4"), Arguments.arguments("5"));
|
||||
}
|
||||
|
||||
@ParameterizedTest(name = "Gradle {0}")
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -27,7 +27,6 @@ import io.spring.initializr.generator.language.kotlin.KotlinLanguage;
|
||||
import io.spring.initializr.generator.packaging.Packaging;
|
||||
import io.spring.initializr.generator.spring.AbstractComplianceTests;
|
||||
import io.spring.initializr.generator.test.project.ProjectStructure;
|
||||
import io.spring.initializr.generator.version.Version;
|
||||
import io.spring.initializr.metadata.support.MetadataBuildItemMapper;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
@ -85,16 +84,6 @@ class CodeComplianceTests extends AbstractComplianceTests {
|
||||
"project/" + language + "/standard/DemoApplication." + getExpectedExtension(language)));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("parameters")
|
||||
void previousGenerationMainClass(Language language) {
|
||||
ProjectStructure project = generateProject(language, maven, "2.1.1.RELEASE",
|
||||
(description) -> description.setPlatformVersion(Version.parse("1.5.18.RELEASE")));
|
||||
assertThat(project).asJvmModule(language).mainSource("com.example.demo", "DemoApplication")
|
||||
.hasSameContentAs(new ClassPathResource(
|
||||
"project/" + language + "/previous/" + "/DemoApplication." + getExpectedExtension(language)));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("parameters")
|
||||
void currentGenerationTestClass(Language language) {
|
||||
@ -124,18 +113,6 @@ class CodeComplianceTests extends AbstractComplianceTests {
|
||||
"project/" + language + "/standard/" + "ServletInitializer." + getExpectedExtension(language)));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("parameters")
|
||||
void previousGenerationServletInitializer(Language language) {
|
||||
ProjectStructure project = generateProject(language, maven, "2.1.1.RELEASE", (description) -> {
|
||||
description.setPackaging(Packaging.forId("war"));
|
||||
description.setPlatformVersion(Version.parse("1.5.18.RELEASE"));
|
||||
});
|
||||
assertThat(project).asJvmModule(language).mainSource("com.example.demo", "ServletInitializer")
|
||||
.hasSameContentAs(new ClassPathResource(
|
||||
"project/" + language + "/previous/" + "ServletInitializer." + getExpectedExtension(language)));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("parameters")
|
||||
void currentGenerationCustomCoordinates(Language language) {
|
||||
@ -153,20 +130,6 @@ class CodeComplianceTests extends AbstractComplianceTests {
|
||||
+ getExpectedExtension(language)));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("parameters")
|
||||
void previousGenerationCustomCoordinates(Language language) {
|
||||
ProjectStructure project = generateProject(language, maven, "1.5.18.RELEASE", (description) -> {
|
||||
description.setGroupId("com.example.acme");
|
||||
description.setArtifactId("my-project");
|
||||
description.setPackageName("com.example.acme.myproject");
|
||||
description.setApplicationName("MyProjectApplication");
|
||||
});
|
||||
assertThat(project).asJvmModule(language).mainSource("com.example.acme.myproject", "MyProjectApplication")
|
||||
.hasSameContentAs(new ClassPathResource(
|
||||
"project/" + language + "/previous/MyProjectApplication." + getExpectedExtension(language)));
|
||||
}
|
||||
|
||||
private String getExpectedExtension(Language language) {
|
||||
return language.sourceFileExtension() + ".gen";
|
||||
}
|
||||
|
@ -86,11 +86,6 @@ class SourceCodeProjectGenerationConfigurationTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void springBoot15WarServletInitializerContributor() {
|
||||
runWarTest("1.5.0", "org.springframework.boot.web.support.SpringBootServletInitializer");
|
||||
}
|
||||
|
||||
@Test
|
||||
void springBoot20WarServletInitializerContributor() {
|
||||
runWarTest("2.1.0", "org.springframework.boot.web.servlet.support.SpringBootServletInitializer");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -20,7 +20,6 @@ import io.spring.initializr.generator.buildsystem.Dependency;
|
||||
import io.spring.initializr.generator.buildsystem.DependencyScope;
|
||||
import io.spring.initializr.generator.buildsystem.gradle.GradleBuild;
|
||||
import io.spring.initializr.generator.buildsystem.maven.MavenBuild;
|
||||
import io.spring.initializr.generator.version.Version;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ -35,7 +34,7 @@ class KotlinDependenciesConfigurerTests {
|
||||
@Test
|
||||
void configuresDependenciesForGradleBuild() {
|
||||
GradleBuild build = new GradleBuild();
|
||||
new KotlinDependenciesConfigurer(Version.parse("2.1.0.RELEASE")).customize(build);
|
||||
new KotlinDependenciesConfigurer().customize(build);
|
||||
assertThat(build.dependencies().ids()).containsOnly("kotlin-stdlib", "kotlin-reflect");
|
||||
Dependency kotlinStdlib = build.dependencies().get("kotlin-stdlib");
|
||||
assertThat(kotlinStdlib.getGroupId()).isEqualTo("org.jetbrains.kotlin");
|
||||
@ -49,25 +48,9 @@ class KotlinDependenciesConfigurerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void configuresDependenciesForMavenBuildWithBoot15() {
|
||||
void configuresDependenciesForMavenBuild() {
|
||||
MavenBuild build = new MavenBuild();
|
||||
new KotlinDependenciesConfigurer(Version.parse("1.5.17.RELEASE")).customize(build);
|
||||
assertThat(build.dependencies().ids()).containsOnly("kotlin-stdlib", "kotlin-reflect");
|
||||
Dependency kotlinStdlib = build.dependencies().get("kotlin-stdlib");
|
||||
assertThat(kotlinStdlib.getGroupId()).isEqualTo("org.jetbrains.kotlin");
|
||||
assertThat(kotlinStdlib.getArtifactId()).isEqualTo("kotlin-stdlib-jdk8");
|
||||
assertThat(kotlinStdlib.getVersion()).hasToString("${kotlin.version}");
|
||||
assertThat(kotlinStdlib.getScope()).isEqualTo(DependencyScope.COMPILE);
|
||||
Dependency kotlinReflect = build.dependencies().get("kotlin-reflect");
|
||||
assertThat(kotlinReflect.getGroupId()).isEqualTo("org.jetbrains.kotlin");
|
||||
assertThat(kotlinReflect.getArtifactId()).isEqualTo("kotlin-reflect");
|
||||
assertThat(kotlinReflect.getVersion()).hasToString("${kotlin.version}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void configuresDependenciesForMavenBuildWithBoot20() {
|
||||
MavenBuild build = new MavenBuild();
|
||||
new KotlinDependenciesConfigurer(Version.parse("2.0.6.RELEASE")).customize(build);
|
||||
new KotlinDependenciesConfigurer().customize(build);
|
||||
assertThat(build.dependencies().ids()).containsOnly("kotlin-stdlib", "kotlin-reflect");
|
||||
Dependency kotlinStdlib = build.dependencies().get("kotlin-stdlib");
|
||||
assertThat(kotlinStdlib.getGroupId()).isEqualTo("org.jetbrains.kotlin");
|
||||
|
@ -1,13 +0,0 @@
|
||||
package com.example.demo
|
||||
|
||||
import org.springframework.boot.SpringApplication
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
|
||||
@SpringBootApplication
|
||||
class DemoApplication {
|
||||
|
||||
static void main(String[] args) {
|
||||
SpringApplication.run(DemoApplication, args)
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.example.acme.myproject
|
||||
|
||||
import org.springframework.boot.SpringApplication
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
|
||||
@SpringBootApplication
|
||||
class MyProjectApplication {
|
||||
|
||||
static void main(String[] args) {
|
||||
SpringApplication.run(MyProjectApplication, args)
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.example.demo
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder
|
||||
import org.springframework.boot.web.support.SpringBootServletInitializer
|
||||
|
||||
class ServletInitializer extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
application.sources(DemoApplication)
|
||||
}
|
||||
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.18.RELEASE'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'groovy'
|
||||
}
|
||||
|
||||
apply plugin: 'org.springframework.boot'
|
||||
|
||||
group = 'com.example'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
sourceCompatibility = '1.8'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'org.springframework.boot:spring-boot-starter'
|
||||
compile 'org.codehaus.groovy:groovy'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.5.18.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>demo</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>demo</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.gmavenplus</groupId>
|
||||
<artifactId>gmavenplus-plugin</artifactId>
|
||||
<version>1.11.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>addSources</goal>
|
||||
<goal>addTestSources</goal>
|
||||
<goal>generateStubs</goal>
|
||||
<goal>compile</goal>
|
||||
<goal>generateTestStubs</goal>
|
||||
<goal>compileTests</goal>
|
||||
<goal>removeStubs</goal>
|
||||
<goal>removeTestStubs</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -1,13 +0,0 @@
|
||||
package com.example.demo;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class DemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DemoApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.example.acme.myproject;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class MyProjectApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MyProjectApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.example.demo;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
||||
|
||||
public class ServletInitializer extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(DemoApplication.class);
|
||||
}
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.18.RELEASE'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
apply plugin: 'org.springframework.boot'
|
||||
|
||||
group = 'com.example'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
sourceCompatibility = '1.8'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'org.springframework.boot:spring-boot-starter'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.5.18.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>demo</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>demo</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -1,11 +0,0 @@
|
||||
package com.example.demo
|
||||
|
||||
import org.springframework.boot.SpringApplication
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
|
||||
@SpringBootApplication
|
||||
class DemoApplication
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
SpringApplication.run(DemoApplication::class.java, *args)
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package com.example.acme.myproject
|
||||
|
||||
import org.springframework.boot.SpringApplication
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
|
||||
@SpringBootApplication
|
||||
class MyProjectApplication
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
SpringApplication.run(MyProjectApplication::class.java, *args)
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.example.demo
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder
|
||||
import org.springframework.boot.web.support.SpringBootServletInitializer
|
||||
|
||||
class ServletInitializer : SpringBootServletInitializer() {
|
||||
|
||||
override fun configure(application: SpringApplicationBuilder): SpringApplicationBuilder {
|
||||
return application.sources(DemoApplication::class.java)
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.18.RELEASE'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.1.1'
|
||||
id 'org.jetbrains.kotlin.plugin.spring' version '1.1.1'
|
||||
}
|
||||
|
||||
apply plugin: 'org.springframework.boot'
|
||||
|
||||
group = 'com.example'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
sourceCompatibility = '1.8'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'org.springframework.boot:spring-boot-starter'
|
||||
compile 'org.jetbrains.kotlin:kotlin-reflect'
|
||||
compile 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
tasks.withType(KotlinCompile) {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs = ['-Xjsr305=strict']
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.5.18.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>demo</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>demo</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<kotlin.version>1.1.1</kotlin.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-reflect</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<configuration>
|
||||
<args>
|
||||
<arg>-Xjsr305=strict</arg>
|
||||
</args>
|
||||
<compilerPlugins>
|
||||
<plugin>spring</plugin>
|
||||
</compilerPlugins>
|
||||
<jvmTarget>1.8</jvmTarget>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-compile</id>
|
||||
<phase>test-compile</phase>
|
||||
<goals>
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-allopen</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.spring.initializr.generator.buildsystem.gradle;
|
||||
|
||||
import io.spring.initializr.generator.buildsystem.Dependency;
|
||||
import io.spring.initializr.generator.buildsystem.DependencyScope;
|
||||
|
||||
/**
|
||||
* A {@link GroovyDslGradleBuildWriter} suitable for Gradle 3.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class Gradle3BuildWriter extends GroovyDslGradleBuildWriter {
|
||||
|
||||
@Override
|
||||
protected String configurationForDependency(Dependency dependency) {
|
||||
if (dependency instanceof GradleDependency) {
|
||||
String configuration = ((GradleDependency) dependency).getConfiguration();
|
||||
if (configuration != null) {
|
||||
return configuration;
|
||||
}
|
||||
}
|
||||
DependencyScope type = dependency.getScope();
|
||||
if (type == null) {
|
||||
return "compile";
|
||||
}
|
||||
switch (type) {
|
||||
case ANNOTATION_PROCESSOR:
|
||||
return "compileOnly";
|
||||
case COMPILE:
|
||||
return "compile";
|
||||
case COMPILE_ONLY:
|
||||
return "compileOnly";
|
||||
case PROVIDED_RUNTIME:
|
||||
return "providedRuntime";
|
||||
case RUNTIME:
|
||||
return "runtime";
|
||||
case TEST_COMPILE:
|
||||
return "testCompile";
|
||||
case TEST_RUNTIME:
|
||||
return "testRuntime";
|
||||
default:
|
||||
throw new IllegalStateException("Unrecognized dependency type '" + type + "'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,144 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.spring.initializr.generator.buildsystem.gradle;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.spring.initializr.generator.buildsystem.Dependency;
|
||||
import io.spring.initializr.generator.buildsystem.DependencyScope;
|
||||
import io.spring.initializr.generator.io.IndentingWriter;
|
||||
import io.spring.initializr.generator.version.VersionReference;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link Gradle3BuildWriter}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
class Gradle3BuildWriterTests {
|
||||
|
||||
@Test
|
||||
void gradleBuildWithAnnotationProcessorDependency() {
|
||||
GradleBuild build = new GradleBuild();
|
||||
build.dependencies().add("annotation-processor", "org.springframework.boot",
|
||||
"spring-boot-configuration-processor", DependencyScope.ANNOTATION_PROCESSOR);
|
||||
List<String> lines = generateBuild(build);
|
||||
assertThat(lines).containsSequence("dependencies {",
|
||||
" compileOnly 'org.springframework.boot:spring-boot-configuration-processor'", "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void gradleBuildWithCompileDependency() {
|
||||
GradleBuild build = new GradleBuild();
|
||||
build.dependencies().add("root", "org.springframework.boot", "spring-boot-starter", DependencyScope.COMPILE);
|
||||
List<String> lines = generateBuild(build);
|
||||
assertThat(lines).containsSequence("dependencies {",
|
||||
" compile 'org.springframework.boot:spring-boot-starter'", "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void gradleBuildWithNoScopeDependencyDefaultsToCompile() {
|
||||
GradleBuild build = new GradleBuild();
|
||||
build.dependencies().add("root", Dependency.withCoordinates("org.springframework.boot", "spring-boot-starter"));
|
||||
List<String> lines = generateBuild(build);
|
||||
assertThat(lines).containsSequence("dependencies {",
|
||||
" compile 'org.springframework.boot:spring-boot-starter'", "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void gradleBuildWithRuntimeDependency() {
|
||||
GradleBuild build = new GradleBuild();
|
||||
build.dependencies().add("driver", Dependency.withCoordinates("com.example", "jdbc-driver")
|
||||
.version(VersionReference.ofValue("1.0.0")).scope(DependencyScope.RUNTIME));
|
||||
List<String> lines = generateBuild(build);
|
||||
assertThat(lines).containsSequence("dependencies {", " runtime 'com.example:jdbc-driver:1.0.0'", "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void gradleBuildWithProvidedRuntimeDependency() {
|
||||
GradleBuild build = new GradleBuild();
|
||||
build.dependencies().add("tomcat", "org.springframework.boot", "spring-boot-starter-tomcat",
|
||||
DependencyScope.PROVIDED_RUNTIME);
|
||||
List<String> lines = generateBuild(build);
|
||||
assertThat(lines).containsSequence("dependencies {",
|
||||
" providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'", "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void gradleBuildWithTestCompileDependency() {
|
||||
GradleBuild build = new GradleBuild();
|
||||
build.dependencies().add("test", "org.springframework.boot", "spring-boot-starter-test",
|
||||
DependencyScope.TEST_COMPILE);
|
||||
List<String> lines = generateBuild(build);
|
||||
assertThat(lines).containsSequence("dependencies {",
|
||||
" testCompile 'org.springframework.boot:spring-boot-starter-test'", "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void gradleBuildWithCompileOnlyDependency() {
|
||||
GradleBuild build = new GradleBuild();
|
||||
build.dependencies().add("test", "org.springframework.boot", "spring-boot-starter-foobar",
|
||||
DependencyScope.COMPILE_ONLY);
|
||||
List<String> lines = generateBuild(build);
|
||||
assertThat(lines).containsSequence("dependencies {",
|
||||
" compileOnly 'org.springframework.boot:spring-boot-starter-foobar'", "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void gradleBuildWithTestRuntimeDependency() {
|
||||
GradleBuild build = new GradleBuild();
|
||||
build.dependencies().add("embed-mongo", "de.flapdoodle.embed", "de.flapdoodle.embed.mongo",
|
||||
DependencyScope.TEST_RUNTIME);
|
||||
List<String> lines = generateBuild(build);
|
||||
assertThat(lines).containsSequence("dependencies {",
|
||||
" testRuntime 'de.flapdoodle.embed:de.flapdoodle.embed.mongo'", "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void gradleBuildWithNonNullArtifactTypeDependency() {
|
||||
GradleBuild build = new GradleBuild();
|
||||
build.dependencies().add("root", Dependency.withCoordinates("org.springframework.boot", "spring-boot-starter")
|
||||
.scope(DependencyScope.COMPILE).type("tar.gz"));
|
||||
List<String> lines = generateBuild(build);
|
||||
assertThat(lines).containsSequence("dependencies {",
|
||||
" compile 'org.springframework.boot:spring-boot-starter@tar.gz'", "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void gradleBuildWithCustomDependencyConfiguration() {
|
||||
GradleBuild build = new GradleBuild();
|
||||
build.dependencies().add("test",
|
||||
GradleDependency.withCoordinates("org.springframework.boot", "spring-boot-starter-foobar")
|
||||
.scope(DependencyScope.RUNTIME).configuration("myRuntime"));
|
||||
List<String> lines = generateBuild(build);
|
||||
assertThat(lines).containsSequence("dependencies {",
|
||||
" myRuntime 'org.springframework.boot:spring-boot-starter-foobar'", "}");
|
||||
}
|
||||
|
||||
private List<String> generateBuild(GradleBuild build) {
|
||||
Gradle3BuildWriter writer = new Gradle3BuildWriter();
|
||||
StringWriter out = new StringWriter();
|
||||
writer.writeTo(new IndentingWriter(out), build);
|
||||
String[] lines = out.toString().split("\\r?\\n");
|
||||
return Arrays.asList(lines);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user