
A P P E N D I X A ■ ■ ■ SpringSource Tool Suite The chapters in this book gave specific instructions on using STS when creating projects and implementing the sample code within each chapter. If you have gone through all the samples, you will already have a fair understanding of STS. The objective of this appendix is to describe other basic topics when using STS that were not covered in the regular chapters. This appendix is intended for developers who are not familiar with STS. However, basic knowledge of using Eclipse for Java application development is assumed. If you already are an Eclipse power user or are familiar with STS (or the Spring IDE), feel free to skip this appendix and use it for reference only when required. In this appendix, we will discuss some basic topics related to STS. Specifically, the following topics will be covered: • Installation: We will discuss how to install STS. Although STS also supports Mac OS X and Linux, we will focus on installing and using STS on the Windows platform. • Project setup and dependency management: We will discuss how to create Spring projects in STS and manage the required dependencies within the project. We will focus on the Maven dependency management with the m2e plug-in (the official Maven plug-in for Eclipse IDE). • Using STS: We will discuss installing extensions, managing tc Server, and so on. Introducing STS STS is the IDE tool offered by SpringSource for Spring application developers. It includes a number of plug-ins, which provide support for developing Spring-based applications, as well as integrates with other Eclipse plug-ins (such as m2e, AspectJ Development Tool, and so on). Some major features are highlighted here: • It supports the creation and editing of Spring’s ApplicationContext configuration XML files with code assistance and validation. • It provides graphical views of Spring configuration such as the bean graph, Web Flow diagram, Spring Batch and Integration diagrams, and so on. • It supports the installation of extensions for other features (for example, for the development of Groovy classes and scripts, Grails, and so on). • It supports the management of tc Server Developer Edition for local web application development and testing. 869 APPENDIX A ■ SPRINGSOURCE TOOL SUITE STS Installation STS can be installed in two ways. First, SpringSource has prepared a bundled version with Eclipse and the required plug-ins. Second, if you already have an Eclipse development environment, you can simply extend it with the plug-ins provided by STS. Either way, make sure you already have a JDK (version 6 or newer) installed in your PC. Installing the Stand-Alone Version of STS The simplest way to install STS is to download the bundle from the STS web site that has Eclipse bundled with it. So, you need to download the proper version for your development machine from the tools web site (www.springsource.org/downloads/sts). Figure A-1 shows the download site, with the versions available for the Windows platform (note that versions are also available for Mac OS X and Linux). Figure A-1. Downloading STS stand-alone version Select the correct version for your computer. For Windows, versions for both 32- and 64-bit Windows are available. In addition, there are two forms of distribution. One is in Windows installer format that you can simply click to install, and the other is a zip file that you can extract and use to set up STS yourself. We will use the 64-bit Windows installer for our demonstration (the latest stable version at the time of writing is 2.8.1). It’s very straightforward. Upon completing the download, click the executable file to start the installation. There are several steps for the installation; Figure A-2 shows step 1. 870 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-2. STS installation: step 1 Click the Next button and proceed to step 2, as shown in Figure A-3. 871 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-3. STS installation: step 2 Accept the license agreement and click the Next button to proceed to the next step, as indicated in Figure A-4. 872 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-4. STS installation: step 3 Select the folder in which you want to install STS. Then, click Next to proceed to the next step, as shown in Figure A-5. 873 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-5. STS installation: step 4 Step 4 will display the available optional items for your selection. Options include the tc Server Developer Edition, Spring Roo, and Apache Maven stand-alone version (based on version 3). Make sure all the options are selected, and then click Next to proceed to the next step, as shown in Figure A-6. 874 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-6. STS installation: step 5 Select the JDK installation folder on your computer, and then click the Next button to proceed to the next step, as shown in Figure A-7. 875 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-7. STS installation: step 6 Wait until the installation is complete, and then choose whether to create a shortcut for STS, as shown in Figure A-8. 876 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-8. STS installation: step 7 Click Next to complete the installation, as shown in Figure A-9. 877 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-9. STS installation: step 8 At this point, the installation of the stand-alone version of STS is complete. Click Finish. Installing STS to an Existing Eclipse Environment Another way to set up STS is to extend an existing Eclipse installation. In the following example, we will demonstrate installing STS onto an existing Eclipse (version 3.7.1) setup. Eclipse comes in various bundles. For this example, the Eclipse IDE for Java EE Developers version is used (please refer to the web site www.eclipse.org/downloads for the list of available bundles). Before we can install STS, we need to install some Eclipse plug-ins required by STS. To install the Maven plug-in for Eclipse, choose the menu item Help ➤ Install New Software in Eclipse. Click the Add button, enter the name (m2e) and the update site URL http://download.eclipse.org/technology/m2e/releases, and click OK button. Then, choose the component to install, as shown in Figure A-10. 878 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-10. Installing the Maven plug-in for Eclipse The next plug-in we need to install is the Jetty runtime environment, which includes an update to the JSP plug-in that is required by STS. In the Install dialog, click the Add button to open the Add Repository dialog, and enter the name (Jetty Runtime) and the URL http://download.eclipse.org/jetty/updates/3.7 for the update site information. After the repository is added, the available components will be displayed in the Install dialog. Choose the components to install, and click the Next button to continue the installation, as shown in Figure A-11. 879 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-11. Installing Jetty runtime for Eclipse After that is complete, we can proceed to install the STS plug-ins. Prepare a file called bookmarks.xml with the content, as shown in Listing A-1. Listing A-1. The bookmarks.xml File for STS <?xml version="1.0" encoding="UTF-8"?> <bookmarks> <site url="http://dist.springsource.com/release/TOOLS/update/e3.7" selected="true" name="SpringSource Update Site for Eclipse 3.7"/> <site url="http://dist.springsource.com/release/TOOLS/composite/e3.7" selected="true" name="SpringSource Update Site for Eclipse 3.7 (Dependencies)"/> <site url="http://download.eclipse.org/releases/indigo" selected="true" name="Indigo"/> </bookmarks> 880 APPENDIX A ■ SPRINGSOURCE TOOL SUITE The file contains all the update sites required for installing STS. Then, open the Install dialog (by select Help ➤ Install New Software… in Eclipse top menu), as shown in Figure A-11. Click the link Available Software Sites, click the Import button, and select the file, as shown in Figure A-12. Figure A-12. Importing the STS update sites in Eclipse Upon completion, you will see that the STS update sites are added, as shown in Figure A-13. 881 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-13. STS update sites in Eclipse Back in the Install dialog, select the components to install, as shown in Figure A-14. 882 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-14. Selecting STS components We don’t need all the components, and some components require additional plug-ins to be installed first. Select the components suitable for your environment; Figure A-15 shows the components selected in our sample. 883 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-15. Selected STS components Click the Next button, and follow the instructions to start the installation. Once the installation is complete, the STS-related functions will be available. Project Setup and Dependency Management After STS is installed, we can create a project and start development. STS provides a number of template projects with preconfigured settings and dependencies. In STS, choose File ➤ New ➤ Spring Template Project, and a list of available template projects will be presented for your selection. Figure A-16 shows the available template projects as of version 2.8.1. 884 APPENDIX A ■ SPRINGSOURCE TOOL SUITE Figure A-16. Selecting a Spring project template Clicking the project name presents you with a brief description of the purpose of the project. Create a Simple Spring Utility Project Let’s create a simple project.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages44 Page
-
File Size-