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

Grails 7, Gracefully handle different JDK versions between Release and Snapshot versions #405

Open
jamesfredley opened this issue Oct 16, 2024 · 0 comments

Comments

@jamesfredley
Copy link
Contributor

jamesfredley commented Oct 16, 2024

Switching from 6.0.21 to 7.0.0-SNAPSHOT currently causes the UI (https://start.grails.org/) to display a blank screen due to Java 11 no longer being a supported option in 7.0.0-SNAPSHOT.

This could alternatively be addressed on: https://github.com/grails/grails-forge-ui

If binding fails, it should default to JdkVersion.DEFAULT_OPTION instead of returning a 400 error (Bad request).

https://snapshot.grails.org/application-types/WEB/features/default?gorm=HIBERNATE&servlet=TOMCAT&test=SPOCK&javaVersion=JDK_11

{"message":"Bad Request","_links":{"self":{"href":"/application-types/WEB/features/default?gorm=HIBERNATE&servlet=TOMCAT&test=SPOCK&javaVersion=JDK_11","templated":false}},"_embedded":{"errors":[{"message":"Failed to convert argument [javaVersion] for value [JDK_11] due to: No enum constant org.grails.forge.options.JdkVersion.JDK_11","path":"/javaVersion"}]}}

https://snapshot.grails.org/application-types/WEB/features?gorm=HIBERNATE&servlet=TOMCAT&test=SPOCK&javaVersion=JDK_11

{"message":"Bad Request","_links":{"self":{"href":"/application-types/WEB/features?gorm=HIBERNATE&servlet=TOMCAT&test=SPOCK&javaVersion=JDK_11","templated":false}},"_embedded":{"errors":[{"message":"Failed to convert argument [javaVersion] for value [JDK_11] due to: No enum constant org.grails.forge.options.JdkVersion.JDK_11","path":"/javaVersion"}]}}

@Override
@Get("/application-types/{type}/features{?gorm,servlet,test,javaVersion}")
public FeatureList features(ApplicationType type,
RequestInfo requestInfo,
@Nullable TestFramework test,
@Nullable GormImpl gorm,
@Nullable ServletImpl servlet,
@Nullable JdkVersion javaVersion) {
List<FeatureDTO> featureDTOList = featureOperations
.getFeatures(requestInfo.getLocale(),
type,
new Options(test != null ? test.toTestFramework() : null,
gorm == null ? GormImpl.DEFAULT_OPTION : gorm,
servlet == null ? ServletImpl.DEFAULT_OPTION : servlet,
javaVersion == null ? JdkVersion.DEFAULT_OPTION : javaVersion,
getOperatingSystem(requestInfo.getUserAgent())));
final FeatureList featureList = new FeatureList(featureDTOList);
featureList.addLink(
Relationship.SELF,
requestInfo.self()
);
return featureList;
}
@Override
@Get("/application-types/{type}/features/default{?gorm,servlet,test,javaVersion}")
public FeatureList defaultFeatures(ApplicationType type,
RequestInfo requestInfo,
@Nullable TestFramework test,
@Nullable GormImpl gorm,
@Nullable ServletImpl servlet,
@Nullable JdkVersion javaVersion) {
List<FeatureDTO> featureDTOList = featureOperations
.getDefaultFeatures(requestInfo.getLocale(),
type,
new Options(test != null ? test.toTestFramework() : null,
gorm == null ? GormImpl.DEFAULT_OPTION : gorm,
servlet == null ? ServletImpl.DEFAULT_OPTION : servlet,
javaVersion == null ? JdkVersion.DEFAULT_OPTION : javaVersion,
getOperatingSystem(requestInfo.getUserAgent())));
final FeatureList featureList = new FeatureList(featureDTOList);
featureList.addLink(
Relationship.SELF,
requestInfo.self()
);
return featureList;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant