0

Like

  1. mvn exec:java -Dexec.mainClass="packageName.class"
  2. mvn -Dtest="className#method"

Does the above commands works or there any alternative commands on the maven generated target/jarFile ?

Couldnt find searching for such commands to run junits on the maven generated jar without applying maven plugins on the pom

Syed Rafi
  • 825
  • 2
  • 12
  • 35
  • The jar file do not contain junit testcases – Jens Sep 21 '16 at 07:07
  • What do you mean by `without applying maven plugins on the pom`? Do you want to run JUnit tests from within the generated jar file? – SubOptimal Sep 21 '16 at 07:10
  • 1
    Duplicate of http://stackoverflow.com/questions/10496846/run-junit-tests-contained-in-dependency-jar-using-maven-surefire ? – Dan Berindei Sep 21 '16 at 07:18
  • Possible duplicate of [How can I include test classes into Maven jar and execute them?](http://stackoverflow.com/questions/36047637/how-can-i-include-test-classes-into-maven-jar-and-execute-them) – A_Di-Matteo Sep 21 '16 at 08:23

1 Answers1

0

The generated jar doesn't contain classes related to unit tests.

Maven can execute tests on the source test files, not on generated jars.

No system (not only maven) can execute unit tests because the generated jar doesn't contain the tests.

Davide Lorenzo MARINO
  • 26,420
  • 4
  • 39
  • 56