ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavel Sher <Pavel.S...@jetbrains.com>
Subject confusing artifacts retrieving
Date Wed, 19 Mar 2008 12:17:25 GMT
Hello,

Is it possible to setup Ivy to not create the full artifact
directories structure during retrieve process? For example, I have the
following ivy.xml in the repository:

<ivy-module version="1.4">
  <info organisation="xxx" module="yyy" revision="1.1"/>
  <publications>
    <artifact name="file1" type="txt" ext="txt"/>
    <artifact name="dir1/file2" type="txt" ext="txt"/>
    <artifact name="dir1/dir2/file3" type="txt" ext="txt"/>
  </publications>
</ivy-module>
  
Suppose I want to retrieve all *.txt files and put then into the "dest"
directory without subfolders. I tried the following ivy.xml on the
client side: 

<ivy-module version="1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd">
  <info organisation="xxx" module="yyy"/>
  <dependencies>
    <dependency org="xxx" name="yyy" rev="1.1">
      <include name="*.txt" ext="txt" matcher="glob"/>
    </dependency>
  </dependencies>
</ivy-module>

I used Ant retrieve task and as destination pattern I used:
dest/[artifact].[ext]

But in this case retrieve task creates the following structure:
dest/file1.txt
dest/dir1/file2.txt
dest/dir1/dir2/file3.txt

while I hoped to get this:
dest/file1.txt
dest/file2.txt
dest/file3.txt

For me such behavior looks unnatural because in include rule I
specified "*.txt" and then asked to put matched files to the "dest"
directory (*.txt => dest). And I do not expect subfolders to be
created in this case (I would expect them to be created if pattern
looks like: */*.txt).

I know that I can use [originalname] keyword in the destination
pattern, and in this case it will help, but there are more complicated
use cases when this approach will not work.

For example suppose I am using the following include rule:
<include name="dir1/*/file3.txt" ext="txt" matcher="glob"/>

Or in simpler form: dir1/*/file3.txt => dest/[artifact].[ext]
In this case I expect the following structure:
dest/dir2/file3.txt

But I'll get this:
dest/dir1/dir2/file3.txt

While in my opinion such directory structure should be created if I am
using another pattern: */file3.txt. Because I expect that if pattern
starts with explicitly specified part of a path then this part should
be omitted in the destination directory and if I really need it I will
add it to the destination path pattern.

So the question is: is it possible to make Ivy retrieve artifacts in
this way? I agree to customize it via some plugins since I am already
using it programmatically.

P.S:
Since Ivy is so highly integrated with Ant I hope that in the future
Ivy will support Ant like pattern matching which proved to be very
useful.


-- 
Pavel Sher
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


Mime
View raw message