Get XML parsing error on Ivy file after upgrading from gradle 1.7 to 1.10

(Don Henry) #1

Our dev team stores third party JAR’s in a local Ivy repository that has a custom layout.

I was using the ivy element below within the configuration for repositories instance:

ivy {
            name 'Old BPS Ivy Repository'
            url ''
            layout 'pattern', {
                artifact '[organisation]/[module]/prod/[type]s/[artifact]-[revision].[type]'
                ivy '[organisation]/[module]/prod/ivys/ivy-[revision].xml'

After upgrading gradle from 1.7 to 1.10, the build task was failing with the following error (no such problems with version 1.7):

> Could not resolve glassfish:common-util:3.0-b74b.
  Required by:
   > Could not parse Ivy file
      > xml parsing: ivy-3.0-b74b.xml:4:132: cvc-complex-type.3.2.2: Attribute 'env' is not allowed to appear in element 'info'. in

Here’s a snippet of the Ivy XML file that the above error concerns:

<?xml version="1.0" encoding="ISO-8859-1"?>
  <ivy-module version="1.3">
  <info organisation="glassfish" module="common-util" revision="3.0-b74b" status="release" env="prod" publication="20070101000000">
    <ivyauthor name="cnn"/>

After some searching I changed the ivy entry to:

add(new org.apache.ivy.plugins.resolver.URLResolver()) {
            name = 'Old BPS Ivy Repository'
            validate = false
            addIvyPattern '[organisation]/[module]/prod/ivys/ivy-[revision].xml'
            addArtifactPattern '[organisation]/[module]/prod/[type]s/[artifact]-[revision].[type]'

The validate setting was required to prevent the parsing error from occurring. If I didn’t include this flag, I got the same error I got with the original ivy entry.

I do get the following deprecated warning, which I can surely leave with for now.

Build file '/home/dohenry/bps_build/projects/mscore/build.gradle': line 36
The ArtifactRepositoryContainer.add(DependencyResolver, Closure) method has been deprecated and is scheduled to be removed in Gradle 2.0.

So my questions are: Is there a way to switch back to using the ivy entry and include this validate flag? Will we eventually have to abandon our custom Ivy repository?

(Don Henry) #2

Seems like this problem indicates that version 1.10 is not backward compatible. Should I not expect the ivy configuration that worked in version 1.7 to continue to work in version 1.10?

I would like to stay away from the add method because it is a deprecated method.