Skip to content

Commit

Permalink
Merge pull request #298 from m-reza-rahman/master
Browse files Browse the repository at this point in the history
Fix caching bug
  • Loading branch information
Reza Rahman authored Jun 9, 2024
2 parents a4a6137 + 3ab47ce commit c79187a
Showing 1 changed file with 3 additions and 5 deletions.
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

0 comments on commit c79187a

Please sign in to comment.