Update to JDK 25, bump dependencies#495
Conversation
This is very prone to being out-of-sync from the action itself while not providing much value. Action files are themselves fairly self-explanatory. If something in an action is not obvious, it should be documented directly in place via comments instead to reduce the risk of those comments becoming stale and/or being ignored when modifying the workflow.
|
I just noticed SimPaths was still using the old version of |
There was a problem hiding this comment.
Pull request overview
This PR upgrades the project’s Java toolchain target to JDK 25, modernizes dependencies (notably moving from Log4j 1.x to Log4j 2), and updates CI + documentation to align with the new requirements while reducing duplicated setup text.
Changes:
- Target Java 25 via Maven compiler
releaseand update CI workflows to build/test/publish Javadoc with JDK 25. - Migrate application logging imports/usages from
org.apache.log4jto Log4j 2 (org.apache.logging.log4j), including updating MultiRun file logging setup. - Streamline “getting started” and developer docs by centralizing environment requirements in one page and linking to it.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/simpaths/model/SimPathsModel.java | Switch logger from Log4j 1 to Log4j 2. |
| src/main/java/simpaths/model/Person.java | Switch logger from Log4j 1 to Log4j 2. |
| src/main/java/simpaths/model/lifetime_incomes/ManagerProjectLifetimeIncomes.java | Remove Log4j 1 import; accept Log4j 2 logger type in API. |
| src/main/java/simpaths/model/Household.java | Switch logger from Log4j 1 to Log4j 2. |
| src/main/java/simpaths/model/BenefitUnit.java | Switch logger from Log4j 1 to Log4j 2. |
| src/main/java/simpaths/experiment/SimPathsObserver.java | Remove unused Log4j 1 logger field. |
| src/main/java/simpaths/experiment/SimPathsMultiRun.java | Migrate logging and file-appender setup to Log4j 2. |
| src/main/java/simpaths/experiment/SimPathsCollector.java | Switch logger from Log4j 1 to Log4j 2. |
| pom.xml | Set Java release to 25 and bump multiple dependencies/plugins (JUnit/Log4j/etc.). |
| documentation/wiki/getting-started/index.md | Remove duplicated prerequisites section and link to setup steps. |
| documentation/wiki/getting-started/environment-setup.md | Update requirements to JDK 25 + newer Maven and centralize setup info. |
| documentation/wiki/developer-guide/working-in-github.md | Replace inline JDK requirement with link to environment setup. |
| documentation/wiki/developer-guide/internals/multirun-implementation.md | Replace Java/Maven prereqs with link to environment setup. |
| documentation/wiki/developer-guide/internals/api.md | Remove duplicated workflow snippet; keep high-level deployment note. |
| .github/workflows/SimPathsBuild.yml | Update CI jobs to use JDK 25. |
| .github/workflows/publish-javadoc.yml | Update Javadoc publishing workflow to use JDK 25. |
Comments suppressed due to low confidence (1)
src/main/java/simpaths/experiment/SimPathsMultiRun.java:304
- The new
-fpath now configures a Log4j2 file appender and redirectsSystem.out, but there is no automated test covering this option (there are already unit tests for-hand bad config handling). Adding a test that runsmainwith-fand asserts the log/console files are created (or that configuration occurs without throwing) would help prevent regressions.
if (cmd.hasOption("f")) {
try {
File logDir = new File("output/logs");
if (!logDir.exists()) {
logDir.mkdirs();
}
// Writing console outputs to `run_[seed].txt
System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream(logDir.getPath() + "/run_" + randomSeed + ".txt")), true));
// Writing logs to `run_[seed].log`
var layout = PatternLayout.newBuilder().setPattern("%d{yyyy MMM dd HH:mm:ss} - %m%n").build();
var appender = FileAppender.newBuilder()
.setFileName(logDir.getPath() + "/run_" + randomSeed + ".log")
.setName("Run logging")
.setAppend(false)
.setLayout(layout)
.build();
Configurator.setRootLevel(Level.DEBUG);
var configuration = LoggerContext.getContext().getConfiguration();
configuration.getRootLogger().addAppender(appender, Level.DEBUG, null);
Configurator.reconfigure(configuration);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var layout = PatternLayout.newBuilder().setPattern("%d{yyyy MMM dd HH:mm:ss} - %m%n").build(); | ||
| var appender = FileAppender.newBuilder() | ||
| .setFileName(logDir.getPath() + "/run_" + randomSeed + ".log") | ||
| .setName("Run logging") | ||
| .setAppend(false) | ||
| .setLayout(layout) | ||
| .build(); | ||
| Configurator.setRootLevel(Level.DEBUG); | ||
| var configuration = LoggerContext.getContext().getConfiguration(); | ||
| configuration.getRootLogger().addAppender(appender, Level.DEBUG, null); | ||
| Configurator.reconfigure(configuration); |
There was a problem hiding this comment.
I'm not sure what to take or ignore from this, but given its suggestion to use withPattern() instead of setPattern() whilst withPattern() is marked as deprecated, I'm going to assume this is copilot generating nonsense again.
There was a problem hiding this comment.
I needed to change <maven.compiler.release>25</maven.compiler.release> into <maven.compiler.release>19</maven.compiler.release> to run the model on my machine.
There was a problem hiding this comment.
I needed to change
<maven.compiler.release>25</maven.compiler.release>into<maven.compiler.release>19</maven.compiler.release>to run the model on my machine.
@amorison: the rest is fine. I can merge the PR once this is sorted.
There was a problem hiding this comment.
The main point of this PR is to update to Java 25, so it would be great to understand why this doesn't work for you and whether there is an actual issue to solve here. What's the error message that you get? Have you installed a recent version of the JDK (and maven) on your machine? Either 25 or 26 (the latest at the time of writing this comment) would work.
The reason I settled on 25 is that this is the latest LTS release as of now. Note that JDK 19 was never an LTS and has reached end-of-life in 2023, so this wasn't a great choice in the first place (and at the very least, should have been updated to JDK 21 when it became available). See this for a summary of releases and support dates: https://endoflife.date/oracle-jdk
This PR also reduces some duplication in the documentation to reduce the risk of parts of the documentation being out-of-sync.