Announcement Announcement Module
Collapse
No announcement yet.
In STS, how to make an "older" project use the currently installed JARs? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • In STS, how to make an "older" project use the currently installed JARs?

    From STS, I'm trying to load and run the ProSpring3 project provided by the author of the APress Pro Spring 3 book. I get the latest STS from springsource.org (This is spring-tool-suite-3.1.0.RELEASE-e4.2-win32-x86_64-installer.exe). It installs and seems to operate OK. On my Win 7 PC I set up permissions, env vars, etc. to get files to copy OK and let maven run right.

    Now get the project from https://github.com/prospring3/springblog. It downloads as a ZIP, and I install the code in my projects directory. STS says that this is some sort of an old project that needs conversion, and I let it.

    I try to update the project, or perhaps run it in the server. Complaints about missing JAR files -- about 80. The ones it wants are in the .m2 directory. Here is a sample of the errors:

    Error reading file C:\Users\Jerome\.m2\repository\org\springframework \spring-context\3.1.0.RELEASE\spring-context-3.1.0.RELEASE.jar C:\Users\Jerome\.m2\repository\org\springframework \spring-context\3.1.0.RELEASE\spring-context-3.1.0.RELEASE.jar (The system cannot find the file specified)

    So I figure, updating dependencies OUGHT to be easy, because that is why I'm using this stack of software, right? And perhaps if I change the release to 3.1.1.RELEASE, because that is the version I seem to have, then something (Maven? Roo?) will start automatically fixing things for me. Not working that way for me, so far. I think that the directory is missing every JAR file.

    I went to github.com to find a version of the spring-samples that include the Pet Clinic. I found one, but it insisted on stuff like "3.0.5.RELEASE".

    Is it true that whenever I get an updated version of the Spring libraries I'll break about 50-100 lines of each project I write?

    There ought to be an easy way of saying "make this project use the up-to-date version of Spring that I have". Otherwise, I'm looking to my disk to find my installed versions and then patching a XML file. Then if I update the library I'm updating that file again, up to 80 times.

    What am I missing here?

  • #2
    Hey!

    I am not sure what exactly is going wrong in your case, since there are multiple topics raised here, but let me try to wall through them to see if I can help.

    I am not the author of the example project you are trying to use, but it looks like it is a Maven-based project. And running a full STS 3.1.0 distribution provides you with the Maven integration for Eclipse out-of-the-box, so that looks good. However, it seems like the Maven support is not able to resolve the dependencies of the project somehow. When I import that project into STS 3.1.0, I also get the migration wizard popup (so the project seems to be created using an older STS version). That is fine.

    Do you see a "Maven Dependencies" entry in your package explorer for your project after import? And if so, do you see any libs showing up there if you expand this node in the tree? If not, Maven wasn't able to configure the dependencies. Maybe you are behind a proxy/firewall and you need to configure Maven to use these settings? (http://maven.apache.org/guides/mini/guide-proxies.html)

    Changing the Spring version for a Maven-based project is usually done using a property for the Spring version or a parent pom. So you define the version that should be used in exactly one place and change that to whatever version you want by changing exactly this one place - not all over the place. The Maven integration takes care of configuring the projects inside Eclipse/STS for you.

    Regarding the version being used: Usually in Maven-based projects you define the version of the dependency that should be used exactly and let Maven download the right artifact for you. This doesn't update the version automatically for you in case a new version of the library becomes available.

    HTH,
    Martin

    Comment

    Working...
    X