1

I have imported a java project into a new eclipse workspace and it gave me a lot of errors:

It says "Project 'myProject' is missing required library: /User/linus/.m2/..." (The directory is longer but not of interest for you)

Now, I have looked inside my Finder to see what is in ".m2" but there is no such directory where it should be. Additionally I let it show all the hidden files but no success. Lastly I tried to get into the folder with the terminal (using cd and then the directory eclipse gave me) but that did not work either.

I saw this post but it did not help me.

I reinstalled Maven to make sure it can be used, this is the output if I type mvn --version and mvn in the terminal:

output after running *mvn --version* and *mvn*

Does anyone have an idea? Thanks in advance

EDIT: I reinstalled Maven and now there is a /.m2 folder. It contains /.m2/repository/ but there is nothing in it...

Community
  • 1
  • 1
LinusGeffarth
  • 27,197
  • 29
  • 120
  • 174
  • I assume it is a maven project? Do you have maven installed on the current user? – jnd Feb 03 '15 at 01:47
  • Imported into Eclipse how *exactly*? Import -> Existing Project into Workspace? By using the Maven new-project wizard? By checking out from source control? Did you use the Maven SCM connector? And finally, are you the "linus" in /User/linus/.m2/..."? – chrisinmtown Feb 03 '15 at 02:22
  • @jnd yes it is. I should have it installed. (Did all the steps it was told to in terminal) any way to check wether the install was successful? – LinusGeffarth Feb 03 '15 at 02:23
  • @chrislott the standard way. (First of yours) yes, I am linus. – LinusGeffarth Feb 03 '15 at 02:24
  • Check installation of maven by opening a window and typing "mvn". Do you have the Eclipse Maven plugin installed? – chrisinmtown Feb 03 '15 at 14:43
  • @chrislott what window? Terminal? Or eclipse? – LinusGeffarth Feb 03 '15 at 14:43

1 Answers1

1

May I suggest you read a Maven tutorial like http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

IMHO it's a wonderful build tool because it gets required jar files per the specification in the project object model ("pom") file which your Maven-ized project should have, and you don't have to keep track of jars on your own.

Look in your project for pom.xml, you might even post it here.

To check the sanity of the project and maven on your computer (ignoring Eclipse for a moment), be sure you have a good Internet connection, open a Terminal window, change directory ("cd") over to the project directory, and type "mvn install".

This should trigger the usual Maven build cycle. One of the first things it should do is download all the jars as identified in the pom.xml and store them deeply nested within your /Users/linus/.m2/ directory. Then it should compile all your java classes. Eventually it will probably build a jar file and copy it to somewhere.

If all this works, visit http://eclipse.org/m2e/ for directions to add the Maven plugin (m2e) to your Eclipse. Then your Eclipse should understand how to download jars and build the project per the pom.xml file.

Eventually this all should fix the original "Project is missing required library" problem.

chrisinmtown
  • 3,571
  • 3
  • 34
  • 43