mirror of
https://github.com/CarmJos/MineSQL.git
synced 2024-09-19 20:25:45 +00:00
chore: 移除无用代码。
This commit is contained in:
parent
e6fad85438
commit
fff84fafae
@ -17,7 +17,7 @@ public class DBPropertiesUtil {
|
|||||||
if (!propertiesFolder.exists() || !propertiesFolder.isDirectory()) return propertiesMap;
|
if (!propertiesFolder.exists() || !propertiesFolder.isDirectory()) return propertiesMap;
|
||||||
|
|
||||||
File[] files = propertiesFolder.listFiles();
|
File[] files = propertiesFolder.listFiles();
|
||||||
if (files == null || files.length == 0) return propertiesMap;
|
if (files == null) return propertiesMap;
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
if (!validateName(file.getName())) continue;
|
if (!validateName(file.getName())) continue;
|
||||||
String name = file.getName().substring(0, file.getName().lastIndexOf("."));
|
String name = file.getName().substring(0, file.getName().lastIndexOf("."));
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
package cc.carm.plugin.minesql.util;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class MavenReadUtil {
|
|
||||||
|
|
||||||
public static String getMavenPropertiesPath(@NotNull String groupID, @NotNull String artifactID) {
|
|
||||||
return String.format("/META-INF/maven/%s/%s/pom.properties", groupID, artifactID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized @Nullable String getVersion(@NotNull Object provider,
|
|
||||||
@NotNull String groupID,
|
|
||||||
@NotNull String artifactID) {
|
|
||||||
String path = getMavenPropertiesPath(groupID, artifactID);
|
|
||||||
String version = null;
|
|
||||||
// Using maven properties to get the version
|
|
||||||
try (InputStream is = provider.getClass().getResourceAsStream(path)) {
|
|
||||||
if (is != null) {
|
|
||||||
Properties p = new Properties();
|
|
||||||
p.load(is);
|
|
||||||
version = p.getProperty("version", "");
|
|
||||||
}
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version != null) return version;
|
|
||||||
|
|
||||||
// Fine, lets try Java API
|
|
||||||
Package pkg = provider.getClass().getPackage();
|
|
||||||
if (pkg != null) {
|
|
||||||
version = pkg.getImplementationVersion();
|
|
||||||
if (version == null) {
|
|
||||||
version = pkg.getSpecificationVersion();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user