Skip to content

Commit

Permalink
Ensure Gradle new project picks up latest Gradle version for wrapper …
Browse files Browse the repository at this point in the history
…where intended.

Trigger project load after wrapper is configured.
Remove --offline flag from wrapper initialization.
  • Loading branch information
neilcsmith-net committed Feb 5, 2024
1 parent 0c7c18d commit 57a3a31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public Set<FileObject> execute() {
args.add("--gradle-version"); //NOI18N
args.add(version);
}
pconn.newBuild().withArguments("--offline").forTasks(args.toArray(new String[0])).run(); //NOI18N
pconn.newBuild().forTasks(args.toArray(new String[0])).run(); //NOI18N
} catch (GradleConnectionException | IllegalStateException ex) {
// Well for some reason we were not able to load Gradle.
// Ignoring that for now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ static void collectOperationsForType(Map<String, Object> params, TemplateOperati
final File root = new File(loc, name);

ops.createGradleInit(root, type).basePackage(packageBase).projectName(name).dsl("groovy").add(); // NOI18N
ops.addProjectPreload(root);
ops.addProjectPreload(new File(root, subFolder));

Boolean initWrapper = (Boolean) params.get(PROP_INIT_WRAPPER);
if (initWrapper == null || initWrapper) {
Expand All @@ -76,6 +74,10 @@ static void collectOperationsForType(Map<String, Object> params, TemplateOperati
} else {
// @TODO delete wrapper added by init?
}

ops.addProjectPreload(root);
ops.addProjectPreload(new File(root, subFolder));

}

}

0 comments on commit 57a3a31

Please sign in to comment.