Matt Bertolini | 18 Dec 05:18 2014
Picon

Parse jar:file prefix to Resource

Hi,

I am writing some custom ant tasks and I want to support files inside of
zip/jar files. I have noticed that some ant tasks use the
jar:file:/path/to/a.jar!/path/in/jar/file.xml syntax but I can't seem to
get it work. How do I use this pattern in my tasks and map them to a
Resource object like FileResource, URLResource, etc. Thanks.

Matt Bertolini
Eric Fetzer | 5 Dec 19:24 2014

<exec> kicking my butt with something very simple

All,
I've tried all I can figure out to try on a simple unix command in redhat.  I can run the command line and it works
fine, but ant can't run it to save its life:
<exec executable="sort" dir=".">
  <arg value="-u"/>
  <arg value="existingFile"/>
  <arg value=">"/>
  <arg value="newFile"/>
</exec>
I've tried putting all the args together, putting some of the args together...  If I run it like this, I get
"sort: stat failed: >: No such file or directory.  If I put the "existingFile > newFile" in the same arg, I get
"sort: stat failed existingFile > newFile: No such file or directory.  If I make the executable "bash" and
use "sort" as the first argument, I get:  [exec] /bin/sort: /bin/sort: cannot execute binary file.  If I run
it as bash and put all the arguments into a single arg value, I get: [exec] bash: sort -u existingFile >
newFile: No such file or directory.

This has got to be simple, please help!

Thanks,
Erc
Ryan Payton | 5 Dec 03:13 2014

Problems parsing <at> <at>

Hello,

I am running into an issue using  <at>  <at>  in a .properties file. The variable is
a database password (I also tried using it in the username and still didn't
work), and fails our build since Ant is unable to connect to the database.
However, when I enter  <at>  <at>  <at>  in the .properties file, and leave the DB user's
password with  <at>  <at>  in it then everything works.

Has anyone encountered any issues like this? If so, what was your solution?
Also, would this be considered a bug, and should I file a bug report?

Thank you

This is a customer's issue, and we cannot change the password or use any
workarounds.
Alan Snyder | 10 Nov 22:24 2014

delete task and symlinks

I realize that I am late to the party and that there is an open RFE
<https://issues.apache.org/bugzilla/show_bug.cgi?id=56700> on this issue, but considering how
long this problem has been in existence, I want to make some comments (and maybe rant a bit, too).

First, I cannot tell you how surprised I was when I decided to add a symlink to a build product and suddenly my
build script tried to delete my installation of the JDK! Fortunately, it did not have permission to do so…

Then I checked the documentation. Sure enough, that is how delete works. I investigated alternatives, and
could not find a better one than exec rm. Sad, but true.

OK, so I solved my problem, but for the benefit of those who have not yet encountered this problem, I have to
say that having a delete operation that follows symlinks may be the most surprising and dumb and dangerous
thing I have ever encountered in software, and it is very hard to understand why after all these years it is
still that way. Is there anyone who actually wants this behavior? In other words, does it really need to be
an option or should it just be fixed to never follow symlinks? Even Unix rm does not have a follow-symlinks
option, and Unix was made for power users.

I’ve seen some supposed explanations for this behavior, but they sound lame to me. Some say that Ant
cannot avoid following symlinks because Java doesn’t support them. Well, that’s not true any more.
But regardless, would it not be sufficient to call File.delete() first and only if it fails call
File.isDirectory() to see if iteration is required?

Other comments suggest the problem has to do with file sets and such. I guess I don’t see this. Deleting a
directory (or a symlink that happens to point at a directory) is not a matter of enumerating all the files in
the directory tree and then deleting them. From the point of view of Ant tasks, it should be an atomic
(meaning not composite) operation: call File.delete(), if that fails, check File.isDirectory() and if
true, iterate and recurse. If I tell Ant to delete a bunch of files, that operation should be applied to each
one. If I tell Ant to delete one directory, that operation should be applied to that one directory (or
symlink). If someone wants more control over what gets deleted in a directory, let them specify the set of
files to be deleted.
(Continue reading)

Stephen Connolly | 5 Nov 11:36 2014
Picon

[ANN] Animal Sniffer 1.12 Released

Hi,

The Mojo team is pleased to announce the release of Animal Sniffer version
1.12.

Animal Sniffer provides tools to assist verifying that classes
compiled with a newer JDK/API are compatible with an older JDK/API.

The following tools are provided by animal sniffer:

* A command line tool to dump the class file version number
(http://mojo.codehaus.org/animal-sniffer/animal-sniffer/index.html).
This helps you track down the offending jar file when you see
UnsupportedClassVersionError.

* A set of ANT tasks
(http://mojo.codehaus.org/animal-sniffer/animal-sniffer-ant-tasks/index.html
)
for verifying that your classes comply with an API signature as well
as tasks for creating API signatures from a JDK, or a collection or
jar and class files, or a collection of other API signature files, or
combination of these elements.

* A rule for use in the maven-enforcer-plugin
(
http://mojo.codehaus.org/animal-sniffer/animal-sniffer-enforcer-rule/index.html
)
for verifying that your classes comply with an API signature .

* A maven plugin
(Continue reading)

KM | 24 Oct 16:43 2014

exception expanding war file

Task is expanding a war file.  this has worked for all of my tests but not working at customer site.  the OS is
Windows Server 2008 R2. the exception is:
BUILD FAILED
file:S:/xxxxx/xxxxxx/nftempdir/servletswar.xml:5: 
Error while expanding S:\xxxxx\xxxxx\webapps\theservlets.war
        at 
org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:164)
        at 
org.apache.tools.ant.taskdefs.Expand.execute(Expand.java:127)
        at 
org.apache.tools.ant.Task.perform(Task.java:341)
        at 
org.apache.tools.ant.Target.execute(Target.java:309)
        at 
org.apache.tools.ant.Target.performTasks(Target.java:336)
        at 
org.apache.tools.ant.Project.executeTarget(Project.java:1339)
        at 
org.apache.tools.ant.Project.executeTargets(Project.java:1255)
        at 
org.apache.tools.ant.Main.runBuild(Main.java:609)
        at 
org.apache.tools.ant.Main.start(Main.java:196)
        at 
org.apache.tools.ant.Main.main(Main.java:235)
Caused by: 
java.util.zip.ZipException: invalid stored block lengths
        at 
java.util.zip.InflaterInputStream.read(Unknown Source)
        at 
(Continue reading)

phoenix | 19 Oct 04:47 2014
Picon

Ant with -Xlint:unchecked

I use ant 1.9.4 and jdk1.8,my build.xml file is follows:

<?xml version="1.0" encoding="UTF-8" ?>

<project name="demo" default="run" basedir=".">

<property name="src" value="src"/>

<property name="lib" value="src/lib"/>

<property name="dest" value="WEB-INF/classes"/>

<property name="dest_lib" value="WEB-INF"/>

<path id="Third-Part Lib">

         <fileset dir="${lib}">

       <include name="*.jar" />

         </fileset>

</path>

<target name="init">  

         <mkdir dir="${dest}"/>  

</target>

(Continue reading)

Erik Itter | 20 Sep 16:13 2014
Picon

move rename date pattern

Hello,

I am trying to automate my environment a little more and thought to do 
the following:

In directory $foo$ take file [\d\d\d\d-\d\d-\d\d zzz_today.ico] and 
rename it to [yyyy-mm-dd zzz_today.ico] filling in the actual current 
date. Further I'd like to rename another file [\d\d\d\d-\d\d-\d\d 
zzz_one week.ico] to [yyyy-mm-dd zzz_one week.ico], obviously meaning 
the actual current date plus seven days.

Guess I should be able to do it with some form of

<move todir="$foo$"...>
     <mapper type="regexp" .../>
</move>

but I am somewhat lost. I'd like to do it with the tasks provided if 
possible instead of writing my own task. All kinds of help/ advice/ 
examples appreciated, of course.

thx, Erik
WebServices Development | 15 Sep 17:15 2014

Need help with ANT javac classpath

I have an old application which is using JAXB version 1.0.  When I pull in the projects in Eclipse, it compiles
fine because it references the jaxb jars from my web-inf/lib.



When I am defining an ANT javac task for it, I get compilation errors because the jaxb classes from rt.jar
take preference.  I have not included the jars from JAVA_HOME in my javac task's classpath.



How can I set-up my javac task such that my project will still compile with ANT as it does in Eclipse?



P.S - I tried adding includejavaruntime="false"   and    includeantruntime="false" attributes -  both
together as well as individually - to the javac task - but I still get the error.  The error is  - 
createBinder() in ObjectFactory cannot override createBinder() in JAXBContext



Because it seems that when compiling in Eclipse, it uses the JAXBContext from the jaxb-api.jar that is part
of the project whereas when running ANT javac, it uses the JAXBContext from rt.jar – which gets added to
the classpath when running ANT – not part of my classpath parameter to javac.



What do I need to do to get this fixed?

This email transmission and any accompanying attachments may contain CSX privileged and confidential
information intended only for the use of the intended addressee. Any dissemination, distribution,
(Continue reading)

WebServices Development | 13 Sep 00:08 2014

How to use a variable value in ANT refid

I am trying to use a value of a variable with path refid in ANT.

I tried different approaches and am getting different errors. Is it possible to use a variable value for refid?

    <path id="compile.classpath">

        <path refid="shared.lib.classpath" />

        <path refid="ext.classpath" />

        <path refid="common.classpath" />

        <path refid="${ant.refid:seq.1}" />

        <path refid="ear.lib.classpath" />

    </path>

Reference ${ant.refid:seq.1} not found.



OR



    <path id="compile.classpath">

        <path refid="shared.lib.classpath" />

(Continue reading)

SimonBate | 12 Sep 21:59 2014

native2ascii and JDK/JRE

[Trying again with a better subject and no garbage at the end...sorry.]

Excuse me if this has been answered or documented elsewhere, I've been searching 
for the past couple of hours and have found very little on this issue.

I have a project that uses the native2ascii task, that works fine on a machine 
with JRE 6 (1.6.0_65-b14-462-11M4609).

However, when trying to run the same project under JRE 7 (1.7.0_67-b01), it 
fails with the Java message "Error starting Sun's native2ascii."

Eventually I was able to fix this issue by copying tools.jar from a JDK into the 
lib file of my JRE.

I'm surprised to have to go to such lengths to fix this issue. I'm also 
surprised there's not more documentation in the native2ascii task in the Ant 
manual pointing out this problem.

Is there a more elegant solution out there than copying tools.jar? (I'm using 
Apache Ant under the DITA Open Toolkit; most DITA OT users just use the JRE.)

Thanks for any help or suggestions,
Simon

--------------------------------------------------------------------------------
Simon F. Bate
Senior Technical Consultant, Scriptorium Publishing Services, Inc.
sbate <at> scriptorium.com <mailto:sbate <at> scriptorium.com>
phone: 919.433.2606
twitter:  <at> simonbate
(Continue reading)


Gmane