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

throw SafeRuntimeException instead of GradleException #1467

Closed
wants to merge 2 commits into from

Conversation

rzpt
Copy link
Contributor

@rzpt rzpt commented Apr 25, 2023

Before this PR

I am trying to use ObjectMappers from another project that cannot have gradle-api on the classpath. This does not work because GradleException is not on the classpath.

After this PR

==COMMIT_MSG==
Throw SafeRuntimeException instead of GradleException in ObjectMappers
==COMMIT_MSG==

Possible downsides?

Anyone catching a GradleException could have problems.
I did not modify all the other places that throw GradleException, just the ObjectMappers usages.

@changelog-app
Copy link

changelog-app bot commented Apr 25, 2023

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Throw SafeRuntimeException instead of GradleException in ObjectMappers

Check the box to generate changelog(s)

  • Generate changelog entry

@ptaug
Copy link

ptaug commented Apr 25, 2023

Could you do the object mapping in your other project instead? This gives you control over how you want to handle the JsonProcessingException/IOException directly, and we don't have to maintain and rely on object mappers that live in outside projects.

@ptaug
Copy link

ptaug commented Apr 26, 2023

Ok, after talking internally:

  • We should split the SchemaVersionLockFile in a separate gradle-sls-packaging-api project.
  • Annotate it so that we can minimize ObjectMapper configuration, e.g. with @JsonProperty on properties to avoid .setPropertyNamingStrategy(PropertyNamingStrategies.KEBAB_CASE).
  • Have an ObjectMapper in the consumer of the file.

Alternative would be to expose the ObjectMapper in gradle-sls-packaging-api, but we should create that separate project/jar.

@rzpt rzpt closed this Apr 26, 2023
@rzpt rzpt deleted the no-gradle-exception branch April 26, 2023 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants