mirror of
https://gitee.com/dcren/initializr.git
synced 2025-07-17 10:41:57 +08:00
Simplify Gradle support
Remove support for Gradle 2 and simplify script generation by only supporting the recommended structure as of Gradle 3.4 Closes gh-778
This commit is contained in:
parent
9c5dfb34e9
commit
c96991382a
@ -74,8 +74,6 @@ public class ProjectGenerator {
|
|||||||
|
|
||||||
private static final Version VERSION_1_4_2_M1 = Version.parse("1.4.2.M1");
|
private static final Version VERSION_1_4_2_M1 = Version.parse("1.4.2.M1");
|
||||||
|
|
||||||
private static final Version VERSION_1_5_0_M1 = Version.parse("1.5.0.M1");
|
|
||||||
|
|
||||||
private static final Version VERSION_2_0_0_M1 = Version.parse("2.0.0.M1");
|
private static final Version VERSION_2_0_0_M1 = Version.parse("2.0.0.M1");
|
||||||
|
|
||||||
private static final Version VERSION_2_0_0_M3 = Version.parse("2.0.0.M3");
|
private static final Version VERSION_2_0_0_M3 = Version.parse("2.0.0.M3");
|
||||||
@ -483,17 +481,6 @@ public class ProjectGenerator {
|
|||||||
model.put("hasBoms", true);
|
model.put("hasBoms", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGradleBuild(request)) {
|
|
||||||
model.put("gradleCompileConfig",
|
|
||||||
bootTwoZeroAvailable ? "implementation" : "compile");
|
|
||||||
model.put("gradleRuntimeConfig",
|
|
||||||
bootTwoZeroAvailable ? "runtimeOnly" : "runtime");
|
|
||||||
model.put("gradleTestCompileConfig",
|
|
||||||
bootTwoZeroAvailable ? "testImplementation" : "testCompile");
|
|
||||||
model.put("gradleTestRuntimeConfig",
|
|
||||||
bootTwoZeroAvailable ? "testRuntimeOnly" : "testRuntime");
|
|
||||||
}
|
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,10 +598,6 @@ public class ProjectGenerator {
|
|||||||
.compareTo(Version.safeParse(request.getBootVersion())) <= 0;
|
.compareTo(Version.safeParse(request.getBootVersion())) <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isGradle3Available(Version bootVersion) {
|
|
||||||
return VERSION_1_5_0_M1.compareTo(bootVersion) <= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isGradle4Available(Version bootVersion) {
|
private static boolean isGradle4Available(Version bootVersion) {
|
||||||
return VERSION_2_0_0_M3.compareTo(bootVersion) < 0;
|
return VERSION_2_0_0_M3.compareTo(bootVersion) < 0;
|
||||||
}
|
}
|
||||||
@ -632,8 +615,7 @@ public class ProjectGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void writeGradleWrapper(File dir, Version bootVersion) {
|
private void writeGradleWrapper(File dir, Version bootVersion) {
|
||||||
String gradlePrefix = (isGradle4Available(bootVersion) ? "gradle4"
|
String gradlePrefix = (isGradle4Available(bootVersion)) ? "gradle4" : "gradle3";
|
||||||
: (isGradle3Available(bootVersion) ? "gradle3" : "gradle"));
|
|
||||||
writeTextResource(dir, "gradlew.bat", gradlePrefix + "/gradlew.bat");
|
writeTextResource(dir, "gradlew.bat", gradlePrefix + "/gradlew.bat");
|
||||||
writeTextResource(dir, "gradlew", gradlePrefix + "/gradlew");
|
writeTextResource(dir, "gradlew", gradlePrefix + "/gradlew");
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1,5 +0,0 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
|
|
@ -1,164 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
##
|
|
||||||
## 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
|
|
||||||
|
|
||||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
|
||||||
function splitJvmOpts() {
|
|
||||||
JVM_OPTS=("$@")
|
|
||||||
}
|
|
||||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
|
||||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
|
||||||
|
|
||||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
|
@ -1,90 +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
|
|
||||||
if "%@eval[2+2]" == "4" goto 4NT_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=%*
|
|
||||||
goto execute
|
|
||||||
|
|
||||||
:4NT_args
|
|
||||||
@rem Get arguments from the 4NT Shell from JP Software
|
|
||||||
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
|
|
@ -84,17 +84,17 @@ ext['{{key}}'] = '{{value}}'
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
{{#compileDependencies}}
|
{{#compileDependencies}}
|
||||||
{{gradleCompileConfig}}('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
|
implementation('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
|
||||||
{{/compileDependencies}}
|
{{/compileDependencies}}
|
||||||
{{#groovy}}
|
{{#groovy}}
|
||||||
{{gradleCompileConfig}}('org.codehaus.groovy:groovy')
|
implementation('org.codehaus.groovy:groovy')
|
||||||
{{/groovy}}
|
{{/groovy}}
|
||||||
{{#kotlin}}
|
{{#kotlin}}
|
||||||
{{gradleCompileConfig}}("org.jetbrains.kotlin:{{kotlinStdlibArtifactId}}{{^kotlinSupport}}:${kotlinVersion}{{/kotlinSupport}}")
|
implementation("org.jetbrains.kotlin:{{kotlinStdlibArtifactId}}{{^kotlinSupport}}:${kotlinVersion}{{/kotlinSupport}}")
|
||||||
{{gradleCompileConfig}}("org.jetbrains.kotlin:kotlin-reflect{{^kotlinSupport}}:${kotlinVersion}{{/kotlinSupport}}")
|
implementation("org.jetbrains.kotlin:kotlin-reflect{{^kotlinSupport}}:${kotlinVersion}{{/kotlinSupport}}")
|
||||||
{{/kotlin}}
|
{{/kotlin}}
|
||||||
{{#runtimeDependencies}}
|
{{#runtimeDependencies}}
|
||||||
{{gradleRuntimeConfig}}('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
|
runtimeOnly('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
|
||||||
{{/runtimeDependencies}}
|
{{/runtimeDependencies}}
|
||||||
{{#compileOnlyDependencies}}
|
{{#compileOnlyDependencies}}
|
||||||
compileOnly('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
|
compileOnly('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
|
||||||
@ -105,9 +105,9 @@ dependencies {
|
|||||||
{{#providedDependencies}}
|
{{#providedDependencies}}
|
||||||
providedRuntime('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
|
providedRuntime('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
|
||||||
{{/providedDependencies}}
|
{{/providedDependencies}}
|
||||||
{{gradleTestCompileConfig}}('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
{{#testDependencies}}
|
{{#testDependencies}}
|
||||||
{{gradleTestCompileConfig}}('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
|
testImplementation('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
|
||||||
{{/testDependencies}}
|
{{/testDependencies}}
|
||||||
}
|
}
|
||||||
{{#hasBoms}}
|
{{#hasBoms}}
|
||||||
|
@ -80,10 +80,10 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
|||||||
ProjectRequest request = createProjectRequest("web");
|
ProjectRequest request = createProjectRequest("web");
|
||||||
request.setType("gradle-build");
|
request.setType("gradle-build");
|
||||||
ProjectAssert gradleProject = generateProject(request).isGradleProject();
|
ProjectAssert gradleProject = generateProject(request).isGradleProject();
|
||||||
gradleProject.gradleBuildAssert()
|
gradleProject.gradleBuildAssert().contains(
|
||||||
.contains("compile('org.springframework.boot:spring-boot-starter-web')")
|
"implementation('org.springframework.boot:spring-boot-starter-web')")
|
||||||
.contains(
|
.contains(
|
||||||
"testCompile('org.springframework.boot:spring-boot-starter-test')");
|
"testImplementation('org.springframework.boot:spring-boot-starter-test')");
|
||||||
gradleProject.gradleSettingsAssert().hasProjectName("demo");
|
gradleProject.gradleSettingsAssert().hasProjectName("demo");
|
||||||
verifyProjectSuccessfulEventFor(request);
|
verifyProjectSuccessfulEventFor(request);
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
|||||||
|
|
||||||
ProjectRequest request = createProjectRequest("custom-artifact");
|
ProjectRequest request = createProjectRequest("custom-artifact");
|
||||||
generateGradleBuild(request)
|
generateGradleBuild(request)
|
||||||
.contains("compile('org.foo:custom-artifact@tar.gz')");
|
.contains("implementation('org.foo:custom-artifact@tar.gz')");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -216,11 +216,12 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
|||||||
request.setType("gradle-project");
|
request.setType("gradle-project");
|
||||||
generateProject(request).isJavaWarProject().isGradleProject().gradleBuildAssert()
|
generateProject(request).isJavaWarProject().isGradleProject().gradleBuildAssert()
|
||||||
// This is tagged as web facet so it brings the web one
|
// This is tagged as web facet so it brings the web one
|
||||||
.contains("apply plugin: 'war'").contains("compile('org.foo:thymeleaf')")
|
.contains("apply plugin: 'war'")
|
||||||
|
.contains("implementation('org.foo:thymeleaf')")
|
||||||
.doesNotContain(
|
.doesNotContain(
|
||||||
"compile('org.springframework.boot:spring-boot-starter-web')")
|
"implementation('org.springframework.boot:spring-boot-starter-web')")
|
||||||
.contains(
|
.contains(
|
||||||
"testCompile('org.springframework.boot:spring-boot-starter-test')")
|
"testImplementation('org.springframework.boot:spring-boot-starter-test')")
|
||||||
.contains("configurations {") // declare providedRuntime config
|
.contains("configurations {") // declare providedRuntime config
|
||||||
.contains("providedRuntime").contains(
|
.contains("providedRuntime").contains(
|
||||||
"providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')");
|
"providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')");
|
||||||
@ -231,11 +232,12 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
|||||||
ProjectRequest request = createProjectRequest("data-jpa");
|
ProjectRequest request = createProjectRequest("data-jpa");
|
||||||
request.setPackaging("war");
|
request.setPackaging("war");
|
||||||
generateGradleBuild(request).contains(
|
generateGradleBuild(request).contains(
|
||||||
"compile('org.springframework.boot:spring-boot-starter-data-jpa')")
|
"implementation('org.springframework.boot:spring-boot-starter-data-jpa')")
|
||||||
// Added by warpackaging
|
// Added by warpackaging
|
||||||
.contains("compile('org.springframework.boot:spring-boot-starter-web')")
|
|
||||||
.contains(
|
.contains(
|
||||||
"testCompile('org.springframework.boot:spring-boot-starter-test')")
|
"implementation('org.springframework.boot:spring-boot-starter-web')")
|
||||||
|
.contains(
|
||||||
|
"testImplementation('org.springframework.boot:spring-boot-starter-test')")
|
||||||
.contains("configurations {") // declare providedRuntime config
|
.contains("configurations {") // declare providedRuntime config
|
||||||
.contains("providedRuntime").contains(
|
.contains("providedRuntime").contains(
|
||||||
"providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')");
|
"providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')");
|
||||||
@ -382,13 +384,6 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
|||||||
"@EnableAutoConfiguration", "@Configuration", "@ComponentScan");
|
"@EnableAutoConfiguration", "@Configuration", "@ComponentScan");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void springBootUseGradle2() {
|
|
||||||
ProjectRequest request = createProjectRequest("web");
|
|
||||||
request.setType("gradle-project");
|
|
||||||
generateProject(request).isGradleProject("2.13");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void springBoot15UseGradle3() {
|
public void springBoot15UseGradle3() {
|
||||||
ProjectRequest request = createProjectRequest("web");
|
ProjectRequest request = createProjectRequest("web");
|
||||||
@ -529,11 +524,11 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
|||||||
.addDependencyGroup("foo", whatever).build();
|
.addDependencyGroup("foo", whatever).build();
|
||||||
applyMetadata(metadata);
|
applyMetadata(metadata);
|
||||||
ProjectRequest request = createProjectRequest("whatever", "data-jpa", "web");
|
ProjectRequest request = createProjectRequest("whatever", "data-jpa", "web");
|
||||||
generateGradleBuild(request)
|
generateGradleBuild(request).contains(
|
||||||
.contains("compile('org.springframework.boot:spring-boot-starter-web')")
|
"implementation('org.springframework.boot:spring-boot-starter-web')")
|
||||||
.contains(
|
.contains(
|
||||||
"compile('org.springframework.boot:spring-boot-starter-data-jpa')")
|
"implementation('org.springframework.boot:spring-boot-starter-data-jpa')")
|
||||||
.contains("compile('org.acme:whatever:1.2.3')");
|
.contains("implementation('org.acme:whatever:1.2.3')");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -575,15 +570,15 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
|||||||
applyMetadata(metadata);
|
applyMetadata(metadata);
|
||||||
ProjectRequest request = createProjectRequest("hamcrest", "h2", "servlet-api",
|
ProjectRequest request = createProjectRequest("hamcrest", "h2", "servlet-api",
|
||||||
"data-jpa", "web");
|
"data-jpa", "web");
|
||||||
generateGradleBuild(request)
|
generateGradleBuild(request).contains(
|
||||||
.contains("compile('org.springframework.boot:spring-boot-starter-web')")
|
"implementation('org.springframework.boot:spring-boot-starter-web')")
|
||||||
.contains(
|
.contains(
|
||||||
"compile('org.springframework.boot:spring-boot-starter-data-jpa')")
|
"implementation('org.springframework.boot:spring-boot-starter-data-jpa')")
|
||||||
// declare providedRuntime config
|
// declare providedRuntime config
|
||||||
.contains("runtime('org.h2:h2')").contains("configurations {")
|
.contains("runtimeOnly('org.h2:h2')").contains("configurations {")
|
||||||
.contains("providedRuntime")
|
.contains("providedRuntime")
|
||||||
.contains("providedRuntime('javax.servlet:servlet-api')")
|
.contains("providedRuntime('javax.servlet:servlet-api')")
|
||||||
.contains("testCompile('org.hamcrest:hamcrest')");
|
.contains("testImplementation('org.hamcrest:hamcrest')");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -599,9 +594,10 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
|||||||
"classpath('io.spring.gradle:dependency-management-plugin:0.5.9.RELEASE')")
|
"classpath('io.spring.gradle:dependency-management-plugin:0.5.9.RELEASE')")
|
||||||
.contains("apply plugin: 'spring-boot'")
|
.contains("apply plugin: 'spring-boot'")
|
||||||
.contains("apply plugin: 'io.spring.dependency-management'")
|
.contains("apply plugin: 'io.spring.dependency-management'")
|
||||||
.contains("compile('org.springframework.boot:spring-boot-starter-web')")
|
|
||||||
.contains(
|
.contains(
|
||||||
"testCompile('org.springframework.boot:spring-boot-starter-test')");
|
"implementation('org.springframework.boot:spring-boot-starter-web')")
|
||||||
|
.contains(
|
||||||
|
"testImplementation('org.springframework.boot:spring-boot-starter-test')");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -615,9 +611,10 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
|||||||
generateGradleBuild(request)
|
generateGradleBuild(request)
|
||||||
.contains("springBootVersion = '1.3.0.BUILD-SNAPSHOT'")
|
.contains("springBootVersion = '1.3.0.BUILD-SNAPSHOT'")
|
||||||
.contains("apply plugin: 'spring-boot'")
|
.contains("apply plugin: 'spring-boot'")
|
||||||
.contains("compile('org.springframework.boot:spring-boot-starter-web')")
|
|
||||||
.contains(
|
.contains(
|
||||||
"testCompile('org.springframework.boot:spring-boot-starter-test')")
|
"implementation('org.springframework.boot:spring-boot-starter-web')")
|
||||||
|
.contains(
|
||||||
|
"testImplementation('org.springframework.boot:spring-boot-starter-test')")
|
||||||
.doesNotContain(
|
.doesNotContain(
|
||||||
"classpath('io.spring.gradle:dependency-management-plugin:0.5.9.RELEASE')")
|
"classpath('io.spring.gradle:dependency-management-plugin:0.5.9.RELEASE')")
|
||||||
.doesNotContain("apply plugin: 'io.spring.dependency-management'");
|
.doesNotContain("apply plugin: 'io.spring.dependency-management'");
|
||||||
@ -630,9 +627,10 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
|||||||
generateGradleBuild(request)
|
generateGradleBuild(request)
|
||||||
.contains("springBootVersion = '1.4.2.BUILD-SNAPSHOT'")
|
.contains("springBootVersion = '1.4.2.BUILD-SNAPSHOT'")
|
||||||
.contains("apply plugin: 'org.springframework.boot'")
|
.contains("apply plugin: 'org.springframework.boot'")
|
||||||
.contains("compile('org.springframework.boot:spring-boot-starter-web')")
|
|
||||||
.contains(
|
.contains(
|
||||||
"testCompile('org.springframework.boot:spring-boot-starter-test')")
|
"implementation('org.springframework.boot:spring-boot-starter-web')")
|
||||||
|
.contains(
|
||||||
|
"testImplementation('org.springframework.boot:spring-boot-starter-test')")
|
||||||
.doesNotContain("apply plugin: 'spring-boot'");
|
.doesNotContain("apply plugin: 'spring-boot'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -899,9 +897,10 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
|||||||
applyMetadata(metadata);
|
applyMetadata(metadata);
|
||||||
ProjectRequest request = createProjectRequest("one", "web", "two", "data-jpa");
|
ProjectRequest request = createProjectRequest("one", "web", "two", "data-jpa");
|
||||||
assertThat(generateGradleBuild(request).getGradleBuild()).containsSubsequence(
|
assertThat(generateGradleBuild(request).getGradleBuild()).containsSubsequence(
|
||||||
"compile('org.springframework.boot:spring-boot-starter-data-jpa')",
|
"implementation('org.springframework.boot:spring-boot-starter-data-jpa')",
|
||||||
"compile('org.springframework.boot:spring-boot-starter-web')",
|
"implementation('org.springframework.boot:spring-boot-starter-web')",
|
||||||
"compile('com.example:second:1.2.3')", "compile('org.acme:first:1.2.3')");
|
"implementation('com.example:second:1.2.3')",
|
||||||
|
"implementation('org.acme:first:1.2.3')");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -26,8 +26,8 @@ repositories {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.springframework.boot:spring-boot-starter-data-jpa')
|
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
|
||||||
compile('org.springframework.boot:spring-boot-starter-web')
|
implementation('org.springframework.boot:spring-boot-starter-web')
|
||||||
annotationProcessor('org.springframework.boot:spring-boot-configuration-processor')
|
annotationProcessor('org.springframework.boot:spring-boot-configuration-processor')
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,8 @@ repositories {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.acme:foo')
|
implementation('org.acme:foo')
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyManagement {
|
dependencyManagement {
|
||||||
|
@ -27,8 +27,8 @@ repositories {
|
|||||||
ext['fooVersion'] = '1.3.3'
|
ext['fooVersion'] = '1.3.3'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.acme:foo')
|
implementation('org.acme:foo')
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyManagement {
|
dependencyManagement {
|
||||||
|
@ -26,8 +26,8 @@ repositories {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.springframework.boot:spring-boot-starter-data-jpa')
|
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
|
||||||
compile('org.springframework.boot:spring-boot-starter-web')
|
implementation('org.springframework.boot:spring-boot-starter-web')
|
||||||
compileOnly('org.acme:foo')
|
compileOnly('org.acme:foo')
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ repositories {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.springframework.boot:spring-boot-starter')
|
implementation('org.springframework.boot:spring-boot-starter')
|
||||||
compile("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
|
implementation("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
|
||||||
compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
|
implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ repositories {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.springframework.boot:spring-boot-starter')
|
implementation('org.springframework.boot:spring-boot-starter')
|
||||||
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlinVersion}")
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlinVersion}")
|
||||||
compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
|
implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,6 @@ ext['springBarVersion'] = '0.2.0.RELEASE'
|
|||||||
ext['spring-foo.version'] = '0.1.0.RELEASE'
|
ext['spring-foo.version'] = '0.1.0.RELEASE'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.springframework.boot:spring-boot-starter-web')
|
implementation('org.springframework.boot:spring-boot-starter-web')
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ repositories {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.springframework.boot:spring-boot-starter')
|
implementation('org.springframework.boot:spring-boot-starter')
|
||||||
compile('org.codehaus.groovy:groovy')
|
implementation('org.codehaus.groovy:groovy')
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.springframework.boot:spring-boot-starter-web')
|
implementation('org.springframework.boot:spring-boot-starter-web')
|
||||||
compile('org.codehaus.groovy:groovy')
|
implementation('org.codehaus.groovy:groovy')
|
||||||
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
|
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,6 @@ repositories {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.springframework.boot:spring-boot-starter')
|
implementation('org.springframework.boot:spring-boot-starter')
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.springframework.boot:spring-boot-starter-web')
|
implementation('org.springframework.boot:spring-boot-starter-web')
|
||||||
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
|
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@ repositories {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.springframework.boot:spring-boot-starter')
|
implementation('org.springframework.boot:spring-boot-starter')
|
||||||
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
|
||||||
compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
|
implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
@ -46,9 +46,9 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('org.springframework.boot:spring-boot-starter-web')
|
implementation('org.springframework.boot:spring-boot-starter-web')
|
||||||
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
|
||||||
compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
|
implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
|
||||||
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
|
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
|
||||||
testCompile('org.springframework.boot:spring-boot-starter-test')
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
||||||
}
|
}
|
||||||
|
@ -95,9 +95,10 @@ public class ProjectGenerationSmokeTests
|
|||||||
page.type("gradle-project");
|
page.type("gradle-project");
|
||||||
page.submit();
|
page.submit();
|
||||||
assertSimpleProject().isGradleProject().gradleBuildAssert()
|
assertSimpleProject().isGradleProject().gradleBuildAssert()
|
||||||
.contains("compile('org.springframework.boot:spring-boot-starter')")
|
|
||||||
.contains(
|
.contains(
|
||||||
"testCompile('org.springframework.boot:spring-boot-starter-test')");
|
"implementation('org.springframework.boot:spring-boot-starter')")
|
||||||
|
.contains(
|
||||||
|
"testImplementation('org.springframework.boot:spring-boot-starter-test')");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user