Problem with Ant build file (basic!)

G

gvanto

Hey guys,

I am having alot of trouble getting a simple ant buildfile to work in
eclipse.

I am following the tutorial on here (the part about ant files):
http://help.eclipse.org/help32/inde...user/gettingStarted/qs-93_project_builder.htm

I have created a simple java project called HelloWorld and created a
build file below in a package 'org':
------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<project name="HelloWorld" default="Hello" basedir=".">
<property name="HelloText" value="Hello"/>
<target name="Hello">

<echo>${HelloText}</echo>

</target>

</project>
------------------------------------------------------------

According to the tutorial, I should get an outline in Eclipse (i use
3.2), etc, etc however I only get problems:
- Whenever I save the file I get "Save Failed: org/apache/tools/ant/
launch/AntMain"
- When I attempt to add the buildfile to the 'Ant' pane on the right,
I get error:
"failed to parse ant build file"

If anyone has any advice on how to get a simple ant file like the one
above working, it would be so much appreciated!

Thanks
Gerry
ant newbie
 
A

Andy Dingley

"failed to parse ant build file"

That Ant looks good, as far as I can see from here. Check for config
problems. Do you have any Ants that do work, such as those supplied
from other projects?
 
J

Jagger

That Ant looks good, as far as I can see from here. Check for config
problems. Do you have any Ants that do work, such as those supplied
from other projects?

Shouldn't you put ${HelloWorld} in "" so it looks like "$
{HelloWorld}"?
 
A

Andy Dingley

Shouldn't you put ${HelloWorld} in "" so it looks like "$
{HelloWorld}"?

That's an XML question, not an Ant question.

If you're using the HelloText property from an XML attribute, such as
setting another property to its value, then yes, you'd need quotes
(simple XML syntax).

If you're using HelloText in Ant, from somewhere where XML doesn't
requires quotes (such as the text node children of an element), then
Ant doesn't require quotes.

<echo>${HelloText}</echo>
is perfectly reasonable Ant
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top