WebServices Development | 25 May 13:58 2015

Extracting individual tokens after using stringtokenizer

I am trying to extract individual tokens in ANT after using stringtokenizer to separate the tokens out.  Is
it possible? How do I do it without using any other external ant libraries like ant-contrib?

I attempted to do below, but am stuck at extracting individual tokens

<property name="dirlist" value="./src:./.apt_generated:abc" />
<loadresource property="dirseplist">
      <string value="${dirlist}" />
      <filterchain>
            <tokenfilter>
            <stringtokenizer  delims=":" id="dirliststr"/>
            <replaceregex pattern="(.+)" replace="[\1]" />
            </tokenfilter>
      </filterchain>
</loadresource>
<echo level="info" message="dirlist: '${dirlist}'" />
<echo level="info" message="dirseplist : '${dirseplist}'" />

And the output is
     [echo] dirlist: './src:./.apt_generated:abc'
     [echo] dirseplist : '[./src]:[./.apt_generated]:[abc]'

Thanks

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,
copying or action taken in reliance on the contents of this email by anyone other than the intended
recipient is strictly prohibited. If you have received this email in error please immediately delete it
and notify sender at the above CSX email address. Sender and CSX accept no liability for any damage caused
directly or indirectly by receipt of this email.
(Continue reading)

Christopher BROWN | 16 May 15:38 2015
Picon

How should an Ant <fileset> be created programmatically from another (custom) Ant task?

Hello,

I've developed a few custom Ant tasks over time, but I need a little help
doing something specific to Ant's data types.  I've created a task that
retrieves a set of files from a server, but the names aren't known in
advance, they're determine during execution of the task.  I'd like to
create a fileset that has an ID and can be referred to later on by other
tasks and targets in the build.

This is how I assumed I'd get started:

FileSet fs = new FileSet();
fs.setId("someid");
fs.setProject(_project_);
fs.setDir(_dir_);
fs.createInclude().setName("entry/within/dir1/containing/file.abc");
fs.createInclude().setName("entry/within/dir2/containing/file.xyz");

I've some doubts about the "createInclude" logic... but I haven't got that
far yet.  I'm stuck on the "setId()" part which just doesn't exist.

In a build script, I'd write:

<fileset id="someid" dir="somedir">
  <include name="relative/path/to/file" />
</fileset>

... then refer to it later with "refid".

How can I get this to work?
(Continue reading)

Dilini Asanga | 9 May 11:45 2015
Picon

Ant does not return after calling org.glassfish.tyrus.client.ClientManager.connectToServer()

Hi,

I have a main class which I want to run using an ant script. 
(I have attached the project, which includes this main class: WebsocketLocalClient; and the ant script I'm referring to)

This main class executes fully, when I'm running it through the command line.

But when I run it using the ant script, it executes upto,
System.out.println("Starting Websocket-local publisher");

but does not execute beyond the line:
client.connectToServer(new WebsocketLocalEndpoint(), cec, new URI(socketServerUrl));

Ant output is given in attachment-1. 
It does not execute anything after printing the log '[java] Starting Websocket-local publisher'

It seems that,
ant does not return after calling org.glassfish.tyrus.client.ClientManager.connectToServer() method.

Any clues as to why this is happening?

Appreciate any help.
Thanks,
Dilini

Attachment-1:
dilini <at> dilini-Latitude-E6540:~/github/product-cep/modules/samples/producers/websocket-local-client$ ant
Buildfile: /home/dilini/github/product-cep/modules/samples/producers/websocket-local-client/build.xml

init:

compile:
    [javac] /home/dilini/github/product-cep/modules/samples/producers/websocket-local-client/build.xml:58: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
     [copy] Copying 1 file to /home/dilini/github/product-cep/modules/samples/producers/websocket-local-client/temp/classes

run:
     [echo]  Configure -Durl=xxxx -Dtopic=xxxx and (-DfilePath=xxxx and/or -Dsn='sample number') 
     [java] Starting Websocket-local publisher


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe <at> ant.apache.org
For additional commands, e-mail: user-help <at> ant.apache.org
John J. Hughes II | 27 Apr 18:26 2015

tools.jar not found

All,

I have searched online and can't fine and answer so please bear with me.

When I run ANT it says it can't find tools in the JRE lib, why is it looking
there?

If I copy tools.jar from the JDK to the JRE lib it works fine but that will
break on the next update so I would prefer to fix it correctly.

I have rebooted and retested.

There are no extra JDK or JRE values in the path, path simplified to only
show useful values.

I dumped the SET values to text files and search and don't fine any
references to JRE there either.

In settings: 

PATH = .;%JAVA_HOME%\bin;%ANT_HOME%\bin;

Converts to: 

PATH  = .;C:\Program
Files\Java\jdk1.8.0_05\bin;C:\devenv\apache-ant-1.9.4\bin;

C:\Projects>SET JAVA_HOME

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_05

C:\Projects>SET ANT_HOME

ANT_HOME=C:\devenv\apache-ant-1.9.4

Error:

C:\Projects>ant -version

Unable to locate tools.jar. Expected to find it in C:\Program
Files\Java\jre1.8.0_45\lib\tools.jar

Apache Ant(TM) version 1.9.4 compiled on April 29 2014 

So what am I doing wrong, thanks.

John

Stranzenbach, Ralf | 14 Apr 10:50 2015

Acessing ANTs execution graph

Hi,

i have a fairly complex build system that recently introduces some additional compexity. To describe my
problem, i'll sketch a very simplified Ant build:

<project>

    <target name="clean" depends="-clean" />

    <extension-point name="-clean" />

    <target name="init" depends="-init" />

    <extension-point name="-init" />

    <target name="compile" depends="-compile" />

    <extension-point name="-compile" depends="-init" />

    <target name="install" depends="-install" />

    <extension-point name="-install" depends="-compile" />

    <target name="recompile" depends="-recompile" />

    <extension-point name="-recompile" depends="-clean, -compile" />

</project>

This basic structure of the ANT file is required, because all extension-points are extended by specific
implementatiosn for various implementation languages (including PL/I and COBOL).

This way i was able to maintain structured and standardized procedures, to generate the artifacts based on
the varous sources.

Recently we tried to include that "recompile" step, that introduces a different "clean" semantic.
Therefore i've implemented the "clean semantics as follows:

    <target name="std-clean" extensionOf="-clean">

        <echo>Std. Clean</echo>

    </target>

    <target name="recompile-clean" extensionOf="-clean" if="is.Recompile" >

        <echo>Additional behaviour for recompile</echo>

    </target>

    <target name="-recompile-switch">

        <property name="is.Recompile" value="true" />

    </target>

And the "-recompile" Target was extended this way:

    <target name="recompile" depends="-recompile-switch, -recompile" />

While this solution - in principle - activates "-recompile-switch" just before executing "-clean", this
is not guaranteed by ANT. The ANT documentation states, that this dependcy declaration just states, that
"-recompile-switch" will be activated BEFORE recompile executes, but it does not guarantee the order of
execution for "-recompile-switch" and "-recompile".

In my case, the "-clean" targets activates, before "-recompile-switch" has any chance to execute.
(Sometime it works, sometime it fails. But it's backed by ANTs definition.)

Now my question(s):

================

    Are there any ways to define the order of execution to guarantee an optional task just like
"-recompile-switch" to execute at the right moment?

    Is there any way using the Java API to the ANT core to inspect the execution graph?
    Instead of injecting a target setting switch into the execution graph, it might by suitable to look up the
chain of target execution to get an idea wich main target is active.

Unfortunately it is impossible to manipulate the execution graph at runtime, conditionally <import>ing
different extesions.

A interim solution using <antcall> is in place.

    <target name="recompile">

        <antcall target="-recompile" inheritAll="true">

            <param name="is.Recompile" value="true" />

        </antcall>

    </target>

But ths solution requires a complete re-evaluation of the complete set of ANT build filles which takes a
long time and is not applicable in any case.

Mit freundlichen Grüßen,

Ralf Edmund Stranzenbach
Manager, FS-Technology

BearingPoint
Management & Technology Consultants

Karl-Arnold-Platz 1
Düsseldorf 40474
Germany

T + 49 211 17143 6038
C + 49 174 3075 211
F + 49 211 17143 6060

www.bearingpoint.com
<../../owa/redir.aspx?C=4fef6935f97e45feb117b401747f61f1&URL=http%3a%2f%2fwww.bearingpoint.com%2f>
________________________________
BearingPoint GmbH
Geschäftsführer: Marcel Nickler (Vorsitzender), Hans-Werner Wurzel (stellv. Vorsitzender),
Kiumars Hamidian, Matthias Loebich, Kai Wächter, Dr. Robert Wagner
Vorsitzender des Aufsichtsrats: Beat Leimbacher
Sitz: Frankfurt am Main
Registergericht: Amtsgericht Frankfurt am Main HRB 55490

The information in this email is confidential and may be legally privileged. If you are not the intended
recipient of this message, any review, disclosure, copying, distribution, retention, or any action
taken or omitted to be taken in reliance on it is prohibited and may be unlawful. If you are not the intended
recipient, please reply to or forward a copy of this message to the sender and delete the message, any
attachments, and any copies thereof from your system.
Joseph Kesselman/Watson/IBM | 27 Mar 14:26 2015
Picon

Wishlist item: Resource macros

Macrodef very explicitly says that the macro invocation is treated as a 
Task.

Unfortunately, I need macros to simplify gathering resources, so macrodef 
doesn't help me.

So I'm requesting <resource-macrodef> and <resource-macro> -- just working 
names, I'm sure something better exists -- which are isomorphic with 
Macrodef but have invocations that are typed as Resource Collections. 
Syntax could be almost identical, but use <union> in place of <sequential> 
as the body element.

Or, perhaps better, just modify macrodef so it recognizes when its body is 
a union rather than a squential and changes its type (and the type of its 
invocation) appropriately.

(Personally, I really wish that you'd left macros as pure syntactic 
operations rather than constraining them to be tasks in the first place... 
but since that decision was made, I think you need to "drop the other 
shoe" and give us the resources equivalent.)

______________________________________
"Everything should be as simple as possible. But not simpler." -- 
attributed to Albert Einstein
Al Le | 24 Mar 23:31 2015
Picon
Picon

Pass build failure message to the calling script

Hello,

I call Ant (execute a build) from a .bat script (under Windows). If the build fails, I'd like not only to
detect that it failed (this is possible via ERRORLEVEL) but also get the failure message (at least its
first line if the message contains multiple lines).

Is it possible without parsing the output of Ant? If yes, how?

Thank you!
Picon

How do I create a customized build?

First let me preface this question by stating that I'm very much an Ant 
newbie.

I have a Java application that was designed to provide the ability to "plug 
 in" a message transport mechanism (e.g. ActiveMQ) for a given client 
installation.  The code defines interfaces for the transport and then there 
are a number of implementations that conform to the interfaces, providing 
concrete implementations of the transports we support.  The idea is that a 
given client will indicate the transport they want/need to use and we will 
provide them with a build that includes only the classes for the chosen 
implementation. No other transport implementations should be included.  The 
reasons for this are to keep code size down and for 3rd party licensing 
issues.

How do you set up an Ant build file to customize the jar file produced so that 
it only includes a subset of the transport implementations?  Obviously I need 
to somehow get the transport selection into the build file so that it has the 
info it needs.  From what I've read, you have to use properties to get input 
arguments into the script.  Beyond that, I am at a loss as to what to do next.

I'll provide a brief package hierarchy to illustrate what is located where. 
If it makes sense to restructure this in some way, please let me know.

<base package>.impl
	config
		TransportConfig.java	<- Used to unmarshal a file used to configure the 
transport
	transport
		impl				<- Where the supported transport implementations live
			dds.rti
			jms.activemq
			udp
			<transportX>
		<other packages and classes>
	<other packages and classes>
<base package>.service
	TransportFactoryLoader.java	<- Uses a ServiceLoader to load a transport 
factory
						   (currently set up in build file)
<base package>.transport		<- Contains the interfaces the transports must 
implement
	<transport interfaces>

So, as an example, client A will be using ActiveMQ. We want to run the build 
so that only the <base package>.impl.transport.impl.jms.activemq classes are 
included, but nothing from the rti.dds, udp, etc. packages are included. I've 
tried to find information in this area, but have found nothing helps.

I am open to any suggestions and ideas about how to go about this.

Thanks,
Joe Gagnon

Engineer II
Group 58 - Cyber Systems & Technology
MIT Lincoln Laboratory
Lexington, MA

Attachment (smime.p7s): application/x-pkcs7-signature, 7599 bytes
Josh Hoff | 17 Mar 01:14 2015
Picon

Excluding classpath jars from %ANT_HOME%\lib?

Hello Ants!

I'm having an issue where the server (that I don't have control over)
will have two junit jars in %ANT_HOME%\lib, and I'll pull one down (that
I do want) with ivy. My tests are failing because of the two in
%ANT_HOME%\lib conflicting with the one I got from ivy, but I can't find
where (if anywhere) %ANT_HOME%\lib is added to the classpath.
Suggestions?
jason mazzotta | 22 Feb 17:24 2015
Picon

mail task results in authentication failure when using gmail as smtp server

To whom it may concern,
        I am trying to use gmail as an smtp server with the ant mail task.
I have set up the task as follows:

<mail

         user="e-mail address"

         password="password"

         ssl="yes"

         mailhost="smtp.gmail.com"

         mailport="465"

         subject="Nightly unit test results">

         <to address="e-mail address" />

         <from address="e-mail address" />

         <message src="/Directory/On/My/Machine" />

</mail>

This worked a few months ago, but these days, when I run my ant build file
I get the follow error:

Failed to send email: 534-5.7.14 <
https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtAR

     [mail] 534-5.7.14
Xr2YD-ghKP2iyh466DE7nVr1n5WwF5lf7k8MZzGM9T0VI3UPNNsjR5PyjPoJtKhjlVBPSo

     [mail] 534-5.7.14
QTLSBT8z20kqwuU1vVfnG1Bg0dheJTuXClSawq1aReyb47UeIFbXqvr2l_2JjEwe3eXJAh

     [mail] 534-5.7.14
5tgRqrzCiTDdCwJRm-Tgk7h3uKvQ4u_yPW6da7yORpot1RULSt4Sb3xk_GErdyZbmuurF9

     [mail] 534-5.7.14 ILExbCY-gsmeNMVjcx55lv4ZOczA> Please log in via your
web browser and

     [mail] 534-5.7.14 then try again.

     [mail] 534-5.7.14 Learn more at

     [mail] 534 5.7.14
https://support.google.com/mail/bin/answer.py?answer=78754
n34sm1388141qge.27 - gsmtp

Do I need to loosen the security settings on my gmail account or are there
other properties I need to set in the mail task to prevent the
authentication error?

Thanks,

Jason Mazzotta
Jeffrey Walton | 17 Feb 21:11 2015
Picon

Specify source file language in build.xml?

I'm trying to build an Android project from the command line. I'm
getting an error during `ant release`. The error is unmappable
character for encoding UTF-8.

The sources appear to be written by a non-English speaker, and the
offending characters are in comments like so:

    /*
     * Projet   : Permission Explorer
     * Auteur   : Carlo Criniti
     * Date     : 2011.06.10
     *
     * Classe ApplicationDetail
     * ActivitÈ d'affichage du dÈtail d'une application
     * avec les permissions qu'elle utilise
     */

There are multiple errors like this. If /usr/local/bin/ant release
2>&1 | grep -i error | wc -l is accurate, then there's 103 of them.

I've been through ant's documentation at "Writing a Simple Buildfile"
(http://ant.apache.org/manual/using.html) and "Property Task"
(http://ant.apache.org/manual/Tasks/property.html), but damn if I can
figure out how to set a source file language to get past these errors.

How do I specify a source file language in build.xml?

Gmane