Compilation JAVA json loader

General discussion about Box2D tutorials
Post Reply
Daboog
Posts: 22
Joined: Tue Jan 15, 2013 4:38 pm

Compilation JAVA json loader

Post by Daboog »

Hello iforce! What IDE are you used for JSON loader on JAVA. When I compile source code in NetBeanse, I get error:

Failed to execute goal on project jbox2d-testbed: Could not resolve dependencies for project org.jbox2d:jbox2d-testbed:jar:2.3.0-SNAPSHOT: The following artifacts could not be resolved: org.jbox2d:jbox2d-library:jar:2.3.0-SNAPSHOT, org.jbox2d:jbox2d-serialization:jar:1.0.0-SNAPSHOT, org.jbox2d:b2dJson:jar:1.0.0: Could not find artifact org.jbox2d:jbox2d-library:jar:2.3.0-SNAPSHOT -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Compilation JAVA json loader

Post by iforce2d »

I was using Eclipse for that. I'm not all that experienced with it, and even more confusing was maven... I ended up making the downloads by editing the contents of the jar directly using a zip program because I could not for the life of me figure out how to do it with mvn :?

I used some maven plugin for Eclipse, I forget the exact name and I am away from home for a while so I can't check right now, but I did all the compiling with that instead of using the command line.
Daboog
Posts: 22
Joined: Tue Jan 15, 2013 4:38 pm

Re: Compilation JAVA json loader

Post by Daboog »

Oh, thanks! I realized what the problem was)
mynameisafruit
Posts: 2
Joined: Sun Jul 28, 2013 5:23 pm

Re: Compilation JAVA json loader

Post by mynameisafruit »

Daboog,

What did you do to resolve this? It looks like the pom.xml file for the java project may be incorrect.

Thank you,
Barry
mynameisafruit
Posts: 2
Joined: Sun Jul 28, 2013 5:23 pm

Re: Compilation JAVA json loader

Post by mynameisafruit »

I figured it out. I got this building with all maven managed dependencies. I updated the pom to look like:

Code: Select all

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>b2dJson</artifactId>
  <groupId>com.iforce2d</groupId>
  <name>b2dJson</name>
  <packaging>jar</packaging>
  <description>Support for loading R.U.B.E scenes into JBox2D.</description>
  <version>1.0.0</version>
  <dependencies>
        <dependency>
                <groupId>org.jbox2d</groupId>
                <artifactId>jbox2d-library</artifactId>
                <version>2.2.1.1</version>
        </dependency>
         <dependency>
                <groupId>org.json</groupId>
                <artifactId>json</artifactId>
                <version>20090211</version>
        </dependency>

   </dependencies>
</project>
Really we're just dependent on the jbox2d-library and org.json libraries. I pointed to the latest org.jbox2d library and the latest org.json as dependencies, and removed the parent pom declaration. Then running

Code: Select all

mvn clean install
at the command line worked like a charm.

I'm going to try and submit a pull request to update the git repo so the pom is correct if you'll accept it!
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Compilation JAVA json loader

Post by iforce2d »

Done, thankyou!
Post Reply