How to run single Test using Maven
If you want to run the whole test in maven then
mvn test
will do the trick, but how about if you want to run single test
mvn -Dtest=SomeTest test
Where SomeTest is the name of the test you want to run
If you want to run the whole test in maven then
mvn test
will do the trick, but how about if you want to run single test
mvn -Dtest=SomeTest test
Where SomeTest is the name of the test you want to run
Are you using annotations in your project?
If so, you will get this error if you try to do mvn compile
or mvn install
.
You may have also seen this if you are building your project on eclipse as well.
The default maven relies on JDK 1.3 for its building the project and you might be using a JDK above 1.3. Also, JDK 1.3 does not implement annotations.
The solution is to tell the maven the current non-1.3 JDK you are using on you pom.xml
file.
<project>
.
.
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
For the source and target you will provide your current JDK you are using.