feat: Wire project version to System properties before execution

This commit is contained in:
Andres Almiray 2025-01-21 19:27:29 +01:00
parent b5e068a90a
commit 926eb906f4
No known key found for this signature in database
GPG key ID: CCC55C5167419ADB

View file

@ -58,7 +58,7 @@ public abstract class AbstractJReleaserOperation<S extends AbstractJReleaserOper
protected BaseProject getProject() { protected BaseProject getProject() {
return project_; return project_;
} }
protected void setOption(String key, String value) { protected void setOption(String key, String value) {
options_.put(key, value); options_.put(key, value);
} }
@ -125,11 +125,12 @@ public abstract class AbstractJReleaserOperation<S extends AbstractJReleaserOper
List<String> args = new ArrayList<>(); List<String> args = new ArrayList<>();
if (project_ != null) { if (project_ != null) {
System.setProperty("JRELEASER_PROJECT_VERSION", project_.version().toString());
args.add(javaTool()); args.add(javaTool());
args.add("-cp"); args.add("-cp");
args.add(String.format("%s:%s:%s:%s", new File(project_.libTestDirectory(), "*"), args.add(String.format("%s:%s:%s:%s", new File(project_.libTestDirectory(), "*"),
new File(project_.libCompileDirectory(), "*"), project_.buildMainDirectory(), new File(project_.libCompileDirectory(), "*"), project_.buildMainDirectory(),
project_.buildTestDirectory())); project_.buildTestDirectory()));
args.add("org.jreleaser.cli.Main"); args.add("org.jreleaser.cli.Main");
args.add(getCommand()); args.add(getCommand());