[英]native-maven-plugin error with msvc compiler “The command line is too long.”
我正在嘗試使用native-mvn-plugin通過maven構建一個cpp庫。 但是,在鏈接部分,我遇到一個錯誤,提示“命令行太長”
至於配置,即時通訊有這個:
<envFactoryName>org.codehaus.mojo.natives.msvc.MSVC2008x86EnvFactory</envFactoryName>
<compilerProvider>msvc</compilerProvider>
<compilerStartOptions>
<compilerStartOption> /GL /EHsc </compilerStartOption>
</compilerStartOptions>
對於linkerStartOptions,我有這個:
<linkerStartOptions>
<linkerStartOption>-g -Fo -lstdc</linkerStartOption>
</linkerStartOptions>
如果有人能幫助我會很高興。
我真的不建議使用maven本機插件,在配置它時遇到很多麻煩,而且我不知道它是否得到維護,因為主頁說它最后一次發布於2011-03-09。 我使用maven-exec插件來處理用maven構建C ++庫的問題。 我通過調用以下命令加載msbuild工具:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
從命令行。 之后,msbuild將在您的作用域中可用。
這些是我的pom文件的內容:
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>msbuild</executable>
<sourceRoot>${basedir}/Library/</sourceRoot>
</configuration>
<executions>
<execution>
<id>clean</id>
<phase>clean</phase>
<configuration>
<arguments>
<argument>${basedir}/Library/Library.vcxproj</argument>
<argument>/p:Configuration=Release</argument>
<argument>/p:Platform=x64</argument>
<argument>/t:Clean</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
<execution>
<id>build</id>
<phase>compile</phase>
<configuration>
<arguments>
<argument>${basedir}/Library/Library.vcxproj</argument>
<argument>/p:Configuration=Release</argument>
<argument>/p:Platform=x64</argument>
<argument>/t:Build</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
這樣,配置將使項目能夠響應干凈目標和編譯目標。 您甚至可以走得更遠,並使用Assembly插件打包您的庫,並使其在本地存儲庫中安裝該庫,以便可以將其作為依賴項添加到其他項目中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.