简体   繁体   English

在Eclipse中使用Java -jar命令连接Maven目标

[英]Connecting Maven goals with a java -jar command in Eclipse

Currently, I am trying to learn how to use Maven properly. 目前,我正在尝试学习如何正确使用Maven。 So I found a Spring Boot Tutorial and there is the following command: 所以我找到了一个Spring Boot教程 ,有以下命令:

mvn package && java -jar target/gs-spring-boot-0.1.0.jar mvn包&& java -jar target / gs-spring-boot-0.1.0.jar

This command works in the Windows Shell, but unfortunately, not in Eclipse (newest MARS version). 该命令在Windows Shell中有效,但不幸的是,在Eclipse(最新的MARS版本)中无效。 How do I have to rewrite the goal to get it working? 我必须如何重写目标才能使其正常运行?

According to the Spring Boot Maven Plugin Docs , there is a run goal that you can leverage to execute spring-boot programs. 根据Spring Boot Maven插件文档 ,有一个运行目标,您可以利用它来执行spring-boot程序。

For non spring boot programs, I would defer to the usage of maven exec . 对于非春季启动程序,我会遵循maven exec用法

The shell command in your question is pretty much confined to shell usage only; 您问题中的shell命令几乎只限于shell使用; though I'm sure you can find a plugin for eclipse to run shell commands. 尽管我确定您可以找到一个用于Eclipse的插件来运行Shell命令。

Found it out myself. 自己发现了。 There is a command, which includes both: the maven and the java command. 有一个命令,其中包括:maven和java命令。 It works for spring applications. 它适用于弹簧应用。 I used 我用了

spring-boot:run 春季启动:运行

as goal. 作为目标。

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

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