Reputation: 448
I am using Eclipse Kepler for Java. Normally you can add internal/external .jars to a Java project in the build path located in the properties. Why, when I clone a git repo and import it into my projects, do I lose that ability? I don't understand. I kinda need to do that.
Upvotes: 2
Views: 9812
Reputation: 487
When a project relies on libraries/modules, it's best to use a build tool for dependency management. JVM ecosystem is dominated with three build tools: Gradle, Maven and Ant.
How it works: In a build script we declare dependencies of the project. This tells the build tool where to retrieve libraries/modules our project depends on. Dependencies are resolved at runtime; downloaded from a remote repository, retrieved from a local directory or if required another project to be built in a multi-project setting.
Upvotes: 0
Reputation: 448
I found that if you open the run configurations and go to the Classpath tab that you can add internal/external .jars. The run configuration can be accessed by clicking Run > Run configurations. I added my .jar to the user entries. The bootstrap entry caused a null pointer.
Upvotes: 0
Reputation: 22356
This is probably because the .gitignore
has been configured to ignore .jar
Open the .gitignore file and remove the line *.jar, you should be able to add it.
======
As an aside - usually, for Java projects .jar files are not committed to repository (as they are large & it can slow down repository cloning), instead maven
or gradle
is used to configure dependencies. Example - http://www.mkyong.com/maven/how-to-create-a-java-project-with-maven/
Then when you want to work with eclipse just run mvn eclipse:eclipse
to generate the necessary files. .gitgnore
is usually set up to ignore *.class
, *.jar
, .project
, .settings
, .classpath
Upvotes: 12