2

I have a Maven project with only one JUnit test, and no production code. The test is created in src/test/java/mypackage. I need to upload this test on a box and run it from the command line without using Maven.

I tried several approaches, including creating a jar from Maven and running it, but it keeps returning "no main manifest attribute, in project.jar".

I created in src/main/resources a folder called META-INF, containing MANIFEST.MF, with only one property: Main-Class:mypackage.Test, however I keep getting the above error. Please advise.

user998692
  • 5,172
  • 7
  • 40
  • 63
  • 1
    The main JAR is not going to contain the test classes. What problem are you actually trying to solve here? – Tunaki Feb 14 '17 at 20:26
  • Not to mention that a Test class doesn't have any main() method anyway. The main method is inside the JUnit test runner. This feels like an XY problem. You need to tell us what you're trying to achieve. – JB Nizet Feb 14 '17 at 20:28
  • I need to load test a database, this is what the test is about. – user998692 Feb 14 '17 at 21:49
  • I need to somehow run the test on the box on an environment, not localhost. – user998692 Feb 14 '17 at 21:50
  • You're right, in the above comments! I tried to add a main method, but it didn't work as expected, because it still couldn't find the class in MANIFEST.MF. – user998692 Feb 14 '17 at 21:51
  • I managed to do it using spring core. Thank you all for your help! – user998692 Feb 15 '17 at 22:19

0 Answers0