简体   繁体   中英

[TestNG][Jar] Set Classpath in Manifest (Class-Path) — classpath is ignored?

I'm trying to run a simple TestNG test case residing within a jar file, which contains the test and manifest:

ex.) Test.jar contains: { META-INF\ META-INF\MANIFEST.MF tests\ tests\Test01.class }

I am trying to run it using the command: java org.testng.TestNG - testjar Test.jar testng.xml

Where a folder contains (all in the same directory): Test.jar testng.xml testng-6.1.1.jar

And Manifest contains (w/ a line-break at the end): Manifest-Version: 1.0 Created-By: Willie Owens Class-Path: testng-6.1.1.jar Test.jar.

And I get a NoClassDefFoundError: org/testng/TestNG. Could not find main class.

If I specify the classpath using -cp after "java" (Ex. java -cp testng-6.1.1.jar;Test.jar org.testng.TestNG -testjar Test.jar testng.xml) it works, but I want this information in the manifest. What am I doing wrong here?

Also, I've tried every variation I could think of when typing in the Class-Path, such as: ./testng-6.1.1.jar.\testng-6.1.1.jar...etc..

HELP

Executing test-jar is not that complex with testNg please refer [1] for more detail.

lease let me know if you find any pitfalls with it.

[1] http://dharshanaw.blogspot.com/2012/10/how-to-execute-testng-tests-in-side.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM