Grails
  1. Grails
  2. GRAILS-6147

Maven classifier not working for deps

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.2.1, 1.2.2
    • Fix Version/s: 2.3-M1
    • Component/s: Configuration
    • Labels:
      None

      Description

      During the Grails executions, run-app, war, etc. I get the following issue, which appears to be an internal Ivy-related issue. Even when executing my project through grails-maven-plugin, there appears to be some resolution on the part of Ivy and it get's mad since it doesn't properly understand the classifier like the following dep:

      <dependency>
      <groupId>net.sf.json-lib</groupId>
      <artifactId>json-lib</artifactId>
      <version>2.3</version>
      <classifier>jdk15</classifier>
      </dependency>

      – ERROR MESSAGE –

      :: problems summary ::
      :::: WARNINGS
      [FAILED ] net.sf.json-lib#json-lib;2.3!json-lib.jar: (0ms)

      ==== grailsPlugins: tried

      /Users/arimus/workspace/mt-api/lib/json-lib-2.3.jar

      /Users/arimus/.grails/1.2.2/projects/mt-api/plugins/hibernate-1.2.2/lib/json-lib-2.3.jar

      /Users/arimus/.grails/1.2.2/projects/mt-api/plugins/jaxrs-0.4/lib/json-lib-2.3.jar

      /Users/arimus/.grails/1.2.2/projects/mt-api/plugins/tomcat-1.2.2/lib/json-lib-2.3.jar

      ==== grailsHome: tried

      /Users/arimus/grails/lib/json-lib-2.3.jar

      ==== grailsHome: tried

      /Users/arimus/grails/dist/json-lib-2.3.jar

      ==== localMavenResolver: tried

      /Users/arimus/.m2/repository/net/sf/json-lib/json-lib/2.3/json-lib-2.3.jar

      ::::::::::::::::::::::::::::::::::::::::::::::

      :: FAILED DOWNLOADS ::

      :: ^ see resolution messages for details ^ ::

      ::::::::::::::::::::::::::::::::::::::::::::::

      :: net.sf.json-lib#json-lib;2.3!json-lib.jar

      ::::::::::::::::::::::::::::::::::::::::::::::

      – WORK AROUND –

      Install json-lib-2.3-jdk15.jar as json-lib-2.3.jar (in M2 repo or by placing in <project>/lib)

        Issue Links

          Activity

          Hide
          Peter Ledbrook added a comment -

          GRAILS-6716 has a sample application attached. This is pretty critical since PluginResolveEngine relies on 'classifier'.

          Show
          Peter Ledbrook added a comment - GRAILS-6716 has a sample application attached. This is pretty critical since PluginResolveEngine relies on 'classifier'.
          Hide
          Peter Ledbrook added a comment -

          My bad. Seems that the sample project is attached to GRAILS-6765.

          Show
          Peter Ledbrook added a comment - My bad. Seems that the sample project is attached to GRAILS-6765 .
          Hide
          Graeme Rocher added a comment -

          Moving away from Ivy to Gradle is the only way to solve this as far as I'm aware. Re-scheduling

          Show
          Graeme Rocher added a comment - Moving away from Ivy to Gradle is the only way to solve this as far as I'm aware. Re-scheduling
          Hide
          Luke Daley added a comment -

          @Graeme: that's correct.

          The only way we were able to solve in Gradle was to get rid of Ivy and replace it with our own solution.

          Show
          Luke Daley added a comment - @Graeme: that's correct. The only way we were able to solve in Gradle was to get rid of Ivy and replace it with our own solution.
          Hide
          yariv added a comment -

          Hello,
          Sorry for my beginner question,
          I am trying to install plugins.jquery-validation-ui=1.2.3 and run into this issue GRAILS-6147 and have no idea what to do.
          I download json-lib-2.4-jdk15.jar into the grails Lib directory, but still the app is looking for it elsewhere
          How can I tell my application that the jar is local?
          Thanks

          Show
          yariv added a comment - Hello, Sorry for my beginner question, I am trying to install plugins.jquery-validation-ui=1.2.3 and run into this issue GRAILS-6147 and have no idea what to do. I download json-lib-2.4-jdk15.jar into the grails Lib directory, but still the app is looking for it elsewhere How can I tell my application that the jar is local? Thanks
          Hide
          Peter Ledbrook added a comment -

          @yariv Remove the '-jdk5' from the JAR's file name so you have lib/json-lib-2.4.jar

          Show
          Peter Ledbrook added a comment - @yariv Remove the '-jdk5' from the JAR's file name so you have lib/json-lib-2.4.jar
          Hide
          Peter Ledbrook added a comment -

          Also, that plugin may require version 2.3 of the library.

          Show
          Peter Ledbrook added a comment - Also, that plugin may require version 2.3 of the library.
          Hide
          Nicolas Labrot added a comment -

          I don't understand why this is an Ivy issue.

          Ivy supports classifier if the classifier is set in the pattern resolver.

          eg. pattern="[organisation]/[module]/[revision]/[artifact][revision]([classifier]).[ext]"

          Show
          Nicolas Labrot added a comment - I don't understand why this is an Ivy issue. Ivy supports classifier if the classifier is set in the pattern resolver. eg. pattern=" [organisation] / [module] / [revision] / [artifact] [revision] ( [classifier] ). [ext] "
          Hide
          Luke Daley added a comment -

          The problem is that Ivy does not consider items with differing classifiers as different artifacts in terms of caching. If you've previously downloaded somelib-1.0.jar and it's in your ivy cache, any future requests for something like somelib-1.0-jdk5.jar are going to use the already cached somelib-1.0.jar. And also vice versa.

          Show
          Luke Daley added a comment - The problem is that Ivy does not consider items with differing classifiers as different artifacts in terms of caching. If you've previously downloaded somelib-1.0.jar and it's in your ivy cache, any future requests for something like somelib-1.0-jdk5.jar are going to use the already cached somelib-1.0.jar. And also vice versa.
          Hide
          Nicolas Labrot added a comment -

          Strange. I thought it has been resolved with https://issues.apache.org/jira/browse/IVY-803

          Show
          Nicolas Labrot added a comment - Strange. I thought it has been resolved with https://issues.apache.org/jira/browse/IVY-803
          Hide
          Luke Daley added a comment -

          It's been a long while since I looked at this, but this was my recollection of the issue.

          BTW, all of the repositories Grails defines include the classifier attribute in the path, so it's not as simple as adding that.

          If someone could confirm that the sample attached to GRAILS-6716 is still broken that would be very helpful.

          Show
          Luke Daley added a comment - It's been a long while since I looked at this, but this was my recollection of the issue. BTW, all of the repositories Grails defines include the classifier attribute in the path, so it's not as simple as adding that. If someone could confirm that the sample attached to GRAILS-6716 is still broken that would be very helpful.
          Hide
          Nicolas Labrot added a comment -

          I confirm I have the issue with Grails 2.0.3.

          I have 3 saxon dependencies: same groupid, artifact, version, 1 dep without a classifier and 2 deps with a classifier s9api and dom. dependency-report do not display the classifier but display a version conflict between the 3 deps. As a result I have just one JAR in my WAR.

          I will test Ivy alone.

          Show
          Nicolas Labrot added a comment - I confirm I have the issue with Grails 2.0.3. I have 3 saxon dependencies: same groupid, artifact, version, 1 dep without a classifier and 2 deps with a classifier s9api and dom. dependency-report do not display the classifier but display a version conflict between the 3 deps. As a result I have just one JAR in my WAR. I will test Ivy alone.
          Hide
          Nicolas Labrot added a comment -

          I have test with Ivy 2.2.0. Classifier works perfectly. Ivy cache contains my 3 deps and 2 are suffixed by the classifier. ivy:resolve export my 3 deps

          Show
          Nicolas Labrot added a comment - I have test with Ivy 2.2.0. Classifier works perfectly. Ivy cache contains my 3 deps and 2 are suffixed by the classifier. ivy:resolve export my 3 deps
          Hide
          Luke Daley added a comment -

          I think I've found the problem. Need to discuss the potential solutions.

          Show
          Luke Daley added a comment - I think I've found the problem. Need to discuss the potential solutions.
          Hide
          Luke Daley added a comment -

          This is fixed in the 2.1 line.

          Show
          Luke Daley added a comment - This is fixed in the 2.1 line.
          Hide
          Nicolas Labrot added a comment -

          Thanks for the fix!

          Show
          Nicolas Labrot added a comment - Thanks for the fix!
          Hide
          Luke Daley added a comment -

          Nicolas, any chance you could try the latest master and confirm it fixes your issue?

          Show
          Luke Daley added a comment - Nicolas, any chance you could try the latest master and confirm it fixes your issue?
          Hide
          Nicolas Labrot added a comment -

          Can I take build artefact of Hudson build 349 (http://hudson.grails.org/job/grails_core_2.1.x/349/) ?

          Show
          Nicolas Labrot added a comment - Can I take build artefact of Hudson build 349 ( http://hudson.grails.org/job/grails_core_2.1.x/349/ ) ?
          Hide
          Luke Daley added a comment -

          Yes, they have the change.

          Show
          Luke Daley added a comment - Yes, they have the change.
          Hide
          Nicolas Labrot added a comment -

          Sorry it seems to not solve the issue

          My dependencies are :

           
          compile(group: 'net.sourceforge.saxon', name: 'saxon', version: '9.1.0.8')
          compile(group: 'net.sourceforge.saxon', name: 'saxon', version: '9.1.0.8' , classifier:'s9api')
          compile(group: 'net.sourceforge.saxon', name: 'saxon', version: '9.1.0.8' , classifier:'dom')
          

          I join a project sample

          Show
          Nicolas Labrot added a comment - Sorry it seems to not solve the issue My dependencies are : compile(group: 'net.sourceforge.saxon', name: 'saxon', version: '9.1.0.8') compile(group: 'net.sourceforge.saxon', name: 'saxon', version: '9.1.0.8' , classifier:'s9api') compile(group: 'net.sourceforge.saxon', name: 'saxon', version: '9.1.0.8' , classifier:'dom') I join a project sample
          Hide
          Luke Daley added a comment -

          Pretty sure it's fixed now.

          Show
          Luke Daley added a comment - Pretty sure it's fixed now.
          Hide
          Luke Daley added a comment -

          @Nicolas: can you try again please. You can use http://hudson.grails.org/job/grails_core_2.1.x/358/

          Show
          Luke Daley added a comment - @Nicolas: can you try again please. You can use http://hudson.grails.org/job/grails_core_2.1.x/358/
          Hide
          Nicolas Labrot added a comment -

          I will try this week end

          Show
          Nicolas Labrot added a comment - I will try this week end
          Hide
          Nicolas Labrot added a comment -

          Sorry it seems to not solve the issue.

          My WAR contains

          • saxon-9.1.0.8-dom.jar
          • saxon-9.1.0.8-s9api.jar

          But not

          • saxon-9.1.0.8.jar
          Show
          Nicolas Labrot added a comment - Sorry it seems to not solve the issue. My WAR contains saxon-9.1.0.8-dom.jar saxon-9.1.0.8-s9api.jar But not saxon-9.1.0.8.jar
          Hide
          Luke Daley added a comment -

          Nicolas, how are you verifying this?

          Show
          Luke Daley added a comment - Nicolas, how are you verifying this?
          Hide
          Nicolas Labrot added a comment -

          I understand better our difference.

          I just retry by cleaning the "net.sourceforge.saxon" ivy cache entry. After the build I have the 3 dependencies in the WAR : OK

          But if I clean "net.sourceforge.saxon" and build with the first dep commented (dep without the classifier) I have the 2 deps with the classifier in the WAR : OK
          If I uncomment the dep and rebuild, the WAR file contains only the 2 deps : NOK.

          I will check this evening the Ivy behaviour.

          Show
          Nicolas Labrot added a comment - I understand better our difference. I just retry by cleaning the "net.sourceforge.saxon" ivy cache entry. After the build I have the 3 dependencies in the WAR : OK But if I clean "net.sourceforge.saxon" and build with the first dep commented (dep without the classifier) I have the 2 deps with the classifier in the WAR : OK If I uncomment the dep and rebuild, the WAR file contains only the 2 deps : NOK. I will check this evening the Ivy behaviour.
          Hide
          Nicolas Labrot added a comment -

          I have test with Ivy 2.2.0 and it works perfectly.

          Scenario 1 (SC1) :

          1. I clean Ivy and Grails cache
          2. I set dependencies as saxon-9.1.0.8-dom.jar and saxon-9.1.0.8-s9api.jar.
          3. Ivy and Grails output the 2 dependencies with classifier.
          4. I set dependencies as saxon-9.1.0.8-dom.jar and saxon-9.1.0.8-s9api.jar and saxon-9.1.0.8.jar.
          5. Ivy output the 3 dependencies but Grails output only the 2 dependencies with classifier.

          Scenario 2 (SC2) :

          1. I clean Ivy and Grails cache
          2. I set dependencies as saxon-9.1.0.8-dom.jar and saxon-9.1.0.8-s9api.jar and saxon-9.1.0.8.jar.
          3. Ivy and Grails output the 3 dependencies.
          4. I set dependencies as saxon-9.1.0.8-dom.jar and saxon-9.1.0.8-s9api.jar
          5. Ivy and Grails output the 2 dependencies with classifier.

          The difference between SC1 and SC2 may be the file "ivy-cache/net.sourceforge.saxon/saxonivy-9.1.0.8.xml"

          SC1 for Grails

           
          <?xml version="1.0" encoding="UTF-8"?>
          <ivy-module version="2.0">
          	<info organisation="net.sourceforge.saxon"
          		module="saxon"
          		revision="9.1.0.8"
          		status="release"
          		publication="20120502202413"
          		default="true"
          		m:classifier="s9api"
          	/>
          	<configurations>
          		<conf name="default" visibility="public"/>
          	</configurations>
          	<publications>
          		<artifact name="saxon" type="jar" ext="jar" conf="default" classifier="s9api"/>
          		<artifact name="saxon" type="jar" ext="jar" conf="default" classifier="dom"/>
          	</publications>
          </ivy-module>
          

          SC1 and SC2 for Ivy and SC2 for Grails

           
          <?xml version="1.0" encoding="UTF-8"?>
          <ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
          	<info organisation="net.sourceforge.saxon"
          		module="saxon"
          		revision="9.1.0.8"
          		status="release"
          		publication="20100226065342"
          	>
          		<license name="Mozilla Public License Version 1.0" url="http://www.mozilla.org/MPL/MPL-1.0.txt" />
          		<description homepage="http://saxon.sourceforge.net/">
          		Saxon a complete and conformant implementation of the XSLT 2.0, XQuery 1.0, and XPath 2.0 Recommendations published on 23 January 2007 by W3C
          		</description>
          	</info>
          	<configurations>
          		[...]
          	</configurations>
          	<publications>
          		<artifact name="saxon" type="jar" ext="jar" conf="master"/>
          		<artifact name="saxon" type="source" ext="jar" conf="sources" m:classifier="sources"/>
          		<artifact name="saxon" type="javadoc" ext="jar" conf="javadoc" m:classifier="javadoc"/>
          	</publications>
          </ivy-module>
          

          Hope it will help

          Show
          Nicolas Labrot added a comment - I have test with Ivy 2.2.0 and it works perfectly. Scenario 1 (SC1) : I clean Ivy and Grails cache I set dependencies as saxon-9.1.0.8-dom.jar and saxon-9.1.0.8-s9api.jar. Ivy and Grails output the 2 dependencies with classifier. I set dependencies as saxon-9.1.0.8-dom.jar and saxon-9.1.0.8-s9api.jar and saxon-9.1.0.8.jar. Ivy output the 3 dependencies but Grails output only the 2 dependencies with classifier. Scenario 2 (SC2) : I clean Ivy and Grails cache I set dependencies as saxon-9.1.0.8-dom.jar and saxon-9.1.0.8-s9api.jar and saxon-9.1.0.8.jar. Ivy and Grails output the 3 dependencies. I set dependencies as saxon-9.1.0.8-dom.jar and saxon-9.1.0.8-s9api.jar Ivy and Grails output the 2 dependencies with classifier. The difference between SC1 and SC2 may be the file "ivy-cache/net.sourceforge.saxon/saxonivy-9.1.0.8.xml" SC1 for Grails <?xml version= "1.0" encoding= "UTF-8" ?> <ivy-module version= "2.0" > <info organisation= "net.sourceforge.saxon" module= "saxon" revision= "9.1.0.8" status= "release" publication= "20120502202413" default= "true" m:classifier= "s9api" /> <configurations> <conf name= "default" visibility= "public" /> </configurations> <publications> <artifact name= "saxon" type= "jar" ext= "jar" conf= "default" classifier= "s9api" /> <artifact name= "saxon" type= "jar" ext= "jar" conf= "default" classifier= "dom" /> </publications> </ivy-module> SC1 and SC2 for Ivy and SC2 for Grails <?xml version= "1.0" encoding= "UTF-8" ?> <ivy-module version= "2.0" xmlns:m = "http://ant.apache.org/ivy/maven" > <info organisation= "net.sourceforge.saxon" module= "saxon" revision= "9.1.0.8" status= "release" publication= "20100226065342" > <license name= "Mozilla Public License Version 1.0" url= "http://www.mozilla.org/MPL/MPL-1.0.txt" /> <description homepage= "http://saxon.sourceforge.net/" > Saxon a complete and conformant implementation of the XSLT 2.0, XQuery 1.0, and XPath 2.0 Recommendations published on 23 January 2007 by W3C </description> </info> <configurations> [...] </configurations> <publications> <artifact name= "saxon" type= "jar" ext= "jar" conf= "master" /> <artifact name= "saxon" type= "source" ext= "jar" conf= "sources" m:classifier= "sources" /> <artifact name= "saxon" type= "javadoc" ext= "jar" conf= "javadoc" m:classifier= "javadoc" /> </publications> </ivy-module> Hope it will help
          Hide
          Nicolas Labrot added a comment -

          Is this issue really closed ?

          It's seems there is another issue like explained on my previous comment.

          Show
          Nicolas Labrot added a comment - Is this issue really closed ? It's seems there is another issue like explained on my previous comment.
          Hide
          Graeme Rocher added a comment -

          fixed with Aether dependency management in 2.3

          Show
          Graeme Rocher added a comment - fixed with Aether dependency management in 2.3

            People

            • Assignee:
              Graeme Rocher
              Reporter:
              David Castro
            • Votes:
              17 Vote for this issue
              Watchers:
              18 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Last Reviewed:

                Development