I am using <zip> and <zipfileset> for zipping the files
File system contains file name abc.txtand if my ant script contains file name Abc.txt the script does not pick up this file instead complains file Abc.txt not found
Any idea how I can over come this?
Perhaps you can use the casesensitive attribute of FileSet and by extension ZipFileSet to meet your requirement. This is true by default.
put casesensitive="false" in zipfileset or zip.Both supports casesensitive attribute.It is true by default.
Hope that will help.
Related
I have a build file, which has the following property in it.
<property name="schema.dir" value="src/main/resources/schema" />
This schema.dir is used to refer a wsdl file.The parent folder which contains the build.xml has a space in it like this folder name .
When I echoed the property it displayed only src/main/resources/schema.
But I can see from the ant logs that issue is with the space in the folder name.
Since the parent folder is having a space in it, I am not able to refer the wsdl.
Can somebody suggest a solution so that file can be accessed with out changing the folder name
Is it possible to provide directly full path to wsdl file?
Try to replace " " sign with "%20".
For test you can hardcode that and with ANT you can use the propertyregex task from Ant Contrib.
See Replacing characters in Ant property
Have you tried specifying your property as a location rather than a string so Ant knows it's dealing with a file path, you can also specify the path as relative to your base directory.
<property name="schema.dir" location="${basedir}/src/main/resources/schema"/>
Adding ${basedir} to the path may not be necessary after changing the property from a value to a location.
I need to store some directory paths in property files for ant. So I have file that contains for example:
plugins.system=plugins\\whatever
plugins.content=plugins\\example
this.is.fine=plugins
this.also.does.not.work=plugins/example
The problem is, that dirset or fileset does not find the directory. I belive, that it's due escaping. When I set property directly in build.xml without double slashes it works fine. Is there any way how to "unescape" properties when I load them?
Thank you for answer.
I know how to get the basename for a file with java's ANT build tool, but in this case I want to change the name of a file to include a build version number. Unfortunately the file's name gets set in another ant script (from the android system) which I am importing and I'm not able to set the property for that file or the imported script will complain that the property should not be set already. Thus, if i have a property holding MyApp-release.apk and I want to change the value to MyApp-release-1.10.apk how would I do this? I know I can put the 1.10 at the start of the filename with basename and that's probably what I will do, but I'd rather do it the other way.
Form http://ant.apache.org/manual/Tasks/basename.html:
Task to determine the basename of a specified file, optionally minus a
specified suffix.
<basename property="cmdname" file="D:/usr/local/foo.exe"
suffix=".exe"/>
I have an Ant file that has this as a path. TRying to find out what it might mean.
deploy.dir = ${basedir}/..
First there is nowhere I can find where ${basedir} is being set. Is this some variable type being set in another file on the server or does ${basedir} mean the same directory the build file is in?
Then what does /.. mean after it.
Thanks
http://ant.apache.org/manual/using.html will explain that ${basedir} is, by default, where you are sitting when you type 'ant'.
.. means what it means on Windows and Linux in pathnames: one directory up.
The default value of ${basedir} is the directory containing your build xml file. This is even true if you say basedir="." in the project element. However, if on the command line, you say:
-Dbasedir=.
then it will be where you are sitting when executing ant. Since in most cases the build xml file will be where you are sitting, the difference shouldn't matter.
Is there a way to have an Ant Fileset->IncludesFile attribute take a property file OR any other file that contains a list of Java class files to exclude?
Eg:
File A.properties OR A.java contains listing
abc.class
mno.class
xyz.class
Is there a way to say to point excludesFile to file A.properties.
<fileset dir="...">
<excludesFile file="A.properties" />
</fileset>
The behavior that I want is when Java runs, it excludes the Java files listed in this file (A.properties)
Hmm...not sure if it's case sensitive. The documentation at http://ant.apache.org/manual/Types/fileset.html shows "excludesfile", all lowercase, as with other ant directives.
I'm not sure exactly what you are asking. If you have a fileset which is including files you would like to exclude, and you want to specify that list of files to exclude in an external file, "excludesfile" is the correct way to do it.