title: Running basic examples in Mahout with Maven
body: <p>I'm trying to run some basic examples in Mahout, but most of the tutorials and sample code I could find comes from much earlier versions and don't work.  I want to do this with Maven and I don't have access to an IDE.  I have Mahout 0.13 downloaded but it seems like I'm not using it properly.</p>
  
  <p>I think I'm misunderstanding something conceptually regarding how this works.  Say I am trying to run a simple -means clustering example using Mahout KMeansDriver in java.  Here are my steps:</p>
  
  <ol>
  <li><p>Create a maven project with appropriate name.</p></li>
  <li><p>Write Clustering.java, which includes imports such as: import org.apache.mahout.clustering.kmeans.KMeansDriver;</p></li>
  <li><p>Add dependencies to my pom.xml at the root of the maven project.  I have mahout 0.13 installed, but the versions I am using in the dependencies are earlier ones since it looks like mahout 0.13 doesn't have the same class names for some of the imports I'm using.  e.g.</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.apache.mahout&lt;/groupId&gt;
      &lt;artifactId&gt;mahout-core&lt;/artifactId&gt;
      &lt;version&gt;0.7&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre></li>
  <li><p>Build and run: </p></li>
  </ol>
  
  <blockquote>
    <p>mvn clean -DskipTests package</p>
    
    <p>java -cp target/K-Means-1.0-SNAPSHOT.jar Clustering.Kmeans</p>
  </blockquote>
  
  <p>Now the problem is that it doesn't look like I'm using my version of Mahout at all.  In my mind, the build step pulls down the dependencies listed in pom.xml from the web and then packages them into K-Means-1.0-SNAPSHOT.jar, which I can then run as above.  Is that how it works, or do I need to actually download the version of mahout I want to use and manually add it to my classpath?</p>
  
  <p>Even better, if anyone can point me to any fully functional examples which show how exactly maven is used in conjunction with Mahout, I would be grateful.</p>