Announcement Announcement Module
Collapse
No announcement yet.
Problem with dependencies in STS/Grails Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with dependencies in STS/Grails

    Hi all,

    I have a problem that I'm hoping someone can help with. It's quite a basic question this: basically, I'm having problems using dependencies in Grails projects in the STS tool suite.

    So I've added a dependency to the project, by adding this to BuildConfig.groovy:

    Code:
        dependencies {
    
            compile 'org.apache.poi:poi:3.7', 'org.apache.poi:poi-ooxml:3.7'
    
        }
    This builds OK and I can see that the POI library has been downloaded into my ivy cache in .grails. However, the classes that are provided by this library aren't available. If I try to import them in a groovy file, I can an error saying "unable to resolve class" and the "Open Type" dialog does not find any of the classes either.

    I have tried "grails clean" and "grails refresh-dependencies" to no avail. I can make this work by copying the libraries to my lib/ folder but I'm sure I shouldn't have to? I've had the same problem with another library as well. This is using Grails STS 2.6.0.

    I'm sure I'm doing something obviously wrong here, any suggestions to how I ought to do this would be highly appreciated!

    Regards,
    Jan
    Last edited by Andrew Eisenberg; Sep 21st, 2012, 12:14 PM. Reason: formatting

  • #2
    Did you try the 'refresh dependencies' option in the Grails menu (accesible if you right click on your project)?

    Just running the "grails refresh-dependencies" command itself isn't sufficient to let the IDE pick up on dependency changes. You have to make the IDE itself 'refresh' its dependencies.

    This is because The IDE and the command line tooling use seperate infrastructure for compiling your code. The IDE menu 'refresh dependencies' is supposed to synch-up both worlds with eachother. Typically you have to do this if you made changes to the project dependencies by editing your project's config files.

    Comment


    • #3
      IMHO this step is difficult. We frequently find ourselves going through a morning ritual of refresh-dependencies/clean and sometimes grails clean in order to get updates synced with GGTS. Sometimes missing dependencies manifest themselves strangely in the compiler. For example, a few times I've seen missing imports in unit tests appear after a refresh/clean that were actually caused by dependency conflicts or snapshot dependencies that didn't update properly.

      In my own recent experience, introducing grails to developers on my team who had never used groovy before, having to explain this "wonkiness" in the svn update process on day 1 of the project made selling grails a bit harder than it should have been.

      Just my input

      Thanks.

      Rick


      Originally posted by Kris De Volder View Post
      Did you try the 'refresh dependencies' option in the Grails menu (accesible if you right click on your project)?

      Just running the "grails refresh-dependencies" command itself isn't sufficient to let the IDE pick up on dependency changes. You have to make the IDE itself 'refresh' its dependencies.

      This is because The IDE and the command line tooling use seperate infrastructure for compiling your code. The IDE menu 'refresh dependencies' is supposed to synch-up both worlds with eachother. Typically you have to do this if you made changes to the project dependencies by editing your project's config files.

      Comment


      • #4
        Hey Rick,

        Thanks for your input. I wonder what we could do to make things better. One thing which may be worth considering, given your example scenario here is... maybe we could trigger an automatic refresh when changes are made to BuildConfig.groovy.

        The problem with that could be that it does additional and sometimes unneccesary refreshes, which are rather time consuming and can be aggravating. But if it can reduce the wonkiness, maybe it could be worth it.

        And of course we should make it possible for people to disable this 'feature' if they find it more annoying than helpful.

        I'll raise a Jira ticket for this. [Edit: Jira ticke raised: https://issuetracker.springsource.com/browse/STS-2980]

        Kris
        Last edited by Kris De Volder; Oct 11th, 2012, 02:41 PM.

        Comment

        Working...
        X