fangyidong / json-simple

A simple Java toolkit for JSON. You can use json-simple to encode or decode JSON text.
Apache License 2.0
745 stars 339 forks source link

MAVEN, json-simple 1.1.1 depends on Junit #91

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
On central maven repo, 
http://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple/1.1.1 
json-simple pom reference junit in its dependencies.

What is the expected output? What do you see instead?
junit deps should be in test scope

What version of the product are you using? On what operating system?
1.1.1

Please provide any additional information below.
json-simple comes with junit wich leads to conflicts in maven projects using 
json-simple

Thanks

Original issue reported on code.google.com by colin...@gmail.com on 23 Sep 2013 at 2:15

GoogleCodeExporter commented 9 years ago
This is a one line fix, as the reporter has noted:

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.10</version>
  <!-- FIXME --> <scope>test</scope>
</dependency>

There is no reason to include junit as a runtime dependency. It also throws off 
the Android linker. To work around, you can use exclusions in your project's 
POM:

<dependency>
  <groupId>com.googlecode.json-simple</groupId>
  <artifactId>json-simple</artifactId>
  <version>1.1.1</version>
  <exclusions>
    <exclusion>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </exclusion>
    <!-- maven note: must manually exclude all ancestors
            see http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html -->
    <exclusion>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Original comment by xcolw...@gmail.com on 10 Feb 2014 at 10:09

GoogleCodeExporter commented 9 years ago
Hi problem is the same with Ivy
Dependency must be like : 

<dependencies>
    <dependency org="junit" name="junit" rev="4.10" force="true" conf="test->runtime(*),master(*)"/>
</dependencies>

Original comment by mart...@gmail.com on 13 Mar 2014 at 1:50

GoogleCodeExporter commented 9 years ago
Could you try to fix that little issue soon, perhaps in a 1.1.2 version ? It is 
annoying for your users.

Original comment by aheritier on 11 May 2014 at 8:49

gordysc commented 8 years ago

Any chance we could please get a release of this to Maven Central? The JUnit library being included in shaded libraries is unnecessary bloat and can generating annoying classpath overlap warnings.

gordysc commented 8 years ago

Any news on getting this release out?

loegering commented 7 years ago

I just want to note that this issue has been addressed in my fork (which is fully compatible with this library if you're using java 7+). You can find more details about it here: https://cliftonlabs.github.io/json-simple/

xbcbqc commented 1 year ago

Hello would it be possible to release a new version of this library? The code is fixed but there is no artifact of json-simple available without junit in the dependencies. Thanks

loegering commented 1 year ago

@xbcbqc https://cliftonlabs.github.io/json-simple/ you can use this release for json-simple without junit in in your project.

xbcbqc commented 1 year ago

Ok thanks. I need to communicate with the other project because it's a transitive lib in my dependencies.

loegering commented 1 year ago

Sure thing, just a heads up: you can use version 2.3.1 of the one I linked to be fully backwards compatible with this project.