On Thu, Dec 11, 2014 at 12:18 PM, chengas123 <benjamin.j.mcc...@gmail.com>
wrote:
>
> Hi,
>
> I wanted to suggest making "layout" required when defining an Ivy
> repository
> for Gradle 3.0. The layout is the directory structure used to store
> artifacts. Ivy has a convention of using a certain directory structure
> layout and this layout can be specified by setting the layout to "ivy".
> Gradle by default uses its own non-standard directory layout structure.
> There's really no reason for this as far as I know except for legacy.
>
> The problem with the non-standard directory structure is that it's very
> unexpected and hurts interoperability. I would always expect the
> conventional directory layout to be used instead of a custom layout since
> this is what I've been trained to expect from other tools. The reason I
> discovered this issue is that I was trying to publish a library with Gradle
> for use in an SBT project. It took me nearly an entire day to make this
> work
> because of a few different issues, but this was one of the largest. It
> would
> have saved a tremendous amount time to know that Gradle had chosen it's own
> behavior instead of using the convention defined by Ivy and used by other
> tools that read Ivy repos such as Ant, Eclipse, and SBT. If this were being
> written from scratch I think we can probably all agree it makes sense to
> use
> the standard layout since using a custom layout has several drawbacks and
> no
> benefits. The reason I like Gradle over other build tools is that it's
> easier to use and defaults are a big part of ease-of-use. I'd love to save
> others from the hours of frustration I experienced debugging a bad default.
>
>
I'm not in favour of this change. I think Gradle has been around for long
enough now that any change from the current default layout will:
a) Cause pain to existing users when they have to change their build scripts
b) Not solve the problem, because Gradle will no longer work out of the box
with all of the existing Gradle-layout repositories out there.

I'd much rather solve this with better error messages and reporting. We
already do a reasonable job of this when resolution fails:

* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find org.gradle.sample:quickstart:1.1.
  Searched in the following locations:
      file:/Users/daz/repo/org.gradle.sample/quickstart/1.1/ivy-1.1.xml

file:/Users/daz/repo/org.gradle.sample/quickstart/1.1/quickstart-1.1.jar

But we could make better suggestions, possibly by exploring the repository
to see if we can determine the layout. (i.e. We could check Ivy default
locations and if 'ivy.xml' is found, suggest to the user that they use
`layout "ivy"`)

It would also be good to add similar reporting to the dependencies report,
because the above error doesn't aid in diagnosis if you are using a dynamic
version (1.+), and you're picking up an older version from JCentre instead
of a newer version from your repository (which is declared first).
If the dependencies report could show something like this, it might help:
   \--- org.gradle.sample:quickstart:1.+ -> 1.1
      Searched in the following locations:
          file:/Users/daz/repo/org.gradle.sample/quickstart/* []
          file:/some/other/repo/org.gradle.sample/quickstart/* [0.9, 1.0]
          https://jcenter.bintray.com/org/gradle/sample/quickstart/* [1.0,
1.1]

This sort of extra reporting might be best in the HTML dependencies report,
or maybe the dependencyInsight report.
-- 
Darrell (Daz) DeBoer
http://www.gradleware.com

Reply via email to