-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
spring-boot-starter-test conflicts with json library #8706
Comments
Do you have a complete stack-trace that you can attach? I'm interested to know what's the root trigger for the problem. |
java.lang.NoSuchMethodError: org.json.JSONTokener.(Ljava/io/Reader;)V
|
Thanks. It looks like I'm not sure there's much that we can do about this. The It might be worth suggesting to As an aside, you can still use |
Thank you for your recommendations! Will consider them. |
Let me add some more details to this topic.
And this quickly led to tdunning/open-json#11. |
I think it might be worth getting rid of our remaining optional dependency on org.json:json and then we could also get rid of our dependency management for it. I've opened #8710. |
Is there a specific way to get this to work? I'm using Gradle 5.2 and Java 11 with a very simple project that adds a controller and an entity package to the base starter created with Spring 2.1.2. The code in
Running
The code seems to run fine from IDEA though. |
Should I log this as a new bug or should this one be reopened? The workaround mentioned in the original post still works. |
From what you've said thus far, you seem to have a different, although perhaps related, problem. Please open a new issue and provide a complete sample (as a zipped attachment or a separate Git repository) that reproduces the problem. |
Thanks. Doing so now. |
Created new bug at #15967 |
Hi,
org.springframework.boot:spring-boot-starter-test
->1.5.2.RELEASE
has an indirectdependency on com.vaadin.external.google:android-json:0.0.20131108.vaadin1
viaorg.skyscreamer:jsonassert:1.4.0
.The reference documentation mentions both
org.skyscreamer:jsonassert:1.4.0
andorg.json:json:20140107
. As far as I understand, they should be compatible. However,com.vaadin.external.google:android-json:0.0.20131108.vaadin1
conflicts withorg.json:json:20140107
as it represents the re-implementation of some older version oforg.json:json
.In particular,
org.json.JSONTokener#JSONTokener(java.io.Reader)
exists only inorg.json:json:20140107
and is absent incom.vaadin.external.google:android-json:0.0.20131108.vaadin1
, causing my tests to fail withjava.lang.NoSuchMethodError: org.json.JSONTokener.<init>(Ljava/io/Reader;)V
exceptions.The solution to my issue is not to use
spring-boot-starter-test
, but instead usespring-boot-test
,spring-boot-test-autoconfigure
andspring-test
directly and add all other dependencies as needed.In a case, that
org.skyscreamer:jsonassert:1.4.0
is required, excludecom.vaadin.external.google:android-json:0.0.20131108.vaadin1
.If looking for the JSON assertions library consider
net.javacrumbs.json-unit:json-unit-fluent
that has similar to AssertJ fluent API.Thanks,
Serhiy
The text was updated successfully, but these errors were encountered: