Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Ant task to validate applicationContext.xml

  1. #1
    Join Date
    Aug 2004
    Posts
    4

    Default Ant task to validate applicationContext.xml

    Hi,

    Any support on the Ant tasks doing validation of applicationContext.xml ?
    ~Amit

  2. #2
    Join Date
    Aug 2004
    Location
    Frankfurt/Main, Germany
    Posts
    253

    Default

    Amit,

    currently an ANT task which validates Spring beans config files is not planned.

    But it can be done. All the code for the validation itself is already available in the core plugin. But this code leverages the project management stuff (config XML file ".springBeansProject") provided by the Eclipse plugin. The file and it's settings (list of config files and config sets) is maintained by the project properties dialog.

    If anybody has the time to investigate further...

    Regards,
    Torsten

  3. #3
    Join Date
    Aug 2004
    Location
    u.s.a
    Posts
    399

    Default Ant validation of bean definitions?

    If by validate one means 'XML validation', then Ant should be able to do this easily (?) using the Spring DTD.

    On my project I wrote an Ant target that validates an XML MVC definition file using XSD (I used BeanShell in Ant), so anything is possible.

    J. Betancourt

  4. #4
    Join Date
    Aug 2004
    Location
    Frankfurt/Main, Germany
    Posts
    253

    Default Re: Ant validation of bean definitions?

    Quote Originally Posted by jbetancourt
    If by validate one means 'XML validation', then Ant should be able to do this easily (?) using the Spring DTD.
    Yes, DTD validation is the easy part.

    Creating the entire BeanDefinitionRegistry from a single application context and validating it's (inner and outer) bean classes with their properties + constructor arguments + parent bean is the fun part. Doing this for a hierachy of application contexts (with additional checking for bean overrides) is more fun ;-).

    Regards,
    Torsten

  5. #5
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    I actually took a look at doing an ANT validator based on Torsten's code, essentially ripping out the Eclipse dependencies, which would not be very significant for that part of the codebase.

    The problem is that at the time (about a month ago), the Spring-IDE code was (and I believe still is) behind the current Spring version, so I put this off until such a time as

    a) the two are in sync, and
    b) I have some time :-)

    Regards,
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  6. #6
    Join Date
    Aug 2004
    Posts
    4

    Default

    Hi,

    Rite now i was trying to do xmlvalidaion using spring dtd.
    Following is the target i was using.

    <target name="xmlvalidate" description="Generates a report of code convention violations.">
    <xmlvalidate failonerror="yes" warn="yes">
    <fileset dir="${web.dir}/WEB-INF" includes="applicationContext.xml"/>
    <xmlcatalog>
    <dtd
    publicId="-//SPRING//DTD BEAN//EN"
    location="http://www.springframework.org/dtd/spring-beans.dtd"/>
    </xmlcatalog>
    </xmlvalidate>
    </target>

    And the result is:

    BUILD FAILED
    file:E:/eclipse_workspace/windows_2.1_M4/<project>/build/build.xml:109: Could not validate document E:\eclipse_workspace\windows_2.1_M4\<project>\buil d\<project>\WEB-INF\applicationContext.xml

    Any Idea wht could be the problem here? How could i get where is the problem or more verbose output ?

    Regards,
    ~Amit

  7. #7
    Join Date
    Aug 2004
    Posts
    4

    Default

    Hi,

    That worked when i changed the location to local directory.
    Probably now shld have a look at the Eclipse IDE code

    Thanks,
    ~Amit

  8. #8
    Join Date
    Aug 2004
    Posts
    4

    Default

    Hi,

    That worked when i changed the location to local directory.
    Probably now shld have a look at the Eclipse IDE code

    Thanks,
    ~Amit

  9. #9
    Join Date
    Sep 2004
    Location
    Berthoud, CO
    Posts
    13

    Default Test vs. Production XML Validation

    I'm concerned about maintaining the 2 xml files as our system grows. If I rename classes or add dependencies for example, I can easily work the kinks out of the spring-test.xml, but is there a way for me to "validate" the production spring.xml without waiting for runtime exceptions?

    And I'm referring to Torsten's more complex definition of validate here.

    I haven't yet tried out the Eclipse plugin, so is that the way to go?

    .rob.park.
    .rob.park.

  10. #10
    Join Date
    Aug 2004
    Posts
    107

    Default

    Is there any plan to support validation via ant?

    dino

Similar Threads

  1. Ant task
    By hucmuc in forum SpringSource Tool Suite
    Replies: 4
    Last Post: Mar 18th, 2006, 12:51 PM
  2. Spring jBPM - Task Assignment
    By msegvich in forum Spring-Modules
    Replies: 10
    Last Post: Jan 27th, 2006, 01:31 PM
  3. bat file for invoking beandoc ant task
    By ctassoni in forum Container
    Replies: 1
    Last Post: Aug 27th, 2005, 02:51 AM
  4. Only validate enabled components
    By afida in forum Swing
    Replies: 0
    Last Post: Jul 11th, 2005, 03:56 AM
  5. Replies: 2
    Last Post: Sep 2nd, 2004, 02:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •