[
https://issues.apache.org/jira/browse/IVY-1649?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maarten Coene reassigned IVY-1649:
----------------------------------
Assignee: Maarten Coene
> Caching is broken when using ibiblio resolver with usepoms="false" or url
> resolver in combination with classifiers
> ------------------------------------------------------------------------------------------------------------------
>
> Key: IVY-1649
> URL: https://issues.apache.org/jira/browse/IVY-1649
> Project: Ivy
> Issue Type: Bug
> Affects Versions: 2.5.2
> Reporter: Moritz Baumann
> Assignee: Maarten Coene
> Priority: Major
> Time Spent: 50m
> Remaining Estimate: 0h
>
> I'm trying to use Ivy as a standalone tool from a custom build system. One of
> my use cases requires me to download certain artifacts from Maven
> repositories *without* performing dependency resolution. To avoid any
> unnecessary HTTP traffic, I tried using a settings file similar to the
> following:
> {code:xml}
> <ivysettings>
> <resolvers>
> <ibiblio name="maven2" m2compatible="true" usepoms="false"
> root="https://repo1.maven.org/maven2/"/>
> </resolvers>
> <settings defaultResolver="maven2"/>
> </ivysettings>
> {code}
> Let's assume a simple ivy.xml:
> {code:xml}
> <ivy-module version="2.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
> xmlns:m="http://ant.apache.org/ivy/maven">
> <info module="demo" organisation="mb-sc"/>
> <dependencies>
> <dependency org="junit" name="junit" rev="4.13.2" transitive="false">
> <artifact name="junit" m:classifier="javadoc"/>
> </dependency>
> </dependencies>
> </ivy-module>
> {code}
> The first execution of ivy looks okay, but subsequent invocations still
> access the repository:
> {noformat}
> ❯ java -jar apache-ivy-2.5.2/ivy-2.5.2.jar -settings ivysettings.xml
> :: loading settings :: file = /home/mb-sc/ivy-test/ivysettings.xml
> :: resolving dependencies :: mb-sc#demo;working@W-GNV1FB3
> confs: [default]
> found junit#junit;4.13.2 in maven2
> downloading
> https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2-javadoc.jar ...
> .........................................................................................................
> (1635kB)
> .. (0kB)
> [SUCCESSFUL ] junit#junit;4.13.2!junit.jar (305ms)
> :: resolution report :: resolve 554ms :: artifacts dl 306ms
> ---------------------------------------------------------------------
> | | modules || artifacts |
> | conf | number| search|dwnlded|evicted|| number|dwnlded|
> ---------------------------------------------------------------------
> | default | 1 | 1 | 0 | 0 || 1 | 1 |
> ---------------------------------------------------------------------
> ❯ java -jar apache-ivy-2.5.2/ivy-2.5.2.jar -settings ivysettings.xml
> :: loading settings :: file = /home/mb-sc/ivy-test/ivysettings.xml
> :: resolving dependencies :: mb-sc#demo;working@W-GNV1FB3
> confs: [default]
> found junit#junit;4.13.2 in maven2
> :: resolution report :: resolve 337ms :: artifacts dl 3ms
> ---------------------------------------------------------------------
> | | modules || artifacts |
> | conf | number| search|dwnlded|evicted|| number|dwnlded|
> ---------------------------------------------------------------------
> | default | 1 | 1 | 0 | 0 || 1 | 0 |
>
> ---------------------------------------------------------------------{noformat}
> Without internet access (offline build), dependency resolution fails despite
> all dependencies being in the cache, and running ivy with debug messages
> enabled reveals the culprit:
> {noformat}
> ❯ java -jar apache-ivy-2.5.2/ivy-2.5.2.jar -settings ivysettings.xml -debug
> […]
> No entry is found in the ModuleDescriptorCache :
> /home/mb-sc/.ivy2/cache/junit/junit/ivy-4.13.2.xml
> post 1.3 ivy file: using exact as default matcher
> problem while parsing cached ivy file for: junit#junit;4.13.2
> (java.text.ParseException: [xml parsing: ivy-4.13.2.xml:14:84:
> cvc-complex-type.3.2.2: Attribute 'classifier' is not allowed to appear in
> element 'artifact'. in file:/home/mb-sc/.ivy2/cache/junit/junit/ivy-4.13.2.xml
> ])
> java.text.ParseException: [xml parsing: ivy-4.13.2.xml:14:84:
> cvc-complex-type.3.2.2: Attribute 'classifier' is not allowed to appear in
> element 'artifact'. in file:/home/mb-sc/.ivy2/cache/junit/junit/ivy-4.13.2.xml
> ]
> at
> org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser$AbstractParser.checkErrors(AbstractModuleDescriptorParser.java:90)
> at
> org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser$AbstractParser.getModuleDescriptor(AbstractModuleDescriptorParser.java:343)
> at
> org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser$Parser.getModuleDescriptor(XmlModuleDescriptorParser.java:189)
> at
> org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser.parseDescriptor(XmlModuleDescriptorParser.java:129)
> at
> org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser.parseDescriptor(AbstractModuleDescriptorParser.java:50)
> at
> org.apache.ivy.core.cache.DefaultRepositoryCacheManager$MyModuleDescriptorProvider.provideModule(DefaultRepositoryCacheManager.java:846)
> at
> org.apache.ivy.core.cache.ModuleDescriptorMemoryCache.getStale(ModuleDescriptorMemoryCache.java:68)
> at
> org.apache.ivy.core.cache.ModuleDescriptorMemoryCache.get(ModuleDescriptorMemoryCache.java:57)
> at
> org.apache.ivy.core.cache.DefaultRepositoryCacheManager.getMdFromCache(DefaultRepositoryCacheManager.java:854)
> at
> org.apache.ivy.core.cache.DefaultRepositoryCacheManager.doFindModuleInCache(DefaultRepositoryCacheManager.java:756)
> at
> org.apache.ivy.core.cache.DefaultRepositoryCacheManager.findModuleInCache(DefaultRepositoryCacheManager.java:715)
> at
> org.apache.ivy.plugins.resolver.AbstractResolver.findModuleInCache(AbstractResolver.java:369)
> at
> org.apache.ivy.plugins.resolver.AbstractResolver.findModuleInCache(AbstractResolver.java:364)
> at
> org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:211)
> at
> org.apache.ivy.plugins.resolver.IBiblioResolver.getDependency(IBiblioResolver.java:557)
> at org.apache.ivy.core.resolve.IvyNode.loadData(IvyNode.java:192)
> at org.apache.ivy.core.resolve.VisitNode.loadData(VisitNode.java:284)
> at
> org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:722)
> at
> org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(ResolveEngine.java:801)
> at
> org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:729)
> at
> org.apache.ivy.core.resolve.ResolveEngine.getDependencies(ResolveEngine.java:607)
> at
> org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:250)
> at
> org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:206)
> at org.apache.ivy.Ivy.resolve(Ivy.java:507)
> at org.apache.ivy.Main.run(Main.java:363)
> at org.apache.ivy.Main.run(Main.java:284)
> at org.apache.ivy.Main.main(Main.java:233)
> […]
> {noformat}
> Replacing the ibiblio resolver with an equivalent url resolver or using the
> [http://ant.apache.org/ivy/extra] namespace for the classifier attribute
> doesn't make any difference. In either case, the generated Ivy file in the
> cache is rejected as invalid on subsequent invocations.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)