1

So I am fairly new to programming, and new to git, LibGDX and Intellij.

My friend and I started with a programming project a few days ago, where we generated a project using libGDX. We opened the project in IntellIj IDEA and sat up the run command. It worked on my friends laptop, but when he pushed it to git and I cloned it, it didn't work. So I dived into settings and looked at differences between my own project and this shared project.

What I found out was that all the external libraries was gone for me. So I checked the project structure and found that all the paths were specified to his computer.

For example:

/home/"name"/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx/1.9.3/1a3775429980a6c8da0cdefb656ad1dabf91d629/gdx-1.9.3.jar

So I tried changing the paths to ~/.gradle (...).jar but it automatically expanded the path to the full path of my computer instead. So the question is:

Is it possible to set the project structure settings for modules to an universal path that works for everyone cloning the project, or do I have to add every path individually for each person working on the project?

Thanks, Jon

Isabel Inc
  • 1,871
  • 2
  • 21
  • 28
VexZ
  • 11
  • 4
  • The project setting/structure files should be in your .gitignore. They are already in the LibGDX default project's .gitignore file, so not sure why this happened to you. – Tenfour04 Aug 22 '16 at 15:45
  • For the project he disabled the gitignore file so the .ipr and other files would e uploaded. If he don't I won't get the project. – VexZ Aug 22 '16 at 18:37

1 Answers1

1

While it is safe to add the .iml files and most of the .idea directory to your git repository, you should avoid adding the following files:

  • .idea/workspace.xml
  • .idea/libraries/*

See this documentation for more details.

Since it's a gradle project, IntelliJ should reimport the gradle model automatically and create these files with paths that depend on your own environment.

Bastien Jansen
  • 8,756
  • 2
  • 35
  • 53
  • The question is really more about how we can make gradle / intelliJ use realtive local paths inside the git repo for libraries such as LibGDX instead of putting libGDX in the home folder and using absolute paths – VexZ Aug 22 '16 at 18:29
  • I'm not sure if LibGDX is a special library, but if you're not versioning the JAR but instead let Gradle download it in its cache (it could be in your home directory or virtually anywhere else), IntelliJ will automatically pick this JAR and put its absolute path in `.idea/libraries/*` files. Because all of this is done automatically, and no environment-specific path is stored in the git repo, I don't think you need to specify relative paths manually. Maybe it don't understand your problem completely though. – Bastien Jansen Aug 23 '16 at 13:58
  • Thank you for you answer, but I think you might be misunderstanding the problem. We are using the graddle cache, but in the project structure, it doesn't give my absolute path, it gives my friends absolute path. So I have to manually change the path, and my question is therefor: Is there any easier way to do this than manually change it? Picture to make it more understandable: [Imgur link](http://imgur.com/a/jLjJ8) (I'm not ben) – VexZ Aug 24 '16 at 23:25