[GRADLE-2928] Gradle does not handle repositories where directory listings are XML Created: 22/Oct/13  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Won't Fix Votes: 0


 Description   

Hello,
I'm on Gradle 1.8 and I have a local Ivy repository and one in SVN. Prior to upgrade to Gradle 1.8, I was using the add(FileSystemResolver) and add(SvnResolver) respectively.

After seeing the deprecated warnings for add, I've attempted to use the ivy DSL, however, for the Ivy via svn repository, I'm seeing this error:

A problem occurred evaluating root project 'myproject-ws-trunk'.
> Could not resolve all dependencies for configuration ':compileCopy'.
> Could not resolve com.mycompany:my-api:5.2.+.
Required by:
com.mycompany:myproject-ws-trunk:unspecified
> Could not list versions using Ivy pattern 'https://<mysvnrepository>/svn/ctsvn/ivy/repository/[organisation]/[module]/[revision]/ivy.xml'.
> Unable to parse Http directory listing
> Unsupported ContentType text/xml for DirectoryListing

The build.gradle snippet is:

ivy {
name "local"
ivyPattern "${USER_HOME}/.build/local/[organisation]/[module]/[revision]/ivy.xml"
artifactPattern "${USER_HOME}/.build/local/[organisation]/[module]/[revision]/[artifact]([classifier])[revision].[ext]"
}
ivy {
name "ivysvn"
url "https://<mysvnrepository>/svn/ctsvn/ivy/repository"
layout "pattern", {
ivy "[organisation]/[module]/[revision]/ivy.xml"
artifact "[organisation]/[module]/[revision]/[artifact]([classifier])[revision].[ext]"
}
credentials {
username 'jsmith'
password 'mypassword'
}
}

Web server and svn details:
Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 DAV/2 SVN/1.6.16 PHP/5.3.3

The stack trace is:

Caused by: org.gradle.api.internal.resource.ResourceException: Could not list versions using Ivy pattern 'https://<mysvnrepository>/svn/ctsvn/ivy/repository/[organisation]/[module]/[revision]/ivy.xml'.
at org.gradle.api.internal.artifacts.repositories.resolver.ResourceVersionLister$1.visit(ResourceVersionLister.java:60)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.listVersionsForAllPatterns(ExternalResourceResolver.java:316)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.findDynamicResourceUsingPatterns(ExternalResourceResolver.java:307)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.findResourceUsingPatterns(ExternalResourceResolver.java:283)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.findIvyFileRef(ExternalResourceResolver.java:254)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.getDependency(ExternalResourceResolver.java:155)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.getDependency(ExternalResourceResolver.java:148)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CacheLockingModuleVersionRepository$1.run(CacheLockingModuleVersionRepository.java:45)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:214)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:276)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:142)
at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.longRunningOperation(DefaultCacheLockingManager.java:50)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CacheLockingModuleVersionRepository.getDependency(CacheLockingModuleVersionRepository.java:43)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleVersionRepository.getDependency(CachingModuleVersionRepository.java:87)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.memcache.CachedRepository.getDependency(CachedRepository.java:54)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain$RepositoryResolveState.resolve(UserResolverChain.java:183)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.findLatestModule(UserResolverChain.java:97)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.findLatestModule(UserResolverChain.java:80)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.resolve(UserResolverChain.java:55)
... 95 more
Caused by: org.gradle.api.internal.resource.ResourceException: Unable to parse Http directory listing
at org.gradle.api.internal.externalresource.transport.http.HttpResourceLister$1.transform(HttpResourceLister.java:57)
at org.gradle.api.internal.externalresource.transport.http.HttpResourceLister$1.transform(HttpResourceLister.java:49)
at org.gradle.api.internal.externalresource.AbstractExternalResource.withContent(AbstractExternalResource.java:60)
at org.gradle.api.internal.externalresource.transport.http.HttpResourceLister.list(HttpResourceLister.java:49)
at org.gradle.api.internal.externalresource.transport.DefaultExternalResourceRepository.list(DefaultExternalResourceRepository.java:119)
at org.gradle.api.internal.artifacts.repositories.resolver.ResourceVersionLister$1.listAll(ResourceVersionLister.java:145)
at org.gradle.api.internal.artifacts.repositories.resolver.ResourceVersionLister$1.listRevisionToken(ResourceVersionLister.java:73)
at org.gradle.api.internal.artifacts.repositories.resolver.ResourceVersionLister$1.visit(ResourceVersionLister.java:53)
... 114 more
Caused by: org.gradle.api.internal.resource.ResourceException: Unsupported ContentType text/xml for DirectoryListing
at org.gradle.api.internal.externalresource.transport.http.ApacheDirectoryListingParser.parse(ApacheDirectoryListingParser.java:45)
at org.gradle.api.internal.externalresource.transport.http.HttpResourceLister$1.transform(HttpResourceLister.java:54)
... 121 more

Any help would be appreciated.



 Comments   
Comment by Gradle Forums [ 22/Oct/13 ]

I did a GET on the URL and the content is indeed XML.

And through an XSL stylesheet, the content is made pretty.

So, one option is to ask the administrators to change the Apache listing option to HTML instead of XML.

Though given that it's a possibility that web servers could be configured this way, is there any existing support for Gradle Ivy for this?

Comment by Gradle Forums [ 22/Oct/13 ]

There's no existing support for this, but we'd be open to a patch for this support: would you be interested in working on a fix?

We'd probably need to update `org.gradle.api.internal.externalresource.transport.http.HttpResourceLister` to detect the content type and handle XML.

As well as this, we'd want to add some integration test coverage by adding functionality to send XML directory listing to `org.gradle.test.fixtures.server.http.HttpServer`, and by adding another test case to `org.gradle.integtests.resolve.ivy.IvyDynamicRevisionRemoteResolveIntegrationTest` that tests with XML directory listings.

Comment by Naresh Baliga [ 24/Oct/13 ]

Tested a change made to ApacheDirectoryListingParser.java to handle XML directory listing.

Extended AnchorListerHandler and overrode startElement to react to "dir" qName and pick up "href" attributes.

Works for Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 DAV/2 SVN/1.6.16 PHP/5.3.3.

Is there any schema adopted by web servers for directory listings in XML?

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:35:14 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.