Hi,
Any support on the Ant tasks doing validation of applicationContext.xml ?
Hi,
Any support on the Ant tasks doing validation of applicationContext.xml ?
~Amit
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
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
Yes, DTD validation is the easy part.Originally Posted by jbetancourt
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
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
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
Hi,
That worked when i changed the location to local directory.
Probably now shld have a look at the Eclipse IDE code
Thanks,
~Amit
Hi,
That worked when i changed the location to local directory.
Probably now shld have a look at the Eclipse IDE code
Thanks,
~Amit
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.
Is there any plan to support validation via ant?
dino