Upgrade Eclipse project settings for Java 8

- Set the eclipse.jdt source and target compatibility to 1.8 in
   ide.gradle.

 - Updated the instructions in import-into-eclipse.sh to reflect minimum
   requirements for building Spring Framework 4.1 against Java 8 with
   Eclipse and STS

Issue: SPR-11831
This commit is contained in:
Sam Brannen 2014-05-29 17:26:25 +02:00
parent 12a9df8a1c
commit d46b29e71f
2 changed files with 30 additions and 27 deletions

View File

@ -5,13 +5,13 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
apply plugin: "propdeps-eclipse" apply plugin: "propdeps-eclipse"
apply plugin: "propdeps-idea" apply plugin: "propdeps-idea"
// Until eclipse fully supports Java 8 use 1.7 source level
eclipse.jdt { eclipse.jdt {
sourceCompatibility = 1.7 sourceCompatibility = 1.8
targetCompatibility = 1.7 targetCompatibility = 1.8
} }
// Replace classpath entries with project dependencies (GRADLE-1116) // Replace classpath entries with project dependencies (GRADLE-1116)
// http://issues.gradle.org/browse/GRADLE-1116
eclipse.classpath.file.whenMerged { classpath -> eclipse.classpath.file.whenMerged { classpath ->
def regexp = /.*?\/([^\/]+)\/build\/[^\/]+\/(?:main|test)/ // only match those that end in main or test (avoids removing necessary entries like build/classes/jaxb) def regexp = /.*?\/([^\/]+)\/build\/[^\/]+\/(?:main|test)/ // only match those that end in main or test (avoids removing necessary entries like build/classes/jaxb)
def projectOutputDependencies = classpath.entries.findAll { entry -> entry.path =~ regexp } def projectOutputDependencies = classpath.entries.findAll { entry -> entry.path =~ regexp }

View File

@ -1,22 +1,25 @@
STS_TEST_VERSION='2.9.2.RELEASE'
cd `dirname $0` cd `dirname $0`
clear clear
cat <<EOM cat <<EOM
----------------------------------------------------------------------- ------------------------------------------------------------------------
Spring Framework Eclipse/STS project import guide Spring Framework Eclipse/STS project import guide
This script will guide you through the process of importing the This script will guide you through the process of importing the Spring
Spring Framework sources into Eclipse/STS. It is recommended that you Framework projects into Eclipse or the Spring Tool Suite (STS). It is
have a recent version of the SpringSource Tool Suite (this script has recommended that you have a recent version of Eclipse or STS with full
been tested against STS $STS_TEST_VERSION), but at the minimum you will support for Java 8 (this script has been tested against Eclipse Luna
need Eclipse + AJDT. 4.4 integration build I20140520-2000), but as a bare minimum you will
need Eclipse with Java 8 support, AJDT, and the Groovy Compiler.
If you need to download and install STS, please do that now by If you need to download and install Eclipse or STS, please do that now
visiting http://spring.io/tools/sts/all by visiting one of the following sites:
Otherwise, press enter and we'll begin. Eclipse downloads: http://download.eclipse.org/eclipse/downloads/
STS downloads: http://spring.io/tools/sts/all
STS nightly builds: http://dist.springsource.com/snapshot/STS/nightly-distributions.html
Otherwise, press enter, and we'll begin.
EOM EOM
read read
@ -31,14 +34,14 @@ COMMAND="./gradlew cleanEclipse :spring-oxm:compileTestJava eclipse -x :eclipse"
cat <<EOM cat <<EOM
----------------------------------------------------------------------- ------------------------------------------------------------------------
STEP 1: Generate subproject Eclipse metadata STEP 1: Generate subproject Eclipse metadata
The first step will be to generate Eclipse project metadata for each The first step will be to generate Eclipse project metadata for each of
of the spring-* subprojects. This happens via the built-in the spring-* subprojects. This happens via the built-in "Gradle
"Gradle wrapper" script (./gradlew in this directory). If this is your wrapper" script (./gradlew in this directory). If this is your first
first time using the Gradle wrapper, this step may take a few minutes time using the Gradle wrapper, this step may take a few minutes while a
while a Gradle distribution is downloaded for you. Gradle distribution is downloaded for you.
The command run will be: The command run will be:
@ -53,7 +56,7 @@ $COMMAND || exit
cat <<EOM cat <<EOM
----------------------------------------------------------------------- ------------------------------------------------------------------------
STEP 2: Import subprojects into Eclipse/STS STEP 2: Import subprojects into Eclipse/STS
Within Eclipse/STS, do the following: Within Eclipse/STS, do the following:
@ -73,13 +76,13 @@ COMMAND="./gradlew :eclipse"
cat <<EOM cat <<EOM
----------------------------------------------------------------------- ------------------------------------------------------------------------
STEP 3: generate root project Eclipse metadata STEP 3: generate root project Eclipse metadata
Unfortunately, Eclipse does not allow for importing project Unfortunately, Eclipse does not allow for importing project
hierarchies, so we had to skip root project metadata generation in the hierarchies, so we had to skip root project metadata generation during
during step 1. In this step we simply generate root project metadata step 1. In this step we simply generate root project metadata so you
so you can import it in the next step. can import it in the next step.
The command run will be: The command run will be:
@ -93,7 +96,7 @@ read
$COMMAND || exit $COMMAND || exit
cat <<EOM cat <<EOM
----------------------------------------------------------------------- ------------------------------------------------------------------------
STEP 4: Import root project into Eclipse/STS STEP 4: Import root project into Eclipse/STS
Follow the project import steps listed in step 2 above to import the Follow the project import steps listed in step 2 above to import the
@ -105,7 +108,7 @@ EOM
read read
cat <<EOM cat <<EOM
----------------------------------------------------------------------- ------------------------------------------------------------------------
STEP 5: Enable Git support for all projects STEP 5: Enable Git support for all projects
- In the Eclipse/STS Package Explorer, select all spring* projects. - In the Eclipse/STS Package Explorer, select all spring* projects.