Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old May 7th, 2008, 03:14 AM
daphnad daphnad is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 19 daphnad User rank is Sergeant (500 - 2000 Reputation Level)daphnad User rank is Sergeant (500 - 2000 Reputation Level)daphnad User rank is Sergeant (500 - 2000 Reputation Level)daphnad User rank is Sergeant (500 - 2000 Reputation Level)daphnad User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 h 11 m 14 sec
Reputation Power: 0
Thumbs up ANT task macrodef - Error message: Unknown attribute

Hello,

I'm trying to run the following ant file:
<project name="test" basedir="." default="test">

Code:
<macrodef name="testing">
<attribute name="v" default="NOT SET"/>
   <sequential>
      <echo>v is @{v}</echo>
   </sequential>
</macrodef>

<target name="test">
    <echo>start test</echo>		
    <testing v="This is v">
    </testing>
    <echo>end test</echo>
</target>
</project>


When running the task from the eclips, using ant plug in, the task is working succefully.

Now I wrote a jave code, running under Jboss server, that run the task.
And i'm having a problem with the MacroDef task (other tasks are working).

I'm getting the error message:
Code:
Unknown attribute [v]
	at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:382)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)


I'm guessing it sonething to do with diffrent Jars, but i couldn't find the diffrents.

Thanks,

Reply With Quote
  #2  
Old May 7th, 2008, 10:10 AM
Yawmark's Avatar
Yawmark Yawmark is offline
Feelin' Groovy
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Aug 2001
Location: WDSMIA
Posts: 7,625 Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 1 Day 13 h 56 m 33 sec
Reputation Power: 1344
Send a message via ICQ to Yawmark Send a message via MSN to Yawmark
Quote:
I'm guessing it sonething to do with diffrent Jars...

It probably does. Ensure that you are using current versions of Ant in both environments.

~
__________________
Yawmark
class Sig{public static void main(String...args){\u0066or(int
\u0020$:"vÌÈÊ\"¤¾Àʲ¬Æ\"v¤Î¤\"²¤¨¸¬Æ".to\u0043h\u0061rArray()
)System./*goto/*$/%\u0126//^\u002A\u002Fout.print((char)(($>>
+(~'"'&'#'))+('<'>>('\\'/'.')/\u002Array.const(~1)\*\u002F)));}}

Reply With Quote
  #3  
Old May 8th, 2008, 03:41 AM
daphnad daphnad is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 19 daphnad User rank is Sergeant (500 - 2000 Reputation Level)daphnad User rank is Sergeant (500 - 2000 Reputation Level)daphnad User rank is Sergeant (500 - 2000 Reputation Level)daphnad User rank is Sergeant (500 - 2000 Reputation Level)daphnad User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 h 11 m 14 sec
Reputation Power: 0
mabe you can be more specifc?
Do you know of an Ant version where the MacroDef is not working?
What is the specific jar for this task?

Reply With Quote
  #4  
Old May 8th, 2008, 09:48 AM
Yawmark's Avatar
Yawmark Yawmark is offline
Feelin' Groovy
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Aug 2001
Location: WDSMIA
Posts: 7,625 Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level)Yawmark User rank is General 5th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 1 Day 13 h 56 m 33 sec
Reputation Power: 1344
Send a message via ICQ to Yawmark Send a message via MSN to Yawmark
Quote:
mabe you can be more specifc?

I don't know how to be more specific than "ensure you are using current versions of Ant in both environments." That sounds pretty specific to me. *shrugs*

Quote:
Do you know of an Ant version where the MacroDef is not working?

The MacroDef task has been available since Ant 1.6, but is still apparently in beta. You can see this in the Ant documentation.

Quote:
What is the specific jar for this task?

ant.jar

~

Reply With Quote
  #5  
Old May 12th, 2008, 08:47 AM
daphnad daphnad is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 19 daphnad User rank is Sergeant (500 - 2000 Reputation Level)daphnad User rank is Sergeant (500 - 2000 Reputation Level)daphnad User rank is Sergeant (500 - 2000 Reputation Level)daphnad User rank is Sergeant (500 - 2000 Reputation Level)daphnad User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 h 11 m 14 sec
Reputation Power: 0
Apperently there was no problem with the jars.

The problem was in the Java code parsing the Ant file.
I used the code
Code:
final ProjectHelper helper = new ProjectHelperImpl();
helper.parse(ant, new File("D:\\testAnt\\test2.xml"));


And I should have used:
Code:
ProjectHelper.configureProject(ant, new File("D:\\testAnt\\test2.xml));


Hopefully this will help to someone else.
Comments on this post
Yawmark agrees: Thanks for sharing your solution!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > ANT task macrodef - Error message: Unknown attribute


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway