Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix caching bug #298

Merged
merged 2 commits into from
Jun 9, 2024
Merged
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
8 changes: 3 additions & 5 deletions ui/src/main/java/org/eclipse/starter/ui/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ public class Project implements Serializable {
private static final Map<String, String> RUNTIMES = Map.ofEntries(entry("glassfish", "GlassFish"),
entry("open-liberty", "Open Liberty"), entry("payara", "Payara"), entry("tomee", "TomEE"),
entry("wildfly", "WildFly"));

private static final String DEFAULT_GROUPID = "org.eclipse";;

private static final String DEFAULT_GROUPID = "org.eclipse";
private static final String DEFAULT_ARTIFACTID = "jakartaee-hello-world";

private static Map<String, String> cache = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -402,7 +400,7 @@ public void generate() {
LOGGER.info("Downloading zip file.");
downloadZip(new File(workingDirectory, artifactId + ".zip"));

// caching makes only sense if defaults weren't changed since otherwise it's unlikely to hit cache
// Caching makes only sense if defaults weren't changed since otherwise it's unlikely to hit cache.
if (groupId.equals(DEFAULT_GROUPID) && artifactId.equals(DEFAULT_ARTIFACTID)) {
LOGGER.info("Caching output.");
cache.put(getCacheKey(), workingDirectory.getAbsolutePath());
Expand All @@ -422,7 +420,7 @@ public void generate() {
}

private String getCacheKey() {
return jakartaVersion + ":" + profile + ":" + javaVersion + ":" + docker + ":" + runtime;
return jakartaVersion + ":" + profile + ":" + javaVersion + ":" + docker + ":" + runtime + ":" + groupId + ":" + artifactId;
}

private void downloadZip(File zip) {
Expand Down
Loading