Author Login
Post Reply
I guess I could try convert the value of the property, but I'd rather not.
Yes, all build artifacts are actually in a jar file. Its basically, a
customized version of http://antinstaller.sourceforge.net/.
I am still thinking that creating my own custom task would be helpful,
just cant figure out how to added a fileset to the project class.
Scot P. Floess wrote:
> I see...
>
> Have you considered using escape characters where the spaces are in
> the property?
>
> So, curious, you are using build.xml's in a jar file?
>
> Or, do you extract from the jar file and then use those files?
>
> Jeremy Weber wrote:
>> Sure does, filelist accepts a set of files delimited by a space...
>> So when a path has a space it doesnt behave. Have used ant-contrib
>> plenty of times in the past, buts that not an option. The kicker is
>> this isnt a normal ant environment, but actually all the build files,
>> etc are in a jar when they are executed. Although I havent tried
>> ant-contrib, this environment causes problems with similiar tasks
>> ant-call, ant, etc.
>>
>> Scot P. Floess wrote:
>>> OK I think I see the problem. It breaks down due to the space?
>>>
>>> Have you looked at Ant Contrib?
>>>
>>> They have a <for> task that may help you. It uses delimiters - in
>>> this case you can define the delimiter as a comma. You might also
>>> want to define in a macrodef (sorry I am a huge huge fan of
>>> macrodefs)...
>>>
>>> <macrodef name="copy-files" description = "Will copy files contained
>>> in @{property} to dir @{to-dir} storing all the files in ref id @{id}">
>>> <attribute name="property" description="Property that contains
>>> all files to copy"/>
>>> <attribute name="id" description="Path id reference once files
>>> copied"/>
>>> <attribute name="to-dir" description="Directory to copy files"/>
>>> <attribute name="delim" default="," description = "Delimiter used
>>> in @{property}"/>
>>>
>>> <sequence>
>>> <mkdir dir="@(protected)}"/>
>>>
>>> <for list="${@(protected)}">
>>> <sequential>
>>> <copy file = "@(protected)}"/>
>>> </sequential>
>>> </for>
>>>
>>> <path id="@(protected)}">
>>> <fileset dir="@(protected)}"/>
>>> </path>
>>> </sequence>
>>> </macrodef>
>>>
>>> Keep in mind, I just whipped this out ;)
>>>
>>> To use:
>>>
>>> <property name="jdbc.jar" value="C:\Documents and
>>> Settings\jweber\Desktop\db2_test\db2jcc.jar,C:\Documents and
>>> Settings\jweber\Desktop\db2_test\db2jcc_license_cu.jar"/>
>>>
>>> <copy-files property="jdbc.jar" id = "copied.files" to-dir =
>>> "new-directory"/>
>>>
>>> Note that property attribute simply lists the property name...not
>>> using the dollar notation as that is taken care of in the <for> task
>>> via ${@(protected)}}
>>>
>>> HTH,
>>>
>>> Flossy
>>>
>>>
>>> Jeremy Weber wrote:
>>>> Not sure that accomplishes what I need to do. The problem I wish
>>>> to solve is this:
>>>>
>>>> I have a property that equates to this:
>>>>
>>>> <property name="jdbc.jar" value="C:\Documents and
>>>> Settings\jweber\Desktop\db2_test\db2jcc.jar,C:\Documents and
>>>> Settings\jweber\Desktop\db2_test\db2jcc_license_cu.jar"/>
>>>>
>>>> The value of this property is variable.
>>>>
>>>> I then have a couple of tasks that perform the following:
>>>>
>>>> <!-- use filelist to copy the files to a temp dir so we can
>>>> build a fileset -->
>>>> <copy toDir=".tmp_cp" overwrite="true" failonerror="false">
>>>> <filelist files="${jdbc.jar}" />
>>>> <flattenmapper/>
>>>> </copy>
>>>>
>>>> <!-- create a referencable path object to be used in sql task -->
>>>> <path id="sql.cp">
>>>> <fileset dir=".tmp_cp"/>
>>>> </path>*
>>>> *
>>>> This all works great (although not so straight forward), until
>>>> there is a space in one of the paths in jdbc.jar property. If you
>>>> have another approach I'd be willing to try but I dont think your
>>>> suggest will work for this.
>>>> *
>>>>
>>>>
>>>> *
>>>>
>>>> Scot P. Floess wrote:
>>>>> Have you considered using a macrodef and elements?
>>>>>
>>>>> Maybe something like:
>>>>>
>>>>> <macrodef name="my-macro">
>>>>> <attribute name="id"/>
>>>>> <element name="includes"/>
>>>>> <sequential>
>>>>> <path id="@(protected)}">
>>>>> <includes/>
>>>>> </path>
>>>>> </sequential>
>>>>> </macrodef>
>>>>>
>>>>> Then you can supply whatever you want in <includes> as long as it
>>>>> adheres to <path> allowances....
>>>>>
>>>>> Jeremy Weber wrote:
>>>>>> Hi All,
>>>>>>
>>>>>> I have created dozen of custom tasks before, but find myself
>>>>>> struggling with this one. I wish to create a task that does the
>>>>>> following:
>>>>>>
>>>>>> 1. Accepts a file attribute to represent the absolute path of a
>>>>>> file contains comma separated absolute paths.
>>>>>> a. this file name will be read in, parsed and each file found
>>>>>> will be added to a fileset object, which in term is added to a
>>>>>> resources object.
>>>>>> 2. Accepts a id property
>>>>>> a. this id will be the id of the resource created in step 1a.
>>>>>>
>>>>>> So essentially I want...
>>>>>>
>>>>>> <csvtofileset file="csv.file.name" id="some.id.name">
>>>>>>
>>>>>> I am unclear on how to add the fileset i create in my code to the
>>>>>> project. Additionally I am unsure of how to assign this an 'id'
>>>>>> that I can reference elsewhere. Basically what I want to be able
>>>>>> to do is create a collection of files on the fly which I can
>>>>>> reference on the fly. Essentially in the following snippet, the
>>>>>> resources element would be replaced by my new task element
>>>>>>
>>>>>> <project name="test" basedir="." default="test">
>>>>>>
>>>>>> <!-- old -->
>>>>>> <resources id="fsd">
>>>>>> <fileset file="c:\temp\db2_test\db2jcc.jar" />
>>>>>> <fileset file="c:\temp\db2_test\db2jcc_license_cu.jar" />
>>>>>> </resources>
>>>>>> <!-- old -->
>>>>>>
>>>>>> <!-- new -->
>>>>>> <csvtofileset file="csv.file.name" id="fsd">
>>>>>> <!-- new -->
>>>>>>
>>>>>> <target name="test">
>>>>>> <copy toDir="c:\temp\ failonerror="true">
>>>>>> <resources refid="fsd"/>
>>>>>> </copy>
>>>>>> </target>
>>>>>> </project>
>>>>>>
>>>>>>
>>>>>> Any help at all would be appreciated.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>>
>>>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>>>> For additional commands, e-mail: user-help@(protected)
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
--
Jeremy Weber
Quality Assurance Manager
Active Endpoints, Inc.
(203)929-9400
jeremy.weber@(protected)
http://www.active-endpoints.com
"Smart SOA Orchestration Powered by ActiveBPEL"
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)