Maven:如果代码已经编译到jar中,为什么我需要提一下classpath?

时间:2018-04-24 09:21:26

标签: java maven

此问题遵循Maven: What does the following pom.xml file gives empty jar?

让我们说这是我的pom.xml文件:

    new WebDriverWait(driver, 2000).until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@class='positive auth-button'][@type='submit']")));

正如您所看到的,它有9个依赖项。由于我使用了maven-assembly-plugin,我希望所有依赖项都将打包在输出jar(名为PricingBatch.jar)中。但是,当我运行输出jar时,如果我没有提到类路径中的9个依赖项中的3个,它就无法运行。

我必须跑的是:

  

java -Xmx300M -classpath   " C:\ IBM \的WebSphere \ AppServer的\运行时\ com.ibm.ws.webservices.thinclient_8.5.0.jar;" C:\库\ EO_Websphere \ PricingBatch \目标\ PricingBatch.jar" ; C:\库\ EO_Websphere \ EOGUI \目标\ EOGUI.jar"   com.earnix.tools.batchpricing.Main%*

我的问题是为什么当我在类路径中只提到PricingBatch.jar时,

  

java -classpath PricingBatch.jar com.earnix.tools.batchpricing.Main -Xmx300M%*

我收到错误了吗?

0 个答案:

没有答案