-
Notifications
You must be signed in to change notification settings - Fork 0
UsingEclipse
If you want to use LensKit from an Eclipse project, it's pretty easy
if your project uses Maven: just add LensKit as a dependency. You can
do this in the POM editor (edit your project's pom.xml
file), and
add lenskit-core
and whatever algorithm modules you need
(e.g. lenskit-knn
) as dependencies. It's similarly easy if you use
Gradle, Ant + Ivy, buildr, or some other Maven-compatible build tool,
though you may need to edit your build file manually.
If your project does not use Maven, you can download the
binary distribution and add the .jar
files it contains to your
project.
You can, of course, use Eclipse to develop LensKit itself. It's unfortunately a bit complicated to set up, though we are working on trying to simplify that.
Working with the LensKit code in Eclipse requires the following plugins:
- MercurialEclipse, installable from the Eclipse marketplace (Help / Eclipse Marketplace)
- M2e (the Maven plugin, included by default in recent Java-oriented Eclipse downloads)
- Groovy-Eclipse, also available from the marketplace. Hint: There are larger Groovy packages available in the marketplace, but the one called Groovy-Eclipse is sufficient for LensKit.
- Groovy-Eclipse M2E Integration. After installing Groovy-Eclipse from the Marketplace, this can be installed from the traditional software installer. Choose ‘Install New Software...’ from the ‘Help’ menu, select the GRECLIPSE site from the Software Sites drop-down, and install the ‘Groovy-Eclipse M2E Integration’. For some reason, this is not auto-detected by Eclipse.
We recommend using Eclipse Juno or later, as it includes M2e. You should be able to make earlier versions of Eclipse work, however, if you manually install M2e.
There are several steps to importing the LensKit source code into Eclipse:
- Check out the LensKit source tree by selecting ‘File’ / ‘Import’ and choosing ‘Clone exisitng repository’ (from the Mercurial category). In the following dialog, enter the repository URL (the master tree is at http://bitbucket.org/grouplens/lenskit).
- Right-click the newly-imported ‘lenskit’ project and select ‘Configure’ / ‘Convert to Maven project’.
- Right-click the ‘lenskit’ project again, choose ‘Import’ / 'Maven' / ‘Existing Maven Projects’.
It should auto-select thepom.xml
files for all LensKit submodules; import them, and each of the LensKit modules should show up in the project explorer.
You may want to use a working set to group the LensKit projects together.
If additional submodules are added when you update your copy of the source, you can add them by repeating step (3); when you re-import existing Maven modules from the LensKit project, it will autoselect any projects that are in the directory tree but are not yet imported.
After completing these steps, you should be ready to begin working on the LensKit code in Eclipse.
The tests in lenskit-integration-tests
depend on the ML-100K
data set. If you run the tests from Maven and have the
grouplens.mldata.acknowledge
property set to yes
, Maven will
auto-download the data set. However, if you want to run the tests
from within Eclipse, you will need to set the
lenskit.movielens.100k
Java property in your test runner
configuration to a directory where you have unpacked the ML-100K data
set. This can be done with -Dlenskit.movielens.100k=/path/to/data
in the ‘VM Arguments’ setting.
The etc/eclipse-codestyle.xml
file contains an Eclipse code style
that will configure most of the LensKit style guidelines. See the
Code Guidelines for more details on our coding
style.
When you run Maven builds under Eclipse, you will likely see this error:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
This doesn't seem to cause any problems and can be ignored.
Eclipse and IntelliJ disagree about some uses of @SuppressWarnings. You can ask Eclipse not to nag you about uses of @SuppressWarnings that it considers unnecessary by following these directions.
Most LensKit development will work fine without any additional Eclipse configuration. If you want to be able to run the full integration test suite, including the archetype tests (disabled by default), some additional configuration is required.
First, the integration tests must be run with an external Maven; they don't work with the embedded Maven included with Eclipse. Register your Maven installation (you may need to download Maven) under ‘Maven / Installations’ in the Eclipse settings manager.
Second, it must be run with a real JDK, not just a JRE. On Linux or
Mac, you likely already have one configured (hopefully). On Windows,
even if you have a JDK installed, Eclipse runs with the JRE. You need
to add your JDK to Eclipse's list of installed JREs (add the JDK root
directory, e.g. C:\Program Files\Java\jdk1.7.0_17
). Then run the
Maven build for the integration tests with this JRE and your external Maven.