Avalon Magic - JiBX Custom Task or Plugin

Cameron Taggart <[email protected]>
Newsgroups gmane.comp.jakarta.avalon.user
Message-ID <[email protected]>
I now have my resources defined nicely in index.xml.  I also created a 
separate file, that I include to define my custom ant tasks.  My current 
build file for xsd2jibx looks like so:

<project name="xsd2jibx" default="build" basedir="./"
    xmlns:x="antlib:org.apache.avalon.tools">

  <x:home index="."/>
  <import file="${magic.templates}/standard.xml"/> 
  <import file="jibx-ant-task.xml"/>
 
  <target name="jibx" depends="build"
      description="compile the jibx bindings into the class files">
    <jibx>
      <classpath>
        <path refid="jibx.classpath"/>
        <pathelement location="target/classes"/>
      </classpath>
      <bindingfileset dir="target/classes/org/jibx/xsd2jibx">
        <include name="xsd.jibx.xml"/>
        <include name="jibx.jibx.xml"/>
      </bindingfileset>
    </jibx>
  </target>
</project>

My included "jibx-ant-task.xml" is as follows:

<project xmlns:x="antlib:org.apache.avalon.tools">
  <x:property name="jibx-bind.path" key="jibx-bind" feature="path"/>
  <x:property name="xpp3.path" key="xpp3" feature="path"/>
  <x:property name="jibx-run.path" key="jibx-run" feature="path"/>
  <x:property name="bcel.path" key="bcel" feature="path"/>
 
  <path id="jibx.classpath">
    <fileset dir="${magic.cache}" includes="
       ${jibx-bind.path},
       ${jibx-run.path},
       ${xpp3.path},
       ${bcel.path}"/>
  </path>
 
  <taskdef name="jibx" classname="org.jibx.binding.ant.CompileTask">
    <classpath>
      <path refid="jibx.classpath"/>
    </classpath>
  </taskdef>
</project>


Is there a magic variable that I could use instead of "target/classes"?  
Should the xml files I use go in "src/main" (what about src/etc)?  I 
tried create a JiBX magic plugin, but I got confused by the 
avalon-meta-tools example.  Must a plugin be defined in the index.xml 
and a .plugin file?  Which of those who should indicate what 
dependencies (jar's) are needed?  Must a task have a listener (I assume 
no)?  Where can you change the list of repositories to look for the jars?

Keep up the good work!  I hope to use Magic as the build tool for 
xsd2jibx in the near future.

Cameron



> Just add a <resource> definition to your index for the hbm2ddl jar, 
> then  you can use a property to access the repository location.
>
>     <x:property name="filepath" key="hbm2ddl" feature="path"/>
>
> The property "filepath" now contains the location of the hbm2ddl jar 
> file and you can use this to construct a <classpath> - for example:
>
>       <classpath>
>         <pathelement path="${magic.cache}/${filepath}"/>
>       </classpath>
>
> You can also use <x:path> but I need to get the docs in place on that 
> first of all.  Basically you can use <x:path> to get a dependency 
> chain as a proper ant path object that you can reference using refid.  
> The following example get the build time path for the current project:
>
>     <x:path id="build.path" mode="BUILD"/>
>
> Stephen.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.