title: IntelliJ Maven Selenium Build jar
body: <p>I am using IntelliJ 12, Java 7, Selenium 2.31.0 and Maven. I can run my tests out of the IDE just fine but I am running into a problem trying to create a jar file. I can create the jar file double clicking on mvn clean and then double clicking install. All is well and the jar is created. The problem occurs when I go to run the jar via command line.</p>
  
  <p>java -jar xyz-selenium-test-1.0.jar</p>
  
  <p>Returns: Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver</p>
  
  <p>I have added selenium-server-standalone-2.31.0.jar as a library in the project settings and as a dependency module in the project settings. I must be missing something in my pom file but I just don't know what it is. I have also attached my pom file as well.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.xyz.selenium.test&lt;/groupId&gt;
  &lt;artifactId&gt;xyz-selenium-test&lt;/artifactId&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  &lt;version&gt;1.0&lt;/version&gt;
  &lt;name&gt;xyz-selenium-test&lt;/name&gt;
  &lt;dependencies&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
  &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
  &lt;version&gt;2.31.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
  &lt;artifactId&gt;selenium-firefox-driver&lt;/artifactId&gt;
  &lt;version&gt;2.31.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
  &lt;artifactId&gt;selenium-htmlunit-driver&lt;/artifactId&gt;
  &lt;version&gt;2.31.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;junit&lt;/groupId&gt;
  &lt;artifactId&gt;junit&lt;/artifactId&gt;
  &lt;version&gt;4.11&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;selenium-jar&lt;/groupId&gt;
  &lt;artifactId&gt;selenium-server-standalone-2.31.0.jar&lt;/artifactId&gt;
  &lt;version&gt;2.31.0&lt;/version&gt;
  &lt;scope&gt;system&lt;/scope&gt;
  &lt;systemPath&gt;/usr/local/selenium/selenium-server-standalone-2.31.0.jar&lt;/systemPath&gt;
  &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;dependencyManagement&gt;
  &lt;dependencies&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
  &lt;artifactId&gt;selenium-firefox-driver&lt;/artifactId&gt;
  &lt;version&gt;2.31.0&lt;/version&gt;
  &lt;exclusions&gt;
  &lt;exclusion&gt;
  &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
  &lt;artifactId&gt;selenium-remote-driver&lt;/artifactId&gt;
  &lt;/exclusion&gt;
  &lt;/exclusions&gt;
  &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;/dependencyManagement&gt;
  &lt;build&gt;
  &lt;plugins&gt;
  &lt;plugin&gt;
  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;maven-plugin-plugin&lt;/artifactId&gt;
  &lt;version&gt;3.0&lt;/version&gt;
  &lt;/plugin&gt;
  &lt;plugin&gt;
  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
  &lt;version&gt;3.0&lt;/version&gt;
  &lt;configuration&gt;
  &lt;source&gt;1.7&lt;/source&gt;
  &lt;target&gt;1.7&lt;/target&gt;
  &lt;/configuration&gt;
  &lt;/plugin&gt;
  &lt;plugin&gt;
  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
  &lt;version&gt;2.4&lt;/version&gt;
  &lt;configuration&gt;
  &lt;archive&gt;
  &lt;index&gt;true&lt;/index&gt;
  &lt;manifest&gt;
  &lt;addClasspath&gt;true&lt;/addClasspath&gt;
  &lt;mainClass&gt;com.setup.test.Setup&lt;/mainClass&gt;
  &lt;/manifest&gt;
  &lt;manifestEntries&gt;
  &lt;mode&gt;development&lt;/mode&gt;
  &lt;url&gt;${project.url}&lt;/url&gt;
  &lt;key&gt;value&lt;/key&gt;
  &lt;/manifestEntries&gt;
  &lt;/archive&gt;
  &lt;/configuration&gt;
  &lt;/plugin&gt;
  &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>