Can't Use Absolute Path for installDist

I’m trying to use installDist to dump a runnable build to a network drive and every time I give it into 'file:// ... it tries to append that path to the project path. I have tried to overwrite destinationDir property, but it seems it’s missing or has been removed?

distributions.main {
    contents {
        into 'file://C:\\Users\\etc\\etc\\etc'
    }
}

Results in:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':subproject:installDist'.
> Could not normalize path for file 'C:\path\to\workspace\and\project\src\submodule\build\install\subproject\C:'.

I believe all strings are treated as relative paths. You could try something like this:

into(new File('C:\\Users\\etc\\etc\\etc'))

Actually, the syntax I was using was just fine for a custom Copy or
Sync type task. I remember reading that contents{} closures had the
same methods as a Copy type task, but apparently they aren’t quite the
same?

It should work the same. In the end this CopySpec is just being passed to a regular archive task.

Anyone look into this? I’m pretty sure it is a bug of some kind …

It’s not been fixed for 7 years???

  1. There is nothing to fix on the Gradle side. The contents { ... } is a copy spec, yes, furthermore it also is just used as a child copy spec. If you want to define a destination directory, you do that on the respective task. You cannot use an arbitrary destination in a child copy spec.

  2. Whether something changed or not you cannot tell from this thread. This is a community forum where mainly users talk with users, not the bug tracker. :wink: