Announcement Announcement Module
Collapse
No announcement yet.
Is it required to add spring jar files at Java Build Path for every new project? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is it required to add spring jar files at Java Build Path for every new project?

    I installed spring plugin through marketplace and created a new spring project. I was expecting the spring jar files to be available to all Spring projects but according all the tutorials I could lay my hands on, I need to add the jar files at the Java Build Path. Can't I configure somewhere so that spring jars are available for every new Spring project?

    Ravi

  • #2
    Hey Ravi!

    We don't provide such a mechanism at the moment. The reason is that people often use Maven for their dependency management (or Ivy or something else) and would like to use a specific version of the Spring framework (instead of the libs that are inside STS and used by STS itself). But you can define a user-defined Library that contains all the necessary Spring framework JARs and maybe others and just add that user-defined library to each project. Would make it a bit easier as adding several JARs all over again.

    HTH,
    Martin

    Comment


    • #3
      Thank you very much Martin.

      Comment


      • #4
        I am also brand new to Spring and quickly becoming frustrated with the difficulty of getting a HelloWorld app up and running. After several hours I finally managed to figure out the basics of a Spring application. However, as the previous poster indicated, the SpringSource Tools plug-in that I got from the Eclipse marketplace doesn't automatically add the appropriate libraries to the build path when you create a new Spring project.

        The problem is, I have no idea where to get the JARs that need to be added to the build path (org.springframework). What I have done so far:

        1. Launched a brand new Windows 7 VM
        2. Installed Java 6u29
        3. Installed Eclipse 3.7.1
        4. Launched Eclipse.
        5. Launched Eclipse Marketplace.
        6. Searched for Spring.
        7. Installed SpringSource Tool Suite for Eclipse Indigo (3.7).
        8. Create a Spring Project.
        9. Wrote a HelloWorld app.
        10. Found that there is no ApplicationContext class in the build path.

        While it was far from the expected outcome, I now understand that SpringSource Tool Suite for Eclipse doesn't put any Spring JARs in the build path for Spring projects. I am uncertain how to proceed from here. What is the recommended way to get whatever is the stable set of JARs? Is there something else I have to download and then add the JARs by hand? Are the JARs packed up somewhere in the eclipse/plugin directory?

        Note to developers if you are interested in feedback from a new user perspective:
        If you are interested in attracting new people to Spring I would encourage you to vastly improve the newbie experience. At the moment, just getting HelloWorld up and running is quite painful. I can appreciate your desire to allow advanced developers to use their own JARs, but it seems to me that the default should be to include something reasonable and have a check box during project creation that says, "don't include default JARs".

        It feels broken when I install a plug-in, create a project using the templates provided and the project is created with a bunch of build errors (because the JARs aren't included in the build path). While not perfect, I would suggest checking out GWT or Android development from a newbie perspective. There is a clear "start here" webpage that walks you through not only installing and setting up the plug-in in eclipse (a popular IDE), but also writing a HelloWorld app. By the time the HelloWorld app is done the user has enough of an understanding to branch out to where they want to go. Also, when you create a new project in one of those plug-ins everything is setup and ready to run as soon as you click finish. There is no need for additional setup steps, you can run the helloworld app without touching anything other than run.

        With Spring it feels like the first step is to choose an advanced topic and then flail about until you figure out how to get it working. The tutorials linked at springsource.org that sound like good places to start end up being PowerPoint presentations without any actual code/environment in them (i.e., not a tutorial at all but rather a presentation) or they are advanced topics (integrating Spring with X and utilizing advanced Spring features). The Spring Utility template appears to be close to a hello-world app, but still suffers from the above problem of missing the spring jars and also missing the junit jars.

        Comment


        • #5
          Hi!

          Thanks very much for your feedback from the newbie perspective!

          I think the main problem you are observing in this setting is that the template projects are using Maven to configure their dependencies. But if you have Eclipse 3.7.1 installed, it doesn't contain the Eclipse Maven integration out of the box, so you would need to install that from the Indigo update site in addition to the SpringSource Tool Suite. I perfectly understand that this is not optional for getting started. Therefore we provide the SpringSource Tool Suite packages for download. They contain everything you need, including Eclipse 3.7.1 with STS and the Maven integration already installed, even the tc Server is coming with that download and gets configured automatically for your IDE.

          Here are they steps that I typically recommend for getting started quickly:

          1. Download the latest STS release from http://www.springsource.com/developer/sts
          2. Install STS on your machine (using the installer is the preferred way)
          3. Start STS
          4. Create a new Spring project from the Spring Template Projects (web mvc, for example)
          5. Deploy that to your local tc Server (that comes with STS and is ready to use) via drag&drop
          6. Start tc Server, your "Hello World" web MVC app is running

          This typically takes me a few minutes to setup a completely fresh STS installation and have the first example application running. Sometimes Eclipse complains about a missing JSTL template within the MVC template project. If that happens, just do a complete rebuild of the project by doing "clean rebuild" from the project menu. That should solve that problem, if it happens.

          Hope this helps you getting started a lot smoother!
          -Martin

          Comment


          • #6
            Thank you for the quick reply!

            Unfortunately, this has lead to a new problem. I downloaded the latest STS release as you suggested (springsource-tool-suite-2.8.1.RELEASE-e3.7.1-win32-x86_64-installer.exe) and during the installation it asks me to point it at a JDK. I point it to C:\Program Files\Java\jdk1.6.0_29 (the default install location for the latest release JDK) and it tells me:

            The chosen JDK has the wrong version (available: null required: 1.5.0 - 99.0.0). Should this JDK be used anyway?

            I can click Yes and presume that it will continue with the install but I fear that I may be doing something wrong. I used all defaults during the Java install and the STS install. I tried pointing the STS installer at the bin subdirectory, the parent directory as well as the JRE directory and they all result in an error about the directory not containing the required product.

            If I open up a command prompt and type java - version I get:
            java version "1.6.0_29"
            Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
            Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode)

            When I look at the properties on java.exe in the bin folder of the JDK I see:
            Product version: 6.0.290.11

            As mentioned previously, this is:
            Windows 7 Professional x64 host
            VMWare Workstation 8
            Windows 7 Professional x64 guest (fully patched)
            - Java 6u29 x64 (jdk-6u29-windows-x64.exe)
            - Eclipse 3.7.1 x64 (eclipse-jee-indigo-SR1-win32-x86_64.zip)

            There is nothing else installed in the VM.

            Comment


            • #7
              Hey!

              I tried this as well again, having Windows 7 (64bit) and the latest 1.6.0 JDK from Oracle (6u30), also 64bit. When I execute the STS installer and point it at the jdk directory, it doesn't complain about the JDK and installs STS smoothly. I don't know why the installer is complaining in your case, but I guess that your STS got installed correctly and should run fine.

              After starting STS you should take a look at the installed JREs in the Java preferences. Does it point to the right JDK? Just to make sure everything got setup correctly with regards to the JDK.

              HTH,
              Martin

              Comment


              • #8
                Missing spring libraries

                I am also battling with the buid path.

                I downloaded 'springsource-tool-suite-2.8.1.RELEASE-e3.7.1-win32.zip'. I prefer to self contained file that I can extract wherever I want to use it.

                I got Grails working on it perfectly.

                But, I have now created a new Spring project using the Spring MVC template, and it is saying it can't find any of the Spring imports (org.springframework.*).

                I don't want to use the installer, I prefer setting things up myself so it suits my environment. So, does anyone know where I can find the required libraries? I would have thought STS came with built in Spring libraries.

                Comment


                • #9
                  So I downloaded Spring 3.1.1 from www.springsource.org, and added the libraries found in the dist directory to my project. Now just to find the libraries for org.slf4j.*

                  Comment


                  • #10
                    Hey!

                    If you have created a project from the MVC project template, you should be using Maven and the Eclipse integration for Maven for the project. Isn't that the case? Do you see the Maven Dependencies classpath container in the project explorer when looking at the project?

                    -Martin

                    Comment


                    • #11
                      Hi Martin,

                      Yes, I do have the Maven dependencies classpath container in my project.

                      Turns out, I just needed to create the Maven settings.xml file in the correct spot and enter my company's proxy settings, so Maven could transfer the required dependencies from the online repository.

                      Thanks for your assistance.

                      Now just to figure out why the 'VMWare vFabric tc Server Development Edition v2.6-config is missing' when trying to run on server.

                      Comment


                      • #12
                        Originally posted by dleerob View Post
                        Hi Martin,

                        Yes, I do have the Maven dependencies classpath container in my project.

                        Turns out, I just needed to create the Maven settings.xml file in the correct spot and enter my company's proxy settings, so Maven could transfer the required dependencies from the online repository.

                        Thanks for your assistance.

                        Now just to figure out why the 'VMWare vFabric tc Server Development Edition v2.6-config is missing' when trying to run on server.
                        After closing the project, re-opening, cleaning, fresh build, try again, eventually worked on the tc Server. Didn't have to change anything. Awesome.

                        Comment


                        • #13
                          Hi!

                          Good to hear you got it working. I would never have thought about Maven settings here...
                          Thanks for letting us know!

                          Cheers,
                          -Martin

                          Comment


                          • #14
                            Hi,

                            I downloaded springsource-tool-suite-2.9.1.RELEASE-e.3.7.2-win32-installer. When I get to step 5 of 8 in which I point to my JDK, I get the error message "the chosen directory does not contain the required product". But the JDK-7u3 that I downloaded from Oracle is in my C:/Java directory to which I'm pointing. I can't get past that error message, so I can't install the STS. Please help!

                            Thanks in advanced.

                            Comment


                            • #15
                              Hi!

                              As a workaround, please download the zip file for STS 2.9.1 (not the installer, but the plain zipped version), unzip somewhere in your hard drive (but please not into Program Files). If STS doesn't run with the JDK automatically (when it finds JRE, for example), you can configure it manually afterwards using the "-vm c:\pathtojdk\bin\javaw.exe" argument, for example).

                              HTH,
                              Martin

                              Comment

                              Working...
                              X