Ant Umlauts within description attribute - ant

Is there a way to show german umlauts like äÄöÖüÜ in the description attribute?
<target name="mytarget" description="Some fancy german umlauts äÄöÖüÜ">
<!-- Stuff -->
</target>
If i call my target:
machine:html root$ ant -p
The console prompt looks like
mytarget some fancy german umlauts ??????.

This link: encoding
Essentially it suggest supplying a command line argument to ant that specifies which encoding to use for the tasks. If that is not where the issue is, validate that your console has the proper encoding on it. This can be tested by trying to generate a diacritic within the console. If that fails, change the encoding on your console/terminal.

Related

how to run sql file which contains set define off using ant

I have this dbobject.file which in turn calls several dml,ddl and prcs.
I am trying to execute this file using ant but it requires only the sql statements,throws error for set define and spool.It is working using sqlplus but I want to run using ant,so calling this dbobject file should execute the dmls and ddls.
set define off
spool dbobjects.log
prompt calling D:\Pst1\Intel\tag\txt1.dml
#"D:\Pst1\Intel\tag\txt1.dml"
prompt calling D:\Pst\Intel\tag\txt2.dml
#"D:\Pst\Intel\tag\txt2.dml"
set define on
Thanks in advance.
From the sound of your question it sounds like you're trying to figure out how to convert an Oracle sqlplus script into a SQL Ant task.
Both spool and set aren't SQL commands, they don't affect the server, instead they change how sqlplus operates locally. So in the context of Ant they wouldn't mean anything. If you're printing results in your script you can use the output= attribute to do something roughly similar.
If you were converting your sqlplus script to Ant I'd expect it to look something like this:
<sql driver="org.database.jdbcDriver" url="jdbc:database-url" userid="sa" password="pass"
src="txt1.dml"
output="dbobjects.log" />
<sql driver="org.database.jdbcDriver" url="jdbc:database-url" userid="sa" password="pass"
src="txt2.dml"
output="dbobjects.log"
append="true" />
This would execute txt1.dml and txt2.dml as a set of SQL files against your database and would save any result sets generated into dbobjects.log.
This may not work in all cases especially if you're relying on anything sqlplus provides like report formatting or nested imports. In that case you'd need to rewrite your source files to only contain SQL.

Jmeter 3.0 can't generate the ANT HTML report

I am on the verge of pulling all my hair out, someone please help me..
I am using JMeter 3.0 and am trying to generate the dashboard report from my jtl files, but I get the error -
result.jtl' does not contain the field names header, ensure the jmeter.save.saveservice.* properties are the same as when the CSV file was created or the file may be read incorrectly
my user.properites file contains -
jmeter.save.saveservice.output_format=csv
jmeter.save.saveservice.bytes=true
jmeter.save.saveservice.label=true
jmeter.save.saveservice.latency=true
jmeter.save.saveservice.response_code=true
jmeter.save.saveservice.response_message=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_counts=true
jmeter.save.saveservice.thread_name=true
jmeter.save.saveservice.time=true
jmeter.save.saveservice.timestamp_format=ms
jmeter.save.saveservice.timestamp_format=yyyy-MM-dd HH:mm:ss
jmeter.save.saveservice.print_field_names=true
these values are the same in the jmeter.properties file as well, just to ensure I haven't lost anything...
I really can't work out why I can't get the jtl to include the headers, I have followed every guide I can find, and I seem to be doing it right..
Can someone point to me what I am missing, or include a zipped version of their jmeter with it all working that I can try and point my ant project to?
Hope someone can help.
Double check <jmeter> section of your build.xml file. Default JMeter Ant Task assumes XML out put format for .jtl result files so if you have the following line:
<property name="jmeter.save.saveservice.output_format" value="xml"/>
just comment it out or delete it and your issue should be resolved.
I don't think JMeter Ant Task respects overrides via user.properties file, it is better to use jmeterproperties attribute or explicitly specify the relevant configuration in the Ant build file like:
<target name="test">
<jmeter
jmeterhome="${jmeter.home}"
testplan ="${testpath}/${test}.jmx"
resultlog="${testpath}/${test}.jtl">
<property name="jmeter.save.saveservice.output_format" value="csv"/>
<property name="jmeter.save.saveservice.print_field_names" value="true"/>
<property name="jmeter.save.saveservice.timestamp_format" value="ms"/>
<!--etc.-->
</jmeter>
</target>
I would also recommend choosing one of jmeter.save.saveservice.timestamp_format properties (either ms or yyyy-MM-dd HH:mm:ss as it might cause problems with the dashboard generation), having duplicate property names with different values is not a very good practice.
See Five Ways To Launch a JMeter Test without Using the JMeter GUI article for more information on running JMeter tests via Ant task and other ways of kicking off a JMeter test
I had noticed before you posted, but it is correct, the XML type was hardcoded in the build.xml, now I have changed that, all is working :)

Display Ant options, properties specified in invocation

I have an Ant buildfile (build.xml) which is called by some application. I would like to know exactly what kind of properties are used to invoke Ant. Therefore I would like to modify the build.xml file to display all properties specified in the call, e.g.:
ant aTarget -Dxslt.parser=SAXON -Dbasedir=aFolder
would display list as below
- target: aTarget
- xslt.parser = SAXON
- basedir=aFolder
Please note that I do not know exactly what is being using to invoke Ant. Therefore, I need to use some sort of a loop get all properties, options.
The simplest thing that comes to mind is to place a line like:
<echo message="Ant invocation is '${sun.java.command}'" />
In the buildfile outside of any target. It'll look something like:
% ant aTarget -Dx=y
[echo] ant invocation is: 'org.apache.tools.ant.launch.Launcher -cp . aTarget -Dx=y'
It shows you what was passed to the Ant Launcher, which might will likely be a little more than what was passed to the ant wrapper script, but should do.
I would avoid trying to parse the line, as you say, you don't know what might be there, and it could quickly get complicated.
Take a look at the <echoproperties> task:
<property name="in.file.prop" value="value2"/>
<echoproperties/>
in.file.prop and its value will be printed. However, over 60 other properties will be printed as well including properties built into Ant.
You can save the results of <echoproperties> to a file and then filter that file with something like a <linecontains> filter.

Splitting a String and increment in ant

there are different folders or strings like 4.5, 4.10.1, 4.10.2, 4.10.5, 4.11.1, 4.12 , 4.13.2...etc
My input will be 4.10.1 to 4.11.1 and it should fetch only the respective strings.
I should be able to get an output like 4.10.1, 4.10.2, 4.10.5, 4.11.1.
Now, am able to split the strings, but not possible to increment to get the next strings.
You didn't provide enough details (what means respective ..), but basicly you'll need some kind of looping.
Either use ant script task with a scripting language, like javascript (already contained in JDK >= 6) or groovy or use some Ant addon like f.e. Flaka or Antcontrib.
Some basic snippet with Flaka :
Use for task combined with split function to iterate over your list
<project xmlns:fl="antlib:it.haefelinger.flaka">
<property name="whatever" value="4.5,4.10.1,4.10.2,4.10.5,4.11.1,4.12,4.13.2"/>
<fl:for var="substring" in="split('${whatever}', ',')">
<!-- do something with substring ...-->
<fl:echo>#{substring}</fl:echo>
</fl:for>
</project>
For further snippets see FlakaExamples and Flaka Manual.

Using the nested element module in cvs task in ant build.xml

I have problems connecting to CVS using ant build.xml.
I figured out the reason was whitespaces in package attribute of CVS task as:
<cvs cvsRoot=":pserver:user#xx.xxx.xxx.xx:/CVSREPO_CCP_MIG" dest="${basedir}" package="My Test Project"/>
I learned from the ant website( http://ant.apache.org/manual/Tasks/cvs.html ) that we may Use a nested <module> element if you want to specify a module with spaces in its name. This specifies a package/module to work on, unlike the package attribute, modules specified using this attribute can contain spaces in their name.
I tried using the following:
<cvs cvsRoot=":pserver:user#xx.xxx.xxx.xx:/CVSREPO_CCP_MIG" dest="${basedir}">
<module name="My Test Project"/>
</cvs>
This again complains:
build.xml:39: cvs doesn't support the nested "module" element.
How can I use the module element with the CVS tag?
The Ant version is 1.7.x.
As suggested by the comments above, the nested "module" element is available for Ant ver 1.8 +.
However, if you are on one of the earlier versions, you may specify your package/module name under package attribute of CVS task by adding '"' on the either end of the attribute value.
e.g. We can replace package="My Test Project" with package=""My Test Project"" in here.

Resources