如何使用 java 类路径配置 Maven-exec 插件
我正在尝试运行 maven-exec 插件,并将 jar 文件引用为类路径
<configuration>
<executable>java</executable>
<longClasspath>true</longClasspath>
<commandlineArgs>-classpath jarfile; Sample
</commandlineArgs>
</configuration>
,但我的类路径设置不正确,因此引发了 classNotFoundException。如何配置这个?
i am trying to run the maven-exec plugin with referring the jar file as classpath like this
<configuration>
<executable>java</executable>
<longClasspath>true</longClasspath>
<commandlineArgs>-classpath jarfile; Sample
</commandlineArgs>
</configuration>
but my classpath is not set properly thus thrown an classNotFoundException. How to configure this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的类路径不应以分号结尾。只需
-classpath jarfile Sample
,假设“Sample”是您尝试运行的类的名称。为了安全起见,我还会删除该命令行字符串末尾的换行符。Your classpath shouldn't end with a semicolon. Just
-classpath jarfile Sample
, assuming that "Sample" is the name of the class you're trying to run. I'd also eliminate the newline at the end of that command line string to be safe.