Browse Source

Add instructions for importing into Eclipse using Buildship

pull/1688/merge
Dave Syer 7 years ago committed by Rossen Stoyanchev
parent
commit
39af1b2281
  1. 122
      import-into-eclipse.bat
  2. 28
      import-into-eclipse.md
  3. 129
      import-into-eclipse.sh

122
import-into-eclipse.bat

@ -1,122 +0,0 @@
@echo off
set CURRENT_DIR=%~dp0
cd %CURRENT_DIR%
cls
echo.
echo -----------------------------------------------------------------------
echo Spring Framework - Eclipse/STS project import guide
echo.
echo This script will guide you through the process of importing the Spring
echo Framework projects into Eclipse or the Spring Tool Suite (STS). It is
echo recommended that you have a recent version of Eclipse or STS. As a bare
echo minimum you will need Eclipse with full Java 8 support, the AspectJ
echo Development Tools (AJDT), and the Groovy Compiler.
echo.
echo If you need to download and install Eclipse or STS, please do that now
echo by visiting one of the following sites:
echo.
echo - Eclipse downloads: http://download.eclipse.org/eclipse/downloads
echo - STS downloads: http://spring.io/tools/sts/all
echo - STS nightly builds: http://dist.springsource.com/snapshot/STS/nightly-distributions.html
echo - ADJT: http://www.eclipse.org/ajdt/downloads/
echo - Groovy Eclipse: https://github.com/groovy/groovy-eclipse/wiki
echo.
echo Otherwise, press enter and we'll begin.
pause
REM this command:
REM - wipes out any existing Eclipse metadata
REM - generates OXM test classes to avoid errors on import into Eclipse
REM - generates metadata for all subprojects
REM - skips metadata gen for the root project (-x :eclipse) to work
REM around Eclipse's inability to import hierarchical project structures
REM SET COMMAND="./gradlew --no-daemon cleanEclipse :spring-oxm:compileTestJava eclipse -x :eclipse"
SET COMMAND=gradlew --no-daemon cleanEclipse :spring-oxm:compileTestJava eclipse -x :eclipse
echo.
echo -----------------------------------------------------------------------
echo STEP 1: Generate subproject Eclipse metadata
echo.
echo The first step will be to generate Eclipse project metadata for each
echo of the spring-* subprojects. This happens via the built-in
echo "Gradle wrapper" script (./gradlew in this directory). If this is your
echo first time using the Gradle wrapper, this step may take a few minutes
echo while a Gradle distribution is downloaded for you.
echo.
echo The command run will be:
echo.
echo %COMMAND%
echo.
echo Press enter when ready.
pause
call %COMMAND%
if not "%ERRORLEVEL%" == "0" exit /B %ERRORLEVEL%
echo.
echo -----------------------------------------------------------------------
echo STEP 2: Import subprojects into Eclipse/STS
echo.
echo Within Eclipse/STS, do the following:
echo.
echo File ^> Import... ^> Existing Projects into Workspace
echo ^> When prompted for the 'root directory', provide %CURRENT_DIR%
echo ^> Press enter. You will see the modules show up under "Projects"
echo ^> All projects should be selected/checked. Click Finish.
echo ^> When the project import is complete, you should have no errors.
echo.
echo When the above is complete, return here and press the enter key.
pause
set COMMAND=gradlew --no-daemon :eclipse
echo.
echo -----------------------------------------------------------------------
echo STEP 3: generate root project Eclipse metadata
echo.
echo Unfortunately, Eclipse does not allow for importing project
echo hierarchies, so we had to skip root project metadata generation in the
echo during step 1. In this step we simply generate root project metadata
echo so you can import it in the next step.
echo.
echo The command run will be:
echo.
echo %COMMAND%
echo.
echo Press the enter key when ready.
pause
call %COMMAND%
if not "%ERRORLEVEL%" == "0" exit /B %ERRORLEVEL%
echo.
echo -----------------------------------------------------------------------
echo STEP 4: Import root project into Eclipse/STS
echo.
echo Follow the project import steps listed in step 2 above to import the
echo root project.
echo.
echo Press enter when complete, and move on to the final step.
pause
echo.
echo -----------------------------------------------------------------------
echo STEP 5: Enable Git support for all projects
echo.
echo - In the Eclipse/STS Package Explorer, select all spring* projects.
echo - Right-click to open the context menu and select Team ^> Share Project...
echo - In the Share Project dialog that appears, select Git and press Next
echo - Check "Use or create repository in parent folder of project"
echo - Click Finish
echo.
echo When complete, you'll have Git support enabled for all projects.
echo.
echo You're ready to code! Goodbye!

28
import-into-eclipse.md

@ -0,0 +1,28 @@
The following has been tested against STS 4.0.0.M11, which ships with Buildship (the Gradle tooling from Gradleware). It should work with the latest Eclipse distro as long as you install Buildship.
## Steps
_Within your locally cloned spring-framework working directory:_
1. Precompile `spring-oxm` with `./gradlew :spring-oxm:compileTestJava`
2. Import into Eclipse (File -> Import -> Gradle -> Existing Gradle Project -> Navigate to directory -> Select Finish)
3. If prompted, exclude the `spring-aspects` module (or after the import by deleting the project)
4. In the `spring-oxm` project, add the two folders (`castor` and `jaxb`) in `build/generated-sources` to the build path (right click on them and select `Build Path -> Use as Source Folder`)
5. If your workspace default JDK is Java 8, add a Java 9 (or 10) JDK, and update the build path in `spring-beans` and `spring-core` to use it instead of the default
6. Code away
## Known issues
1. `spring-core` and `spring-oxm` should be pre-compiled due to repackaged dependencies.
See `*RepackJar` tasks in the build).
2. `spring-aspects` does not compile due to references to aspect types unknown to
Eclipse. If you install AJDT into Eclipse it should work.
3. While JUnit tests pass from the command line with Gradle, some may fail when run from
the IDE. Resolving this is a work in progress. If attempting to run all JUnit tests from within
the IDE, you will likely need to set the following VM options to avoid out of memory errors:
-XX:MaxPermSize=2048m -Xmx2048m -XX:MaxHeapSize=2048m
## Tips
In any case, please do not check in your own generated .classpath, .project or .settings.
You'll notice these files are already intentionally in .gitignore. The same policy goes for IDEA metadata.

129
import-into-eclipse.sh

@ -1,129 +0,0 @@
cd `dirname $0`
clear
cat <<EOM
------------------------------------------------------------------------
Spring Framework - Eclipse/STS Project Import Guide
This script will guide you through the process of importing the Spring
Framework projects into Eclipse or the Spring Tool Suite (STS). It is
recommended that you have a recent version of Eclipse or STS. As a bare
minimum you will need Eclipse with full Java 8 support, the AspectJ
Development Tools (AJDT), and the Groovy Compiler.
This script has been tested against:
- STS: 3.8.3.RELEASE (Eclipse Neon.2 4.6.2)
- AJDT: 2.2.4.201612122115 (Eclipse Neon 4.6)
If you need to download and install Eclipse or STS, please do that now
by visiting one of the following sites:
- 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
- ADJT: http://www.eclipse.org/ajdt/downloads/
- Groovy Eclipse: https://github.com/groovy/groovy-eclipse/wiki
Once Eclipse/STS is installed, press enter, and we'll begin.
EOM
read
# this command:
# - wipes out any existing Eclipse metadata
# - generates OXM test classes to avoid errors on import into Eclipse
# - generates metadata for all subprojects
# - skips metadata gen for the root project (-x :eclipse) to work
# around Eclipse's inability to import hierarchical project structures
COMMAND="./gradlew --no-daemon cleanEclipse :spring-oxm:compileTestJava eclipse -x :eclipse"
cat <<EOM
------------------------------------------------------------------------
STEP 1: Generate subproject Eclipse metadata
The first step will be to generate Eclipse project metadata for each of
the spring-* subprojects. This happens via the built-in "Gradle wrapper"
script (./gradlew in this directory). If this is your first time using
the Gradle wrapper, this step may take a few minutes while a Gradle
distribution is downloaded for you.
The command run will be:
$COMMAND
Press enter when ready.
EOM
read
$COMMAND || exit
cat <<EOM
------------------------------------------------------------------------
STEP 2: Import subprojects into Eclipse/STS
Within Eclipse/STS, do the following:
- File > Import... > Existing Projects into Workspace
- When prompted for the 'root directory', provide $PWD.
- Press enter. You will see the modules show up under "Projects".
- All projects should be selected/checked. Click Finish.
- When the project import is complete, you should have no errors.
When the above is complete, return here and press the enter key.
EOM
read
COMMAND="./gradlew --no-daemon :eclipse"
cat <<EOM
------------------------------------------------------------------------
STEP 3: Generate root project Eclipse metadata
Unfortunately, Eclipse does not support importing project hierarchies,
so we had to skip root project metadata generation during step 1. In
this step we simply generate root project metadata so that you can
import it in the next step.
The command run will be:
$COMMAND
Press the enter key when ready.
EOM
read
$COMMAND || exit
cat <<EOM
------------------------------------------------------------------------
STEP 4: Import root project into Eclipse/STS
Follow the project import steps listed in step 2 above to import the
root "spring" project.
Press enter when complete, and move on to the final step.
EOM
read
cat <<EOM
------------------------------------------------------------------------
STEP 5: Enable Git support for all projects
- In the Eclipse/STS Package Explorer, select all spring* projects.
- Right-click to open the context menu and select Team > Share Project...
- In the Share Project dialog that appears, select Git and press Next.
- Check "Use or create repository in parent folder of project".
- Click Finish.
When complete, you'll have Git support enabled for all projects.
You're ready to code! Goodbye!
EOM
Loading…
Cancel
Save