Skip to content

Consider splitting approvaltests module into several targeted onesΒ #334

@vlsi

Description

@vlsi

Currently, com.approvaltests:approvaltests:18.5.0 has a lot of "optional" dependencies.
However, in practice, it makes it hard to use the library.

For instance, I wanted to try json approvals, so I tried JsonApprovals.verifyJson("test"), and the test failed in runtime with

com/google/gson/JsonSyntaxException
java.lang.NoClassDefFoundError: com/google/gson/JsonSyntaxException
	at org.approvaltests.JsonApprovals.verifyJson(JsonApprovals.java:20)
	at org.approvaltests.JsonApprovals.verifyJson(JsonApprovals.java:16)

Of course, I'm a programmer, and I know NoClassDefFoundError means the class is missing in runtime, because, well, my app does not really use Gson.

If Approvals wants Gson, fine, however, I would suggest adding a regular (non-optional) dependency.

So if you split modules like

approvaltests-core
approvaltests-json-gson: depends on approvaltests-core, and gson
approvaltests-json-jackson: depends on approvaltests-core, and jackson

approvaltests: depends on approvaltests-core, approvaltests-json-* dependencies for backward compatibility

Then the users would be able to pull just the libraries they need (e.g. approvaltests-json-jackson), and they would get all the needed (e.g. jackson) dependencies automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions