Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4625836
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:19:49+00:00 2026-05-22T03:19:49+00:00

I want to call the <proguard> task in Ant and need to pass it

  • 0

I want to call the <proguard> task in Ant and need to pass it the paths to various JAR files, e.g. the equivalent of:

<proguard>
   -injars /some/path/jar1;/some other path/jar2
</proguard>

Problem is, some of these path may contain spaces or special characters, they have to be quoted like this as explained in the proguard manual:

<proguard>
  -injars /some/path/jar1;"/some other path/jar2"
</proguard>

It doesn’t work to quote the whole argument, the individual paths need to be quoted separately. The ant file I’m modifying uses properties to pass the various JARs paths to proguard and my issue is how to properly quote the individual paths for the -injars and the -libraryjars. Example:

<property name="libraryjars" refid="some.classpath" />
<proguard>
   @${proguard.config}
   -libraryjars  ${libraryjars}
</proguard>

I just modified the property to look like:

<property name="libraryjars.unquoted" refid="some.classpath"/>
<property name="libraryjars" value="'${libraryjars.unquoted}'"/>

but that’s still brittle, isn’t it? Is there a better way? What about the fact I have a property with “path1;path2”, I’d like to split the path components, quote them separately and recreate the property. I know how to do that in a shell script but ant syntax is a lot more mysterious to me 🙂 Oh and of course it needs to work on all platforms (well at least Windows, Mac and Linux), dealing with the fact the path separator changes, but that’s Ok there’s a constant somewhere for that in the ant script.

[Update] Thanks for @martin’s answer, I found the perfect way to do exactly what I wanted using pathconvert with an inner mapper chain:

<pathconvert property="dest.path" refid="source.path">
  <firstmatchmapper>
    <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
    <identitymapper/>
  </firstmatchmapper>
</pathconvert>

This will convert C:\path\jar 1;C:\my path\jar2;C:\path\jar3 into "C:\path\jar 1";"C:\my path\jar2";C:\path\jar3. The path conversion calls the mapper chain for each path. If the regexp matches it takes that otherwise it takes the identity. The regexp simply says that if we find something with no space followed by something with at least a space, surround it in double quotes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:19:49+00:00Added an answer on May 22, 2026 at 3:19 am

    One option would be to use a ‘full-XML’ proguard task, then each jar would be a separate element, but in general for rendering paths to properties you would use the Ant pathconvert task. For example:

    <fileset id="some.classpath" dir=".">
        ...
    </fileset>
    
    <pathconvert property="injars.inner" refid="some.classpath" pathsep='"${path.separator}"' />
    <property name="injars" value='"${injars.inner}"' />
    

    Note the addition of leading and trailing double quotes – the pathsep only applies between the elements of the path.
    Then use it in the way you mention:

    <proguard>
      -injars ${injars}
    </proguard>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want call method path from class Path. I need set some number -
I want to call a EXE file in Perl which performs some action I
I want to call a C# component from an unmanaged c++ service. I need
I want to call a process via a python program, however, this process need
I want to call some calendar app into my aplication, does anybody knows how
I want to call some function repeatly in client's browser. System::Timers::Timer work only on
I want to call a webservice using google closures, via jsonp since i am
I want to call a html page on click of a button in mvc.
i want to call the command prompt command using Process.Start and then using StandardOutput
I want to call a method say success(message) of javascript from android activity. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.