When a module is loaded, it should be easy to
validate its XML metadata against XML Schemas.
Maybe plugged into a more general API that lets a
project mark itself as erroneous and provide a
Especially valuable for freeform project type
which would have a particularly complex project.xml.
Perhaps for E.
*** Issue 48987 has been marked as a duplicate of this issue. ***
Freeform project.xml automatic validation already uses a registered
local schema location (see freeform SPI). For other project types,
there is not yet any registration mechanism, so only web locations are
permitted (i.e. you need to have a network connection and proper
*** Issue 59560 has been marked as a duplicate of this issue. ***
*** Issue 59807 has been marked as a duplicate of this issue. ***
*** Issue 96068 has been marked as a duplicate of this issue. ***
*** Issue 104516 has been marked as a duplicate of this issue. ***
I am working on this.
*** Issue 47288 has been marked as a duplicate of this issue. ***
Created attachment 63910 [details]
Patch in progress
Please review the attached patch. (A detailed summary of changes can be found in the header of the patch.) To be done
1. Register schemas for other project types: web, EJB, etc.
2. Add more unit tests in project.ant for new behavior.
3. Spec version changes, apichanges.xml & arch.xml where needed.
4. Some better quality of implementation in AntProjectHelper - clearer error reporting, better error recovery.
5. Caching of schemas between calls to validate so they do not need to be parsed repeatedly.
Looks OK to me. Considering it is just registration would you mind fixing also 4 j2ee project types? (web.project,
j2ee.ejbjarproject, j2ee.earproject and j2ee.clientproject). If not file an issue please and somebody might fix it in
next year or two.
Yes, as in #1 I would register schemas for all project types, plus jaxws and any other misc stuff that registers
project-related schemas I find.
Registering schemas for everything except Ruby, SOA, Scala, and Erlang project types (filed as dependencies).
Integrated into 'main-golden', available in NB_Trunk_Production #324 build
User: Jesse Glick <email@example.com>
Log: Issue #42686: consistent validation of project metadata according to schema.
1. XMLUtil.validate utility method added.
2. XML catalog for project metadata now read from ProjectXMLCatalog in the system filesystem, not the web.
Register http://www.netbeans.org/ns/foo/1 as ProjectXMLCatalog/foo/1.xsd to be found.
3. Validate project.xml/private.xml according to schemas found in ProjectXMLCatalog:
a. When loading a project, if project.xml is invalid then make the load fail.
(Effectively preventing older IDEs from trying to load newer IDEs' projects, if schemas changed.)
b. Validate before saving project.xml/private.xml, to guard against buggy module code.
c. Validate before loading project.xml/private.xml, to guard against e.g. bad user edits or VCS conflict markers.
Note that e.g. <configuration> uses lax subelement processing, so children with no matching schemas will be skipped.
4. Remove logic to display validation errors of freeform project.xml in Output Window.
Users can anyway use A-S-F9 to use the regular Validate action before saving.
5. ant.freeform.ProjectNature.getSchemas removed (natures need no longer implement it).
oops, wrong typing this issue