Dominique Devienne wrote:

OK, this is probably something stupid I'm doing. I'm using Ant 1.6.0.

Here's a macro, with a couple of its uses:

  </compile>

If I run as is, I get:

BUILD FAILED
java.lang.NullPointerException
       at java.lang.StringBuffer.<init>(StringBuffer.java:130)
       at
org.apache.tools.ant.types.PatternSet$NameEntry.toString(PatternSet.java:126
)
       at java.lang.String.valueOf(String.java:2131)
       at
java.util.AbstractCollection.toString(AbstractCollection.java:455)
       at java.util.Vector.toString(Vector.java:945)
       at java.lang.String.valueOf(String.java:2131)
       at java.lang.StringBuffer.append(StringBuffer.java:370)
       at
org.apache.tools.ant.types.PatternSet.toString(PatternSet.java:476)
       at java.lang.String.valueOf(String.java:2131)
       at java.lang.StringBuffer.append(StringBuffer.java:370)
       at
org.apache.tools.ant.types.AbstractFileSet.setupDirectoryScanner(AbstractFil
eSet.java:419
)
       at
org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileS
et.java:395)
       at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:423)
       at org.apache.tools.ant.taskdefs.Sync.execute(Sync.java:131)
       at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
       at org.apache.tools.ant.Task.perform(Task.java:401)
       at
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:102)
       at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
       at org.apache.tools.ant.Task.perform(Task.java:401)
       at
org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:343)
       at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
       at org.apache.tools.ant.Task.perform(Task.java:401)
       at org.apache.tools.ant.Target.execute(Target.java:338)
       at org.apache.tools.ant.Target.performTasks(Target.java:365)
       at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
       at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
       at org.apache.tools.ant.Main.runBuild(Main.java:669)
       at org.apache.tools.ant.Main.startAnt(Main.java:220)
       at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
       at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)

If I change the <sync> in the macro to my own <lsync>, found through a
namespace:

       <lsync xmlns="antlib:com.lgc.buildmagic" ...>
         <fileset dir="src">
           <sources/>
           <and>
             <or>
               <filename name="**/*.gif" />
               ...
             </or>
           </and>
         </fileset>
         <fileset dir="build/generated">
           <sources/>
           <and>
             <or>
               <filename name="**/*.ser" />
               ...
             </or>
           </and>
         </fileset>
       </sync>

I get:

BUILD FAILED
P:\com_lgc\10-0-7\tahoe\new-build.xml:501: Following error occured while
executing this line
P:\com_lgc\10-0-7\tahoe\new-build.xml:460: The <fileset> type doesn't
support the nested "antlib:com.lgc.buildmagic:sources" element.

And if I change that to (bm prefix mapped to antlib:com.lgc.buildmagic NS):

       <bm:lsync...>
         <bm:fileset dir="src">
           <sources/>
           <bm:and>
             <bm:or>
               <bm:filename name="**/*.gif" />
               ...
             </bm:or>
           </bm:and>
         </bm:fileset>
         <bm:fileset dir="build/generated">
           <sources/>
           <bm:and>
             <bm:or>
               <bm:filename name="**/*.ser" />
               ...
             </bm:or>
           </bm:and>
         </bm:fileset>
       </bm:sync>

I get:

BUILD FAILED
P:\com_lgc\10-0-7\tahoe\new-build.xml:500: Following error occured while
executing this line
P:\com_lgc\10-0-7\tahoe\new-build.xml:459: The <fileset> type doesn't
support the nested "include" element.

(BTW, the order I presented the various failures above is
reverse-chronological...)

So what's one to do!?!?!? I'm kind of stumped.

It would be helpful I think when an exception is thrown, like the NPE at the
beginning, to specify the same build file trace as the other errors, where
you know why build file line was executing when the exception was thrown.


True

I think that a "name" is missing for one of the patterns. The latest version of ant
should silently ignore this error :-[
See:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25982


As regards the xml ns hell, I must agree - I still think that nested elements discovered
through reflection should be in the ant core namespace as well as the namespace of
the enclosing type/task.
You are missing a bm prefix from a nested include of a fileset element in a


bm:lsync (i think) element.

Also, is "sources" a typedef?

Peter




Thanks for any help. --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to