Adam Sznajder
Adam Sznajder

Reputation: 9206

Eclipse forgets build path variables

I have declared in my project's build path the variable MAVEN_REPO which points to my maven repository. After, let's say, a week Eclipse "forgets" it and my project doesn't want to build. The variable is still visible but not resolved and libraries are not seen. Even if I redeclare the variable the same problem occures. In order to repair my project I have to remove .metadata directory and once again configure everything (what's really anonying). I use Eclipse Indigo Service Release 2.

Upvotes: 1

Views: 312

Answers (1)

Chris Gerken
Chris Gerken

Reputation: 16392

Several thoughts:

  1. You shouldn't have to explicitly point to your maven repository to pick up jar files there. Either your project uses maven and you can set the classpath with "Maven->Update Project Dependencies" or your project doesn't use maven and it should reference jars in a staging area outside of a maven repository.
  2. In my experience Eclipse variables are best defined by a plugin and not by the user. You can certainly define variables manually, but if you move to a new workspace or somebody else takes over the project then they'll have to define those variables. Defining variables is not something the typical Eclipse user knows how to do.
  3. That brings us back to maven. I suggest you fully maven-ize your java project so that maven does this work for you and for whoever else supports that code in the future. While what you're trying to do is not wrong, you're seeing that your configuration is fragile and somewhat proprietary.

Upvotes: 1

Related Questions