dependencies - Custom Ivy Resolver throws NullPointer Exception in Grails -
i had following custom resolver defined in repositories{...}
block of buildconfig.groovy file jars needed use jai in grails project.
mavenrepo "http://www.mygrid.org.uk/maven/repository" def jbossresolver = new org.apache.ivy.plugins.resolver.urlresolver() jbossresolver.addartifactpattern("https://repository.jboss.org/nexus/content/groups/public-jboss/com/sun/media/[module]/[revision]/[artifact]-[revision].[ext]") jbossresolver.addartifactpattern("https://repository.jboss.org/nexus/content/groups/public-jboss/javax/media/[module]/[revision]/[artifact]-[revision].[ext]") jbossresolver.setname("awesomestjbossresolverever") resolver jbossresolver
however, whenever run grails refresh-dependencies
, error:
compile ( "net.java.dev.jai-imageio:jai-imageio-core-standalone:1.2-pre-dr-b04-2013-04-23", "javax.media:jai-core:1.1.3", "com.sun.media:jai-codec:1.1.3" )
the jai-imageio-core-standalone resolved fine http://www.mygrid.org.uk/maven/repository location, jai-core , jai-codec files kept throwing error:
| error failed resolve dependencies (set log level 'warn' in buildconfig.groovy more information): - javax.media:jai-core:1.1.3 - com.sun.media:jai-codec:1.1.3
with verbose logging, found error:
tried https://repository.jboss.org/nexus/content/groups/public-jboss/com/sun/media/jai-codec/1.1.3/jai-codec-1.1.3.jar null: no ivy file found com.sun.media#jai-codec;1.1.3: using default data problem occurred while resolving dependency: com.sun.media#jai-codec;1.1.3 {compile=[default]} null: java.lang.nullpointerexception @ java.util.hashtable.put(hashtable.java:394) @ java.util.properties.setproperty(properties.java:143) @ org.apache.ivy.core.cache.defaultrepositorycachemanager.saveresolvers(defaultrepositorycachemanager.java:422) @ org.apache.ivy.core.cache.defaultrepositorycachemanager.originaltocachedmoduledescriptor(defaultrepositorycachemanager.java:875) ......long stack trace here......... @ java.lang.reflect.method.invoke(method.java:597) @ org.codehaus.groovy.grails.cli.support.grailsstarter.rootloader(grailsstarter.java:234) @ org.codehaus.groovy.grails.cli.support.grailsstarter.main(grailsstarter.java:262)
after reviewing ivy resolver documentation , defaultrepositorycachemanager's saveresolver() method
the problem, discovered, custom jboss resolver needed name. changed part of repositories
block read:
def jbossresolver = new org.apache.ivy.plugins.resolver.urlresolver() jbossresolver.addartifactpattern("https://repository.jboss.org/nexus/content/groups/public-jboss/com/sun/media/[module]/[revision]/[artifact]-[revision].[ext]") jbossresolver.addartifactpattern("https://repository.jboss.org/nexus/content/groups/public-jboss/javax/media/[module]/[revision]/[artifact]-[revision].[ext]") jbossresolver.setname("awesomestjbossresolverever") resolver jbossresolver
adding name setname method took rid of nullpointer exception.
notably, more careful reading of grails documentation have grails documentation section on custom resolvers have hinted @ problem, custom urlresolver specifies name , settings property. lfmf
Comments
Post a Comment