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

I am trying to import and run the project specified here:

Scene2d Actions and Event Handling

I'll start by downloading the zip file and then importing it into eclipse. From here I get the following three errors (after resolving others related to the wrong version of Android):

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 solve a problem? I noticed that this junit should be included in the JDT for eclipse, but I installed this without changing the error. Thanks.

+6
source share
1 answer

The problem is that the project has dependencies on libraries that are managed using Maven , which Eclipse does not automatically configure.

You need to download first and then install Maven . Then you can open a command prompt window and run mvn install from the project directory, which will create the code and pull out any necessary dependencies.

Finally, you need to go into Eclipse and configure it so that it knows your local Maven repository ...

  • Window โ†’ Settings
  • Java โ†’ Build Path โ†’ Class Variables โ†’ New
  • name will be M2_REPO
  • path will be something like c:\users\drew\.m2\repository
  • Click OK twice

If you recompile in Eclipse, these errors should go away.

+27
source

All Articles