Skip to content

chore: publish XSDs upon deployment and validate generated pom lock files are valid #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 30, 2025

Conversation

smaarn
Copy link
Contributor

@smaarn smaarn commented May 25, 2025

Objective of this PR is to do two things:

  1. Ensure generated lock files are validated against eligible XSDs (Fixes Add test that validates the generated POM lock file towards the schema #89)
  2. Publish automatically XSD resources upon releasing

Worth noting:

  1. XSD resources publishing is currently relying on the maven "site" workflow but could be left to a github action
  2. It requires giving the "release" job with permissions to write contents (the same would apply to the github action usage TBH)

Comment on lines +530 to +538
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version>
<type>jar</type>
<scope>test</scope>
<optional>false</optional>
<dependency-lock:integrity>sha512:zc6+j6WFJ6G8faDBjpCpVHzorJnMz+VleGDColR4wDDqdYJR2j4ypx6rnLuRNgaStcbFiHofFZfR/aBxUbJ+Xw==</dependency-lock:integrity>
</dependency>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New dependency effectively added (for testing only)

Copy link
Contributor Author

@smaarn smaarn May 25, 2025

Choose a reason for hiding this comment

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

  • Add a test dependency for logging purposes
  • Added Xerces Impl libraries supporting XML Schema 1.1
  • Add a plugin for publishing the staged site to github
  • Add a plugin to be able to generate and use test XSDs

Comment on lines 2589 to 2848
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
<version>2.7.0</version>
<type>jar</type>
<dependency-lock:integrity>sha512:a6KwwY08ayyyD6wSSXqYOmkeVUqiH4P18Os+IzpGdF+sw3tT2JB4WkgH77ZKScpHJC7+bqlsFELpfqIQYMCvOA==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-osgi</artifactId>
<version>2.7.0</version>
<type>jar</type>
<dependency-lock:integrity>sha512:yUv2WnT8f0RzWzx9rZqc1cyQYXSxlhW7FrbTJc6m41hFAuqaSBP3FT3NpKnd8IInAMmsc+BWyitdxl20wGEK0A==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-sftp</artifactId>
<version>2.7.0</version>
<type>jar</type>
<dependency-lock:integrity>sha512:m0pFn5JMdKMX41VRki5lsXa3nuogDq3S5q17AxdzibdSDVi2qwR/akZTSu+jJFVI5JNHgfKi7uzStrigDML0hw==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-cipher</artifactId>
<version>2.0</version>
<type>jar</type>
<dependency-lock:integrity>sha512:jxh7B4Z6fCnXdFSq5LdkeTACONnE53fBr6KuvjO4jauRbikRHdVaysE0GEn0V5/pGlRw/dRcy6DgVwnCzjodZQ==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-interactivity-api</artifactId>
<version>1.3</version>
<type>jar</type>
<dependency-lock:integrity>sha512:rd9HrDaBluUmIjJOydA/b7ePh9wlNM18nrTxMNESQt7BJ3jbuk+MQFfVaosrxWZzQy4LDdhwCsbLF7fFkEKm8w==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-interpolation</artifactId>
<version>1.27</version>
<type>jar</type>
<dependency-lock:integrity>sha512:NK4TmedVYNauxnQ8434Q0iNjQuxYFFw/3XsDNA9O0+9QD4JMhF1FLbuMPxTRGMhVcH3koIAHT6Vy2vfM/vTd3w==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-sec-dispatcher</artifactId>
<version>2.0</version>
<type>jar</type>
<dependency-lock:integrity>sha512:rU6BTIuv94Ck7uBkkD5SsJrgBCCln7B173LbuNZNEtPVAJsD1WwV+TWH2THDp/BsrWNRqy3JQVzMbuqw2uvrBw==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>4.0.1</version>
<type>jar</type>
<dependency-lock:integrity>sha512:7PYJ1JXJ53KEdso11CkMlNhiw5OvxqmAkFcfQEfUGE0cUjH9avS8aP59gy7KJhcfhq9exZDW8vcHQLcgpvY2tQ==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-xml</artifactId>
<version>3.0.0</version>
<type>jar</type>
<dependency-lock:integrity>sha512:MbaKAlqyZY/lnV+7eaJCVWA5Lj2ydGsKuAWEaliBbEI13W1Q7T7S1JGfdJTgWAdTcbspaU9KquNwyeDKouVSRQ==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.ssh.apache</artifactId>
<version>5.13.3.202401111512-r</version>
<type>jar</type>
<dependency-lock:integrity>sha512:YQ5xWesdGwBdAHXNzglG6VouootDuOw3LLsVOFN4riGZsMrkuqNM1CVVuMNOYUjx9NGCOjJpm9ID0i484tQ1mg==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>5.13.3.202401111512-r</version>
<type>jar</type>
<dependency-lock:integrity>sha512:0CcRWumPQbpI98UK+A6PmTZCKErtYajWY2cgOwNgokuWIiEeuXTsprjvMCgrwJcEOAv+YVWrOFVt6nuQBr0ysw==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.6.1</version>
<type>jar</type>
<dependency-lock:integrity>sha512:gWQtt2NY+/Ex3+nC8dnCgPwjtr/eahai022sxJChoq9OD7Srtc14AFcYux0VikL9aDTNK/5hbsWWJd8BlR8keA==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.36</version>
<type>jar</type>
<dependency-lock:integrity>sha512:rCMatEUhu1R4dCrxNiTbXBSuqAnDosE7mJ+6MBhrptuEDy0bSupU+cH3eVR7l1/QQt01P1QCVZJ3TUAZK9cRSA==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
<type>jar</type>
<dependency-lock:integrity>sha512:+bAz/AGaRPmLFgSNp+K1nt1KalJ7pg41j2WriOCvrgOpNA8bPopUPUn6VCKQ9JnFWUJZr/of8+bnvztCjUxhCw==</dependency-lock:integrity>
</dependency>
</dependencies>
<dependency-lock:integrity>sha512:DWOWDQgfaye/tpgDXbqsqZo5PVOxe0VIYiLAPOW5vRVufFPauScNXiJGnoxlTY1ZTaA2LxOKA3I2roORPrE4bQ==</dependency-lock:integrity>
</plugin>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Plugin added to publish to SCM the generated site

</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Plugin added to be able to attach test resources (for testing and IDE integration)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ordering of dependency-lock:integrity elements

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ordering of dependency-lock:integrity elements

@smaarn smaarn force-pushed the chore/add-xsd-testing branch from 8af4291 to 20e7ab1 Compare May 25, 2025 09:50
<plugin>
<groupId>${plugin.artifactIdentifier.groupId}</groupId>
<artifactId>${plugin.artifactIdentifier.artifactId}</artifactId>
<version>${plugin.version}</version>
<dependency-lock:integrity>${plugin.getIntegrityForLockFile()}</dependency-lock:integrity>
Copy link
Owner

Choose a reason for hiding this comment

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

Do this need to change place? I think it belongs where it is conceptually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Found a way to revert this change by switching to a custom Xerces Impl package supporting XML Schema 1.1

Indeed there was the following issues:

  • Using standard Xerces library shipped with JDK seems to not work (because in XML Schema 1.0 you cannot "extend" a complex type containing an "all" clause)
  • Using Woodstox led to the validator code used to fail if ordering wasn't respected (it seemed to expect first all parent content and then child content... Don't ask me why but it didn't like the "dependencies" node appearing after dependency-lock:integrity 🤷 )

…te against XSD (allows relaxing the ordering constraint)
@@ -113,6 +113,15 @@
<optional>false</optional>
<dependency-lock:integrity>sha512:mLxmXBYmj/EHT0FfSTumbSFKwjZltulkCGtg1SOzWxsD/S55IR6Eqo6/CSHqAo+ZKCfkZC/QhtcQSkCLRU04zg==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>edu.princeton.cup</groupId>
<artifactId>java-cup</artifactId>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used by Xerces Impl XML Schema 1.1 Validation classes

@@ -473,6 +482,25 @@
<optional>false</optional>
<dependency-lock:integrity>sha512:aMXfAa1SKRfZVLYss7ETdrNEaSDo1cs1c33lCOas2Ro2s0FEkz9Ce74dKdypCXup3SQxxxP+GAafJxqAtRnwUQ==</dependency-lock:integrity>
</dependency>
<dependency>
<groupId>org.exist-db.thirdparty.org.eclipse.wst.xml</groupId>
<artifactId>xpath2</artifactId>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used by Xerces Impl XML Schema 1.1 Validation classes

</dependency>
<dependency>
<groupId>org.exist-db.thirdparty.xerces</groupId>
<artifactId>xercesImpl</artifactId>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Manually crafted XML Schema 1.1 Supporting Xerces Implementation wrapper (https://blog.adamretter.org.uk/xerces-xsd11-maven/ for the credits)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file wasn't appropriately formatted it seems 🤦

@smaarn smaarn marked this pull request as ready for review May 26, 2025 19:20
@smaarn smaarn requested a review from vandmo May 26, 2025 19:23
@vandmo vandmo merged commit 0083f84 into vandmo:master May 30, 2025
2 checks passed
@smaarn smaarn deleted the chore/add-xsd-testing branch May 31, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add test that validates the generated POM lock file towards the schema
2 participants