Skip to content

Comments

Maven Build: Validate Thing-type XML against schema#18579

Merged
lsiepel merged 3 commits intoopenhab:mainfrom
andrewfg:validate-thing-xml-schema
Apr 19, 2025
Merged

Maven Build: Validate Thing-type XML against schema#18579
lsiepel merged 3 commits intoopenhab:mainfrom
andrewfg:validate-thing-xml-schema

Conversation

@andrewfg
Copy link
Contributor

I went to great extents to modify the thing-description xml schema to be stricter in validating semantic tags against pre-defined allowed values. But then I discovered that the standard Maven build process does not actually do any xml schema validation at all. Maybe it was deleted at some time? Anyway this PR adds back the schema validation.

Signed-off-by: Andrew Fiddian-Green software@whitebear.ch

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
@andrewfg andrewfg added the infrastructure Build system and Karaf related issues and PRs label Apr 18, 2025
@andrewfg andrewfg self-assigned this Apr 18, 2025
@andrewfg andrewfg requested a review from a team as a code owner April 18, 2025 21:29
@andrewfg
Copy link
Contributor Author

@jimtng .. for info.

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
@andrewfg
Copy link
Contributor Author

Ping @holgerfriedrich ..

Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@lsiepel lsiepel merged commit 8c5675d into openhab:main Apr 19, 2025
2 checks passed
@lsiepel lsiepel added this to the 5.0 milestone Apr 19, 2025
@jlaur
Copy link
Contributor

jlaur commented Apr 19, 2025

@andrewfg - do you know why sometimes builds failed with validation errors and sometimes they passed (before this PR)?

Copy link
Member

@J-N-K J-N-K left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andrewfg
Copy link
Contributor Author

do you know why [sometimes builds failed with validation errors and sometimes they passed (before this PR)

Honestly no. Perhaps the tests were removed recently??

@holgerfriedrich
Copy link
Member

holgerfriedrich commented Apr 19, 2025

Good to have the validation back in the build process.

Though, I have some issues with this PR:
When I try to run mvn install -pl :... to install a single plugin, it validates all xml files (this takes a while). See debug log from mvn -X ....
Second issue: When I run it from a plugin directory, it cannot properly locate `src/thing-type-xml-validation-catalog.xml

@andrewfg
Copy link
Contributor Author

andrewfg commented Apr 19, 2025

@holgerfriedrich there are 'directory' tags in the pom xml and the catalog xml files where we need to insert the right variable names to make it work. => Any thoughts?

// this should point to the directory where the build is started i.e. the `-pl` module location
<dir>${session.executionRootDirectory}</dir>

// this should always point to addons root directory
<catalog>${session.executionRootDirectory}/src/thing-type-xml-validation-catalog.xml</catalog>

holgerfriedrich added a commit to holgerfriedrich/openhab-addons that referenced this pull request Apr 20, 2025
* Fix failing validation in submodules (regression, openhab#18579)
* Skip schema validation when -DskipChecks is set

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
@holgerfriedrich
Copy link
Member

@holgerfriedrich there are 'directory' tags in the pom xml and the catalog xml files where we need to insert the right variable names to make it work. => Any thoughts?

// this should point to the directory where the build is started i.e. the `-pl` module location
<dir>${session.executionRootDirectory}</dir>

// this should always point to addons root directory
<catalog>${session.executionRootDirectory}/src/thing-type-xml-validation-catalog.xml</catalog>

It took me a while to find that we use directory-maven-plugin which sets basedirRoot - exactly what we need here. See #18581.

But I have not found a solution for the issue that it validates all xml files when mvn install -pl :... is run.

J-N-K pushed a commit that referenced this pull request Apr 20, 2025
* Fix failing validation in submodules (regression, #18579)
* Skip schema validation when -DskipChecks is set

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
holgerfriedrich added a commit to holgerfriedrich/openhab-addons that referenced this pull request Apr 23, 2025
* Move validation to subprojects, skip on top level to avoid double
  executuon (regression, openhab#18579)

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/californium-removed/163625/40

holgerfriedrich added a commit to holgerfriedrich/openhab-addons that referenced this pull request Apr 25, 2025
* Move validation to subprojects, skip on top level to avoid double
  executuon using a marker file (regression, openhab#18579)

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
holgerfriedrich added a commit to holgerfriedrich/openhab-addons that referenced this pull request Apr 25, 2025
* Move validation to subprojects, skip on top level to avoid double
  execution using a marker file (regression, openhab#18579)

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
holgerfriedrich added a commit to holgerfriedrich/openhab-addons that referenced this pull request Apr 25, 2025
* Move validation to subprojects, skip on top level to avoid double
  execution using a marker file (regression, openhab#18579)

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Nadahar pushed a commit to Nadahar/openhab-addons that referenced this pull request Apr 26, 2025
Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
wborn pushed a commit that referenced this pull request Apr 26, 2025
* Move validation to subprojects, skip on top level to avoid double
  execution using a marker file (regression, #18579)

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
wborn pushed a commit that referenced this pull request Apr 26, 2025
Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
phenix1990 pushed a commit to phenix1990/openhab-addons that referenced this pull request Jul 31, 2025
* Maven Build: Validate Thing-type XML against schema

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
phenix1990 pushed a commit to phenix1990/openhab-addons that referenced this pull request Jul 31, 2025
* Fix failing validation in submodules (regression, openhab#18579)
* Skip schema validation when -DskipChecks is set

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
phenix1990 pushed a commit to phenix1990/openhab-addons that referenced this pull request Jul 31, 2025
* Move validation to subprojects, skip on top level to avoid double
  execution using a marker file (regression, openhab#18579)

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
phenix1990 pushed a commit to phenix1990/openhab-addons that referenced this pull request Jul 31, 2025
)

Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
@andrewfg andrewfg deleted the validate-thing-xml-schema branch December 14, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Build system and Karaf related issues and PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants