Maven cannot run program “link”

旧城冷巷雨未停 提交于 2019-12-25 04:16:06

问题


I am trying to build a simple C++ project with maven and the nar-maven-plugin, but I'm getting the following error:

Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.2.3:nar-validate (default-nar-validate) on project it0015-cpp-executable: Could not launch cmd.exe /X /C "link /?": Error while executing process. Cannot run program "link": CreateProcess error=2, The system cannot find the file specified -> [Help 1]

I am using Windows 8.1. Does anyone have ideas on how to investigate this issue?


回答1:


you should specify the linker you are using.

For me, i'm using MinGW so i update my user path (environment variable) with C:/MinGW/bin and in the nar-maven-plugin i specify the linker name to g++

  <plugin>
    <groupId>com.github.maven-nar</groupId>
    <artifactId>nar-maven-plugin</artifactId>
    <version>3.2.3</version>
    <extensions>true</extensions>
    <configuration>
      <linker>
        <name>g++</name>
      </linker>
      <libraries>
        <library>
          <type>executable</type>
        </library>
      </libraries>
    </configuration>
  </plugin>

Now you can launch "mvn validate" to check if it works



来源:https://stackoverflow.com/questions/31293360/maven-cannot-run-program-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!