Using Eclipse with the Examples

From a class participant:

At step 4 of the setup, you said to issue the commands below.

mvn idea:idea or mvn eclipse:eclipse (warning: I am not an Eclipse user, so I may not be able to help with Eclipse issues.) Alternately, if you are using IntelliJ 7.x create a new project and use Maven as the project model.

Since you said you are not an Eclipse user, if others ask.
Here is what I did to resolve the Eclipse build issues I had in the Setup.

After you issue the command
mvn eclipse:eclipse
I initially had an Error, I had to change directories into the training directory. Then issue the command again.

My Eclipse workspace is c:\Projects\LuceneBootCamp
I issued the mvn command from the c:\Projects\LuceneBootCamp\training directory

I assumed that the download would happen in that sub directory, but the files seemed to be downloaded into a directory named:

c:\Document and Settings\myusername\.m2\repository

In Eclipse I got many warning messages that were similar to this:
Unbound classpath variable: ‘M2_REPO/bouncycastle/bcmail-jdk14/132/bcmail-jdk14-132.jar

To resolve the “Unbound classpath variable” issue I had to create an Eclipse Variable that mapped the M2_REPO name to the files in the .m2 directory.

Here is how to do that.

Select the Eclipse Project folder from the Navigator window view
Right Click and get the Project Properties.
Select the tree item named “Java Build Path”
Push the button on the Right that says Add Variables.
Then Push the button that says Configure Variables.
Then push the New button
Add a new variable named M2_REPO and map it to the directory that contains the repository above.
Exit back to the “New Variable Classpath entry” dialog.
Select the M2_REPO variable and click extend
Select a jar file and exit.

Hopefully your project will now build without errors.

Comments are closed.