Unbound classpath variable junit and log4j when importing a libgdx project in to eclipse

eclipse, java, libgdx, scene2d

Solution

The problem is that the project has dependencies on libraries which are managed with Maven, which Eclipse isn't automatically setup to handle.

You'll need to first download and then install Maven. Then you can open a command-line window and run `mvn install` from your project directory, which will build the code and pull down any required dependencies.

Lastly, you'll need to go into Eclipse and set it up to that it's aware of your local Maven repository...

- Window -> Preferences

- Java -> Build Path -> Classpath Variables -> New

- `name` will be `M2_REPO`

- `path` will be something like `c:\users\drew\.m2\repository`

- Click the OK button twice

If you do a recompile in Eclipse, those errors should go away.

Problem

I'm trying to import and run the project listed here: Scene2d Actions and Event Handling I start by downloading the zip file and then importing it in to eclipse. From here I get the following three errors (after resolving others pertaining to incorrect android version): ``` Description Resource Path Location Type Unbound classpath variable: 'M2_REPO/junit/junit/4.5/junit-4.5.jar' in project 'game-test-desktop' game-test-desktop Build path Build Path Problem Description Resource Path Location Type Unbound classpath variable: 'M2_REPO/junit/junit/4.5/junit-4.5.jar' in project 'netthreads-libgdx' netthreads-libgdx Build path Build Path Problem Description Resource Path Location Type Unbound classpath variable: 'M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar' in project 'netthreads-libgdx' netthreads-libgdx Build path Build Path Problem ``` Does anyone know how to resolve the problem? I have noticed that this junit should be included in the JDT for eclipse but I have installed that with no change in the error. Thanks.

Original source