0

如果我通过预打包项目的SampleServices中的mvn clean install命令行使用,一切都很好。但是当我通过eclipse m2e尝试它时它给了我这个错误mvn clean install

无法在项目 SampleServices 上执行目标 org.codehaus.mojo:exec-maven-plugin:1.4.0:exec (package):命令执行失败。无法运行程序“mvn”(在目录“/Users/johndoe/Project/ChickenEngine/SampleServices/target/capp”中):错误=2,没有这样的文件或目录-> [帮助 1]

我试过使用位于/opt但仍然没有成功的外部 maven。我正在遵循本指南。

4

1 回答 1

1

最终找出要多注意的问题

SampleServices\pom.xml 配置 exec-maven-plugin。重要的部分是 maven 本身被称为可执行文件

<executable>mvn</executable>
    <workingDirectory>${project.build.directory}</workingDirectory>
    <arguments>....

这意味着 mvn.bat 必须在 PATH 中。使用变量 PATH 或从 cmd 运行 eclipse,但在应用程序启动之前执行

 set PATH=%PATH%;c:\path-to-maven-bin-directory\

只有这样

./eclipse.exe

你将进入 Eclipse 控制台

    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] 
    [INFO] QueryDoctorEP ...................................... SUCCESS [  2.855 s]
    [INFO] GrandOakEP ......................................... SUCCESS [  0.057 s]
    [INFO] ClemencyEP ......................................... SUCCESS [  0.064 s]
    [INFO] PineValleyEP ....................................... SUCCESS [  0.067 s]
    [INFO] ChannelingFeeEP .................................... SUCCESS [  0.044 s]
    [INFO] SettlePaymentEP .................................... SUCCESS [  0.051 s]
    [INFO] HealthcareAPI ...................................... SUCCESS [  0.776 s]
    [INFO] PaymentRequestMessageStore ......................... SUCCESS [  0.599 s]
    [INFO] PaymentRequestProcessingSequence ................... SUCCESS [  0.541 s]
    [INFO] PaymentRequestProcessor ............................ SUCCESS [  0.597 s]
    [INFO] SampleServices_module .............................. SUCCESS [  0.437 s]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 7.829 s
    [INFO] Finished at: 2017-05-23T12:23:58+03:00
    [INFO] Final Memory: 17M/209M
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 23.775 s
    [INFO] Finished at: 2017-05-23T12:23:58+03:00
    [INFO] Final Memory: 12M/201M
    [INFO] ------------------------------------------------------------------------
于 2017-05-23T09:30:22.807 回答