updated dependencies
All checks were successful
CI / build (push) Successful in 2m4s

This commit is contained in:
2026-03-12 21:32:18 +08:00
parent bd1bc9c997
commit e23e12266e
15 changed files with 703 additions and 63 deletions

View File

@@ -20,18 +20,14 @@ abstract class AbstractVersionProvider implements CommandLine.IVersionProvider {
protected AbstractVersionProvider(String specificationTitle) {
String version = null;
String vcsHash = null;
Enumeration<URL> it = getClass().getClassLoader().getResources(JarFile.MANIFEST_NAME);
while (it.hasMoreElements()) {
URL manifestURL = it.nextElement();
Manifest mf = new Manifest();
try (InputStream inputStream = manifestURL.openStream()) {
mf.read(inputStream);
}
Attributes mainAttributes = mf.getMainAttributes();
if (Objects.equals(specificationTitle, mainAttributes.getValue(Attributes.Name.SPECIFICATION_TITLE))) {
version = mainAttributes.getValue(Attributes.Name.SPECIFICATION_VERSION);
vcsHash = mainAttributes.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
}
final Manifest mf = new Manifest();
try(InputStream is = getClass().getModule().getResourceAsStream(JarFile.MANIFEST_NAME)) {
mf.read(is);
}
Attributes mainAttributes = mf.getMainAttributes();
if (Objects.equals(specificationTitle, mainAttributes.getValue(Attributes.Name.SPECIFICATION_TITLE))) {
version = mainAttributes.getValue(Attributes.Name.SPECIFICATION_VERSION);
vcsHash = mainAttributes.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
}
if (version == null || vcsHash == null) {
throw new RuntimeException("Version information not found in manifest");