Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<properties>
<java.version>21</java.version>
<maven.version>3.9.9</maven.version>
<!-- version should match ivy Engine sfl4j version! And version in EngineClassLoaderFactory.SLF4J_VERSION -->
<slf4j.version>2.0.13</slf4j.version>
<junit-jupiter.version>5.12.2</junit-jupiter.version>
<site.path>snapshot</site.path>
Expand Down Expand Up @@ -207,6 +206,16 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/resources-filtered</directory>
<targetPath>ch/ivyteam/ivy/maven/engine</targetPath>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.function.Predicate;

import org.apache.maven.artifact.Artifact;
Expand Down Expand Up @@ -53,8 +54,7 @@ public interface OsgiDir {
String LIB_BOOT = "lib/boot";
}

/** must match version in pom.xml */
private static final String SLF4J_VERSION = "2.0.13";
private static final String SLF4J_VERSION = readSlf4jVersion();
Copy link
Member Author

Choose a reason for hiding this comment

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

no more manual syncing of versions 👋


private static final List<String> ENGINE_LIB_DIRECTORIES = Arrays.asList(
OsgiDir.INSTALL_AREA + "/" + OsgiDir.LIB_BOOT,
Expand Down Expand Up @@ -90,6 +90,17 @@ public List<File> getSlf4jJars() {
maven.getJar("org.slf4j", "log4j-over-slf4j", SLF4J_VERSION));
}

private static String readSlf4jVersion() {
String versions = "versions.properties";
try (var in = EngineClassLoaderFactory.class.getResourceAsStream(versions)) {
Properties props = new Properties();
props.load(in);
return props.getProperty("slf4j", "");
} catch (IOException ex) {
throw new RuntimeException("Failed to read SLF4j version from file: " + versions, ex);
}
}

public static List<File> getOsgiBootstrapClasspath(Path engineDirectory) {
if (engineDirectory == null || !Files.isDirectory(engineDirectory)) {
throw new RuntimeException("The engineDirectory is missing: " + engineDirectory);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources-filtered/versions.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
slf4j=${slf4j.version}
Loading