Grails
  1. Grails
  2. GRAILS-8566

list-plugin-updates shows old versions of some plugins

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0 final
    • Fix Version/s: 2.1.1
    • Component/s: Plugins
    • Labels:
    • Environment:
      Mac OS X 10.7

      Description

      I see some old versions (hibernate, tomcat) when running grails
      list-plugin-updates using 2.0 on the command line (non-interactive).

      Plugins with available updates are listed below:
      -------------------------------------------------------------
      <Plugin> <Current> <Available>
      tomcat 2.0.0 1.3.7.2
      spring-security-core1.2.6 1.2.7
      resources 1.1.5 1.1.6
      hibernate 2.0.0 1.3.7

        Activity

        Hide
        John La Barge added a comment -

        I have this same issue. The Nabble report mentioned a workaround using BuildConfig.groovy but did not describe it.

        Show
        John La Barge added a comment - I have this same issue. The Nabble report mentioned a workaround using BuildConfig.groovy but did not describe it.
        Hide
        Donal Murtagh added a comment - - edited

        Here's a Comparator implementation that (seems to) compare two plugin versions correctly. A suite of tests appear after the class itself. The code can be copy-pasted into the Groovy console and executed therein to verify its behaviour. Hopefully this might prove useful to resolving this issue.

        class VersionComparator<String> implements Comparator {
        
            int compare(String v1, String v2) {
                
                if (v1 == v2) {
                    return 0          
                }
                        
                def v1parts = v1.tokenize('.')
                def v2parts = v2.tokenize('.')        
                
                def v1Less = -1
                def v1Greater = 1                        
                 
                for (int i = 0; i < v1parts.size(); i++) {
                
                    def v1part = v1parts[i]
                    def v2part = v2parts.size() > i ? v2parts[i] : null      
                    
                    if (!v2part) {
                        return v1Greater
                      
                    } else if (v1part != v2part) {
                        return v1part <=> v2part
                    }                        
                }
                
                // the only way we can get here is if v1 is a subset of v2, e.g. 2.0.1 and 2.0.1.1, which mean v2 is later/greater
                return v1Less
            }
            
            boolean equals(Object obj) {
                super.equals(obj)
            }
        }
        
        /////////////////////////
        // Tests
        /////////////////////////
        def vc = new VersionComparator()
        assert vc.compare("1.2.3", "1.2.3") == 0
        
        assert vc.compare("1.4.3", "1.2.3") == 1
        assert vc.compare("1.2.3", "1.4.3") == -1
        
        assert vc.compare("1.2.3.1", "1.2.3") == 1
        assert vc.compare("1.2.3", "1.2.3.1") == -1
        
        assert vc.compare("2.0", "1.1.1.1") == 1
        assert vc.compare("1.1.1.1", "2.0") == -1
        
        assert vc.compare("1", "2") == -1
        assert vc.compare("2", "1") == 1
        
        Show
        Donal Murtagh added a comment - - edited Here's a Comparator implementation that (seems to) compare two plugin versions correctly. A suite of tests appear after the class itself. The code can be copy-pasted into the Groovy console and executed therein to verify its behaviour. Hopefully this might prove useful to resolving this issue. class VersionComparator< String > implements Comparator { int compare( String v1, String v2) { if (v1 == v2) { return 0 } def v1parts = v1.tokenize('.') def v2parts = v2.tokenize('.') def v1Less = -1 def v1Greater = 1 for ( int i = 0; i < v1parts.size(); i++) { def v1part = v1parts[i] def v2part = v2parts.size() > i ? v2parts[i] : null if (!v2part) { return v1Greater } else if (v1part != v2part) { return v1part <=> v2part } } // the only way we can get here is if v1 is a subset of v2, e.g. 2.0.1 and 2.0.1.1, which mean v2 is later/greater return v1Less } boolean equals( Object obj) { super .equals(obj) } } ///////////////////////// // Tests ///////////////////////// def vc = new VersionComparator() assert vc.compare( "1.2.3" , "1.2.3" ) == 0 assert vc.compare( "1.4.3" , "1.2.3" ) == 1 assert vc.compare( "1.2.3" , "1.4.3" ) == -1 assert vc.compare( "1.2.3.1" , "1.2.3" ) == 1 assert vc.compare( "1.2.3" , "1.2.3.1" ) == -1 assert vc.compare( "2.0" , "1.1.1.1" ) == 1 assert vc.compare( "1.1.1.1" , "2.0" ) == -1 assert vc.compare( "1" , "2" ) == -1 assert vc.compare( "2" , "1" ) == 1
        Hide
        Benjamin Wolff added a comment -

        Is this bug still present in 2.1.1? If I issue a 'grails list-plugin-updates' the output now shows:

        Plugins with available updates are listed below:
        -------------------------------------------------------------
        <Plugin>            <Current>         <Available>
        hibernate           2.1.1             2.2.0.RC1
        tomcat              2.1.1             2.2.0.RC1
        

        This seems to be correct?! Can anyone confirm?

        Show
        Benjamin Wolff added a comment - Is this bug still present in 2.1.1? If I issue a 'grails list-plugin-updates' the output now shows: Plugins with available updates are listed below: ------------------------------------------------------------- <Plugin> <Current> <Available> hibernate 2.1.1 2.2.0.RC1 tomcat 2.1.1 2.2.0.RC1 This seems to be correct?! Can anyone confirm?
        Hide
        Jiri Hron added a comment -

        I just tried and output in 2.1.1 is:

        Plugins with available updates are listed below:
        -------------------------------------------------------------
        <Plugin>            <Current>         <Available>
        twitter-bootstrap   2.1.0.1           2.1.1
        tomcat              2.1.1             2.2.0.RC1
        resources           1.1.6             1.2.RC2
        jquery              1.7.2             1.8.0
        hibernate           2.1.1             2.2.0.RC1
        
        Show
        Jiri Hron added a comment - I just tried and output in 2.1.1 is: Plugins with available updates are listed below: ------------------------------------------------------------- <Plugin> <Current> <Available> twitter-bootstrap 2.1.0.1 2.1.1 tomcat 2.1.1 2.2.0.RC1 resources 1.1.6 1.2.RC2 jquery 1.7.2 1.8.0 hibernate 2.1.1 2.2.0.RC1
        Hide
        Graeme Rocher added a comment -

        Thanks for confirmation

        Show
        Graeme Rocher added a comment - Thanks for confirmation
        Hide
        Jaroslav Kostal added a comment -

        I still see old versions of some plugins in Grails 2.1.4 - but old versions are also displayed on plugin's web page e.g. http://grails.org/plugins/jquery - there is latest version 1.8.3 but actually I can install 1.9.1 by changing version in BuildConfig.groovy

        Plugins with available updates are listed below:
        -------------------------------------------------------------
        <Plugin>            <Current>         <Available>
        zipped-resources    1.0.1             1.0
        resources           1.2               1.2.RC2
        jquery              1.9.1             1.8.3
        cached-resources    1.1               1.0
        
        Show
        Jaroslav Kostal added a comment - I still see old versions of some plugins in Grails 2.1.4 - but old versions are also displayed on plugin's web page e.g. http://grails.org/plugins/jquery - there is latest version 1.8.3 but actually I can install 1.9.1 by changing version in BuildConfig.groovy Plugins with available updates are listed below: ------------------------------------------------------------- <Plugin> <Current> <Available> zipped-resources 1.0.1 1.0 resources 1.2 1.2.RC2 jquery 1.9.1 1.8.3 cached-resources 1.1 1.0

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Kurt Wiersma
          • Votes:
            6 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Last Reviewed:

              Development