[ http://jira.codehaus.org/browse/MNG-897?page=comments#action_47171 ] 

John Casey commented on MNG-897:
--------------------------------

We have to have some way of embedding metadata for binding the Ant script into 
Maven as a mojo (or set of mojos). To that end, what I'd thought of doing was 
embedding an XML metadata section inside a comment at the top of the build.xml 
script. Then, the plugin tools could pull this XML out of the comment, parse 
it, and generate plugin bindings based on it. This will avoid any tricks 
related to suppressing task execution that might happen if we tried to create a 
custom antlib for specifying metadata, and it will allow editing the metadata 
using an XSD-aware editor, provided you edit outside of the XML comment, then 
comment it out. This may seem a little strange, so I wanted to solicit some 
feedback. Basically, we're talking about something like this:

build.xml
===========================================
<!--
  <mojoMetadata>

    <mojo goal="myGoal" phase="generate-sources">
      <description>This goal does something really cool</description>
      <parameters>
        <parameter name="basedir" expression="${basedir}" required="true" 
type="java.io.File"/>
      </parameters>
      <call>myGoalTarget</call>
    </mojo>

    <mojo goal="defaultGoal" phase="compile">
      <description>This goal does something really cool</description>
      <parameters>
        <parameter name="basedir" expression="${basedir}" required="true" 
type="java.io.File"/>
      </parameters>
    </mojo>

  </mojoMetadata>
-->
<project default="someTarget">
  <echo>This is a test script</echo>

  <target name="someTarget">
    <javac .../>
  </target>

  <target name="myGoalTarget">
    <!-- do something really cool here -->
  </target>

  <target name="anotherGoalTarget">
    <!-- do something less cool -->
  </target>
</project>

The embedded XML would not be processed by Ant at all, but will retain the 
advantage of being colocated with the script it marks up. I suspect we may even 
be able to make the metadata XML general enough to be reused outside the 
context of Ant scripts (in jython, perhaps, or beanshell, or something...). 
What makes this really easy is that we can read each script file as a String, 
substring to get the metadata, and parse that...all without having to maintain 
code to parse the entire file as an Ant script. And any standard XML editor 
could be used to write that metadata...before you comment it out, of course.

So, I need comments on this before I go forward. What do you all think? If it's 
too out-there, I'd really like to get some alternative suggestions.

> allows use of Ant build files
> -----------------------------
>
>          Key: MNG-897
>          URL: http://jira.codehaus.org/browse/MNG-897
>      Project: Maven 2
>         Type: Improvement
>   Components: maven-ant-plugin
>     Versions: 2.0-alpha-3
>     Reporter: Chris Berry
>     Assignee: John Casey
>      Fix For: 2.0-beta-3
>  Attachments: antfile.zip
>
> Original Estimate: 8 hours
>        Time Spent: 6 hours
>         Remaining: 2 hours
>
> Per John Casey, This is logged to that it stays on the radar.
> Please consider incorporating my antfile plugin.
> I have included the following in the ZIP
> maven-antrun-plugin --> the basic antrun w/ a few small mods
> maven-antfile-plugin
> maven-axisant-plugin --> an example plugin using the antfile plugin
> axis-master --> a "grouping" plugin for axis example
> my-app --> an example app using the axisant plugin.
> Cheers,
> -- Chris 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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

Reply via email to