Announcement Announcement Module
Collapse
No announcement yet.
Can't even get a Hello World working with STS! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can't even get a Hello World working with STS!

    Hello,

    I just downloaded STS and I'm beginning to wish I hadn't bothered. I have to learn Spring pretty quickly and I saw on SpringSource.org that STS was the best way to create Spring Projects. So I created a Spring Project and created a Java class and in there I put a reference to ApplicationContext (like page 1 of Spring books tell you to do). But I cannot import it. Well, if I added whatever jar it is in to the Build Path I guess I would be able to, but do I / should I really have to do that? I've seen a could of articles that say to create a Maven project. I can't believe that I would have to do that. I'm not interested in Maven and don't particularly want to have anything to do with it. Any help greatly appreciated.

    Thanks,
    Paul

  • #2
    I just tried creating a Spring Template Project - a utility one - and it generates ExampleService.java which references org.springframework.stereotype.Component but org.springframework cannot be resolved.

    Comment


    • #3
      Hey Paul!

      The Spring Template projects in STS are usually the best and easiest way to get started, but they use Maven to resolve their dependencies. However, that should not be a big deal for you, since STS comes with a direct integration of Maven into Eclipse/STS.

      From your second posting I see that you used a Spring Template project already and that it cannot resolve dependencies to some org.springframework packages. Usually those dependencies are automatically resolved for you (as you would expect), using the underlying Maven integration. Now it looks like this wasn't the case for you. Is there anything showing up under the "Maven Dependencies" folder in your project? And are you behind a proxy/firewall maybe? I know that Maven requires manual configuration of a proxy, if that is the case. It is not hard, but needs to be done manually (http://maven.apache.org/guides/mini/guide-proxies.html).

      In addition to that there are a number of tutorials and a getting started webinar for using Spring and STS mentioned here:
      http://forum.springsource.org/showth...etting-Started

      Hope this helps to get you started!
      -Martin

      Comment


      • #4
        Thank you for replying, Martin.

        I posted the second one too soon - it has resolved the dependencies, it just took a very, very long time for Eclipse to remove the red underline from org.springframework.

        If I want to just have a Spring application without Maven being involved, can I create a Spring Project (rather than a Spring Template Project)? All I wanted to do was to get started by typing in an extremely simple example that is in the first couple of pages of my "Just Spring" book. I can't believe how difficult that is made. Maybe I should go to using plain old Eclipse and just install the Spring add-ons into that - if that is even possible - rather than have to learn STS/Maven as well as Spring?

        Thank you,
        Paul

        Comment


        • #5
          Hey Paul!

          Of course you don't need to work with Maven for Spring projects. It is just the way that many people are working (with or without Spring being involved) and the Spring Template projects are defined using Maven in order to always get all the necessary dependencies and libraries resolved and downloaded on your machine.

          If you would like to get started with a very simple spring project, you can just create that using the "New Spring Project" wizard. In that case, you would need to configure the class- and build-path of your project yourself by pointing that the libraries/JARs that you wanna use for your project (like the Spring framework JARs that you downloaded from springsource.org, for example). But that is not much different from running plain Eclipse and going from there.

          I don't know the example you are referring to, but if you have any more details on that, I am sure that the community here is happy to help you with that here.

          HTH,
          Martin

          Comment

          Working...
          X