ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maarten Coene <maarten_co...@yahoo.com>
Subject Re: Programmatically resolving dependencies
Date Thu, 15 Oct 2009 21:26:39 GMT
Could you post a JIRA ticket for this circular dependency error, I think Ivy shouldn't fail
on this if maven accept it.
As far as I know, Ivy won't pick up the maven repositories inside the pom's, maybe you could
open an enhancement request for it as well?
And to answer your third question: the Ivy cache doesn't has a m2 repository layout which
means that for instance "org.rioproject" will be stored in ".ivy2/cache/org.rioproject" instead
of "ivy2/cache/org/rioproject". I think there is an open feature request for this.

Maarten




----- Original Message ----
From: dreedyman <dennis.reedy@gmail.com>
To: ivy-user@ant.apache.org
Sent: Thu, October 15, 2009 11:10:03 PM
Subject: Re: Programmatically resolving dependencies


Maarten,

Thanks, that and a few more changes certainly on my end got me a little
further. Ivy seems to have determined that there is a circular dependency
issue (where maven doesnt complain). I'll append the verbose output at the
end of my email.

If the passed in pom has references to maven repositories, will Ivy pick
them up when it reads the pom, or will I have to add them programmatically?
If the former, will the repository declarations be picked up if they are in
a pom's parent?

Also, is it at all possible (or recommended) that Ivy's local cache be the
same as the local Maven repository and overlay Ivy's metadata along side of
Maven's, or should the two be separate at all times?

Here's the output:

:: loading settings :: url =
jar:file:/Users/dreedy/.m2/repository/org/apache/ivy/ivy/2.1.0-rc2/ivy-2.1.0-rc2.jar!/org/apache/ivy/core/settings/ivysettings.xml
no default ivy user dir defined: set to /Users/dreedy/.ivy2
including url:
jar:file:/Users/dreedy/.m2/repository/org/apache/ivy/ivy/2.1.0-rc2/ivy-2.1.0-rc2.jar!/org/apache/ivy/core/settings/ivysettings-public.xml
no default cache defined: set to /Users/dreedy/.ivy2/cache
including url:
jar:file:/Users/dreedy/.m2/repository/org/apache/ivy/ivy/2.1.0-rc2/ivy-2.1.0-rc2.jar!/org/apache/ivy/core/settings/ivysettings-shared.xml
including url:
jar:file:/Users/dreedy/.m2/repository/org/apache/ivy/ivy/2.1.0-rc2/ivy-2.1.0-rc2.jar!/org/apache/ivy/core/settings/ivysettings-local.xml
including url:
jar:file:/Users/dreedy/.m2/repository/org/apache/ivy/ivy/2.1.0-rc2/ivy-2.1.0-rc2.jar!/org/apache/ivy/core/settings/ivysettings-main-chain.xml
including url:
jar:file:/Users/dreedy/.m2/repository/org/apache/ivy/ivy/2.1.0-rc2/ivy-2.1.0-rc2.jar!/org/apache/ivy/core/settings/ivysettings-default-chain.xml
settings loaded (95ms)
    default cache: /Users/dreedy/.ivy2/cache
    default resolver: default
    -- 5 resolvers:
    shared [file]
    default [chain] [local, main]
    local [file]
    public [ibiblio]
    main [chain] [shared, public]
==== Resolver: shared
==== Resolver: default
==== Resolver: local-maven-repo
==== Resolver: local
==== Resolver: public
==== Resolver: main
:: loading settings :: url =
jar:file:/Users/dreedy/.m2/repository/org/apache/ivy/ivy/2.1.0-rc2/ivy-2.1.0-rc2.jar!/org/apache/ivy/core/settings/ivysettings.xml
using pom parser to parse
file:/Users/dreedy/dev/src/rioproj/rio/branches/maven-work/examples/calculator/pom.xml
        tried
/Users/dreedy/.m2/repository/org/rioproject/examples/calculator/1.0/calculator-1.0.jar
        tried
/Users/dreedy/.m2/repository/org/rioproject/examples/calculator/1.0/calculator-1.0-sources.jar
        tried
/Users/dreedy/.m2/repository/org/rioproject/examples/calculator/1.0/calculator-1.0-javadoc.jar
:: resolving dependencies :: org.rioproject.examples#calculator;1.0
    confs: [default]
    validate = true
    refresh = false
resolving dependencies for configuration 'default'
== resolving dependencies for org.rioproject.examples#calculator;1.0
[default]
== resolving dependencies for org.rioproject.examples#calculator;1.0
[runtime]
== resolving dependencies for org.rioproject.examples#calculator;1.0
[compile]
== resolving dependencies
org.rioproject.examples#calculator;1.0->org.rioproject#rio;4.0-M3
[compile->master(*)]
        tried
/Users/dreedy/.m2/repository/org/rioproject/rio/4.0-M3/rio-4.0-M3.pom
    local-maven-repo: found md file for org.rioproject#rio;4.0-M3
        => /Users/dreedy/.m2/repository/org/rioproject/rio/4.0-M3/rio-4.0-M3.pom
(4.0-M3)
downloading
/Users/dreedy/.m2/repository/org/rioproject/rio/4.0-M3/rio-4.0-M3.pom ...
    local-maven-repo: downloading
/Users/dreedy/.m2/repository/org/rioproject/rio/4.0-M3/rio-4.0-M3.pom
    [SUCCESSFUL ] org.rioproject#rio;4.0-M3!rio.pom(pom.original) (10ms)
        tried
/Users/dreedy/.m2/repository/org/rioproject/main/4.0-M3/main-4.0-M3.pom
    local-maven-repo: found md file for org.rioproject#main;4.0-M3
        => /Users/dreedy/.m2/repository/org/rioproject/main/4.0-M3/main-4.0-M3.pom
(4.0-M3)
downloading
/Users/dreedy/.m2/repository/org/rioproject/main/4.0-M3/main-4.0-M3.pom ...
    local-maven-repo: downloading
/Users/dreedy/.m2/repository/org/rioproject/main/4.0-M3/main-4.0-M3.pom
    [SUCCESSFUL ] org.rioproject#main;4.0-M3!main.pom(pom.original) (1ms)
        tried
/Users/dreedy/.m2/repository/org/rioproject/main/4.0-M3/main-4.0-M3.jar
        tried
/Users/dreedy/.m2/repository/org/rioproject/rio/4.0-M3/rio-4.0-M3.jar
        tried
/Users/dreedy/.m2/repository/org/rioproject/rio/4.0-M3/rio-4.0-M3-sources.jar
        tried
/Users/dreedy/.m2/repository/org/rioproject/rio/4.0-M3/rio-4.0-M3-javadoc.jar
    found org.rioproject#rio;4.0-M3 in local-maven-repo
== resolving dependencies
org.rioproject.examples#calculator;1.0->org.rioproject#rio;4.0-M3
[compile->compile(*)]
== resolving dependencies
org.rioproject#rio;4.0-M3->org.rioproject#boot;4.0-M3 [compile->master(*)]
        tried
/Users/dreedy/.m2/repository/org/rioproject/boot/4.0-M3/boot-4.0-M3.pom
    local-maven-repo: found md file for org.rioproject#boot;4.0-M3
        => /Users/dreedy/.m2/repository/org/rioproject/boot/4.0-M3/boot-4.0-M3.pom
(4.0-M3)
downloading
/Users/dreedy/.m2/repository/org/rioproject/boot/4.0-M3/boot-4.0-M3.pom ...
    local-maven-repo: downloading
/Users/dreedy/.m2/repository/org/rioproject/boot/4.0-M3/boot-4.0-M3.pom
    [SUCCESSFUL ] org.rioproject#boot;4.0-M3!boot.pom(pom.original) (1ms)
    local-maven-repo: revision in cache: org.rioproject#main;4.0-M3
        tried
/Users/dreedy/.m2/repository/org/rioproject/boot/4.0-M3/boot-4.0-M3.jar
        tried
/Users/dreedy/.m2/repository/org/rioproject/boot/4.0-M3/boot-4.0-M3-sources.jar
        tried
/Users/dreedy/.m2/repository/org/rioproject/boot/4.0-M3/boot-4.0-M3-javadoc.jar
    found org.rioproject#boot;4.0-M3 in local-maven-repo
== resolving dependencies
org.rioproject#rio;4.0-M3->org.rioproject#boot;4.0-M3 [compile->compile(*)]
== resolving dependencies org.rioproject#boot;4.0-M3->net.jini#start;2.1
[compile->master(*)]
        tried /Users/dreedy/.m2/repository/net/jini/start/2.1/start-2.1.pom
    local-maven-repo: found md file for net.jini#start;2.1
        => /Users/dreedy/.m2/repository/net/jini/start/2.1/start-2.1.pom (2.1)
downloading /Users/dreedy/.m2/repository/net/jini/start/2.1/start-2.1.pom
...
    local-maven-repo: downloading
/Users/dreedy/.m2/repository/net/jini/start/2.1/start-2.1.pom
    local-maven-repo: downloading
/Users/dreedy/.m2/repository/net/jini/start/2.1/start-2.1.pom.sha1
sha1 OK for /Users/dreedy/.m2/repository/net/jini/start/2.1/start-2.1.pom
    [SUCCESSFUL ] net.jini#start;2.1!start.pom(pom.original) (65ms)
        tried /Users/dreedy/.m2/repository/net/jini/start/2.1/start-2.1.jar
        tried
/Users/dreedy/.m2/repository/net/jini/start/2.1/start-2.1-sources.jar
        tried
/Users/dreedy/.m2/repository/net/jini/start/2.1/start-2.1-javadoc.jar
    found net.jini#start;2.1 in local-maven-repo
== resolving dependencies org.rioproject#boot;4.0-M3->net.jini#start;2.1
[compile->compile(*)]
== resolving dependencies
org.rioproject#boot;4.0-M3->net.jini#jsk-platform;2.1 [compile->master(*)]
        tried
/Users/dreedy/.m2/repository/net/jini/jsk-platform/2.1/jsk-platform-2.1.pom
    local-maven-repo: found md file for net.jini#jsk-platform;2.1
        =>
/Users/dreedy/.m2/repository/net/jini/jsk-platform/2.1/jsk-platform-2.1.pom
(2.1)
downloading
/Users/dreedy/.m2/repository/net/jini/jsk-platform/2.1/jsk-platform-2.1.pom
...
    local-maven-repo: downloading
/Users/dreedy/.m2/repository/net/jini/jsk-platform/2.1/jsk-platform-2.1.pom
    local-maven-repo: downloading
/Users/dreedy/.m2/repository/net/jini/jsk-platform/2.1/jsk-platform-2.1.pom.sha1
sha1 OK for
/Users/dreedy/.m2/repository/net/jini/jsk-platform/2.1/jsk-platform-2.1.pom
    [SUCCESSFUL ] net.jini#jsk-platform;2.1!jsk-platform.pom(pom.original)
(2ms)
        tried
/Users/dreedy/.m2/repository/net/jini/jsk-platform/2.1/jsk-platform-2.1.jar
        tried
/Users/dreedy/.m2/repository/net/jini/jsk-platform/2.1/jsk-platform-2.1-sources.jar
        tried
/Users/dreedy/.m2/repository/net/jini/jsk-platform/2.1/jsk-platform-2.1-javadoc.jar
    found net.jini#jsk-platform;2.1 in local-maven-repo
== resolving dependencies
org.rioproject#boot;4.0-M3->net.jini#jsk-platform;2.1 [compile->compile(*)]
ERROR: a module is not authorized to depend on itself:
net.jini#jsk-platform;2.1

:: problems summary ::
:::: ERRORS
    a module is not authorized to depend on itself: net.jini#jsk-platform;2.1







Maarten Coene wrote:
> 
> It's hard to tell what's going wrong, but maybe you could try to configure
> Ivy to use your "local-maven-repo" as default resolver?
> settings.setDefaultResolver("local-maven-repo");
> 
> Maarten
> 
> 
> 
> 
> ----- Original Message ----
> From: dreedyman <dennis.reedy@gmail.com>
> To: ivy-user@ant.apache.org
> Sent: Thu, October 15, 2009 10:37:20 PM
> Subject: Programmatically resolving dependencies
> 
> 
> Hi,
> 
> I am starting to use Ivy as part of an infrastructure that will be
> provisioning software services in runtime. Services will be identified by
> an
> artifact id (groupId:artifactId[:classifier]:version) and be resolved in
> order to instantiate them.
> 
> I started trying to use the maven-embedder but became quite shocked to see
> the number of dependencies required to resolve transitive dependencies. I
> really like the simplicity the Ivy project offers, and would like to see
> if
> I cant get past some initial hurdles. I am sure I have placed these
> hurdles
> in fromt of me, since I know I'm not doing something correctly. I'm hoping
> that someone can point to what I'm doing wrong. 
> 
> (One important aspect of work is I need to obtain the classpath of
> resolved
> artifacts, and have chosen to go the programmatic route as opposed to
> using
> Ant.)
> 
> My simple first steps involved creating the Ivy environment and trying to
> resolve from the local maven repository. My assumption is that I can use a
> Maven pom file directly, and not set up ivy.xml. 
> 
> File pom = // a provided maven pom
> 
> // Create a FileSystemResolver pointing to the local maven repository
> FileSystemResolver fsResolver = new FileSystemResolver()
> fsResolver.name = "local-maven-repo"
> fsResolver.m2compatible = true
> fsResolver.local = true
> fsResolver.addArtifactPattern(
> "${System.getProperty("user.home")}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).jar")
> fsResolver.addIvyPattern(
> "${System.getProperty("user.home")}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).pom")
> 
> settings.addResolver fsResolver
> 
> Ivy ivy = Ivy.newInstance(settings)
> ivy.getLoggerEngine().pushLogger(new
> DefaultMessageLogger(Message.MSG_VERBOSE));
> 
> for(String s : ivy.settings.getResolverNames())
>     println "==== Resolver: ${s}"
>        
> DefaultModuleDescriptor md =
>     DefaultModuleDescriptor.newDefaultInstance(
>         ModuleRevisionId.newInstance(art.groupId,
>                                      art.artifactId + "-caller",
>                                      "working"))
> DefaultDependencyDescriptor dd =
>     new DefaultDependencyDescriptor(md,
>                                  
> ModuleRevisionId.newInstance(art.groupId,
>                                                                
> art.artifactId,
>                                                                
> art.version),
>                                     false,
>                                     false,
>                                     true);
> md.addDependency(dd);
> def confs = ["default"]
> ResolveOptions resolveOptions = new ResolveOptions().setConfs(confs as
> String[]);
> ResolveReport report = ivy.resolve(ivyFile.toURL(), resolveOptions);
> for(ArtifactDownloadReport dlReport : report.allArtifactsReports) {
>     File f = dlReport.localFile
>     if(f!=null) {
>         if(classPath.length()>0)
>             classPath.append(File.pathSeparator)
>         classPath.append(f.path)
>     }
> }
> 
> I am passing in an artifact that has a defined dependency that needs to be
> resolved transitively. Ivy doesnt seem to be able to resolve the
> dependency:
> 
> ==== Resolver: local-maven-repo
> :: loading settings :: url =
> jar:file:/Users/dreedy/.m2/repository/org/apache/ivy/ivy/2.1.0-rc2/ivy-2.1.0-rc2.jar!/org/apache/ivy/core/settings/ivysettings.xml
> using pom parser to parse
> file:/Users/dreedy/dev/src/rioproj/rio/branches/maven-work/examples/calculator/pom.xml
> ERROR: unknown resolver null
> :: resolving dependencies :: org.rioproject.examples#calculator;1.0
>     confs: [default]
>     validate = true
>     refresh = false
> resolving dependencies for configuration 'default'
> == resolving dependencies for org.rioproject.examples#calculator;1.0
> [default]
> == resolving dependencies for org.rioproject.examples#calculator;1.0
> [runtime]
> == resolving dependencies for org.rioproject.examples#calculator;1.0
> [compile]
> == resolving dependencies
> org.rioproject.examples#calculator;1.0->org.rioproject#rio;4.0-M3
> [compile->master(*)]
> ERROR: unknown resolver null
> ERROR: no resolver found for org.rioproject#rio: check your configuration
> == resolving dependencies
> org.rioproject.examples#calculator;1.0->org.rioproject#rio;4.0-M3
> [compile->compile(*)]
> == resolving dependencies
> org.rioproject.examples#calculator;1.0->org.rioproject#rio;4.0-M3
> [runtime->runtime(*)]
> == resolving dependencies for org.rioproject.examples#calculator;1.0
> [master]
> no default ivy user dir defined: set to /Users/dreedy/.ivy2
> no default cache defined: set to /Users/dreedy/.ivy2/cache
>     resolved ivy file produced in
> /Users/dreedy/.ivy2/cache/resolved-org.rioproject.examples-calculator-1.0.xml
> :: downloading artifacts ::
> :: resolution report :: resolve 35ms :: artifacts dl 1ms
>     :: modules in use:
>     ---------------------------------------------------------------------
>     |                  |            modules            ||   artifacts   |
>     |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
>     ---------------------------------------------------------------------
>     |      default     |   1   |   0   |   0   |   0   ||   0   |   0   |
>     ---------------------------------------------------------------------
> WARN:     ::::::::::::::::::::::::::::::::::::::::::::::
> WARN:     ::          UNRESOLVED DEPENDENCIES         ::
> WARN:     ::::::::::::::::::::::::::::::::::::::::::::::
> WARN:     :: org.rioproject#rio;4.0-M3: no resolver found for
> org.rioproject#rio: check your configuration
> WARN:     ::::::::::::::::::::::::::::::::::::::::::::::
> 
>     report for org.rioproject.examples#calculator;1.0 default produced in
> /Users/dreedy/.ivy2/cache/org.rioproject.examples-calculator-default.xml
>     resolve done (35ms resolve - 1ms download)
> 
> :: problems summary ::
> :::: WARNINGS
>         ::::::::::::::::::::::::::::::::::::::::::::::
> 
>         ::          UNRESOLVED DEPENDENCIES         ::
> 
>         ::::::::::::::::::::::::::::::::::::::::::::::
> 
>         :: org.rioproject#rio;4.0-M3: no resolver found for
> org.rioproject#rio:
> check your configuration
> 
>         ::::::::::::::::::::::::::::::::::::::::::::::
> 
> 
> :::: ERRORS
>     unknown resolver null
> 
>     unknown resolver null
> 
>     no resolver found for org.rioproject#rio: check your configuration
> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Programmatically-resolving-dependencies-tp25915616p25915616.html
> Sent from the ivy-user mailing list archive at Nabble.com.
> 
> 
>      
> 
> 

-- 
View this message in context: http://www.nabble.com/Programmatically-resolving-dependencies-tp25915616p25916078.html
Sent from the ivy-user mailing list archive at Nabble.com.


      

Mime
View raw message