0

I'm not very familiar with Maven so I'm sorry if I made an obvious mistake. I wrote some JUnit tests and the all run fine in eclipse when I right click the files and select "Run as JUnit". But when I try to use mvn test in the console it fails because it says package org.junit does not exist

Screenshot

This is how my pomfile looks:

<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">
  <modelVersion>4.0.0</modelVersion>
  <groupId>Othello</groupId>
  <artifactId>Othello</artifactId>
  <version>0.0.1</version>
  <name>Othello</name>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source/>
          <target/>
        </configuration>
      </plugin>
    </plugins>
    <finalName>Othello</finalName>
  </build>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

Does anyone know what I did wrong?

Deb
  • 1,098
  • 10
  • 22
  • 1
    See [this answer](http://stackoverflow.com/a/22237180/15472) - you are using eclipse's directory structure instead of maven's, and this is confusing maven. The `` line in particular is causing this problem. – tucuxi May 05 '16 at 09:16
  • @tucuxi If I remove that line I get the following problem `[WARNING] JAR will be empty - no content was marked for inclusion!` – Deb May 05 '16 at 09:56
  • 2
    You need to transform your project structure to conform to the [Standard Directory Layout](https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html), if you want to build your project successfully using Maven. – ujulu May 05 '16 at 10:01

0 Answers0