简体   繁体   English

Exec Maven插件到命令行

[英]Exec Maven Plugin to Command Line

I have an application developed in NetBeans/Maven that can be started via command line with: 我有一个在NetBeans / Maven中开发的应用程序,可以通过命令行启动:

mvn exec:exec "-Dexec.executable=C:\\Java\\jdk1.6.0_33\\bin\\java.exe" "-Dexec.args=-Dlog4j.properties=... -classpath %classpath com.xxx.MyLauncher" -Dexec.classpathScope=runtime -Dexec.workingdir=

Now I need to run the application through the standard java command line method, like: 现在我需要通过标准的java命令行方法运行应用程序,如:

java -Dlog4j.properties=... -jar myapp-1.2-SNAPSHOT.jar

Unfortunately this does not work in the same manner, as I get the following exception: 不幸的是,这不能以相同的方式工作,因为我得到以下异常:

opencard.core.util.OpenCardPropertyLoadingException: property file not found

Questions: 问题:

  • What is the difference between launching applications with the Exec-Maven-plugin and the standard java execution on command line? 使用Exec-Maven-plugin启动应用程序和命令行上的标准java执行有什么区别?
  • Is there an easy way to convert a Maven execution script to a standard command line? 有没有简单的方法将Maven执行脚本转换为标准命令行?
  • How to run the application succesfully? 如何成功运行应用程序?

The problem is the classpath, caused by this bug . 问题是由这个bug引起的类路径。 Replacing the maven-assembly-plugin with maven-shade-plugin resolves the issue. 用maven-shade-plugin替换maven-assembly-plugin解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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