I'm trying to build a cpp lib via maven using native-mvn-plugin. However, during the linking part, i'm encountering an error saying "The command line is too long"
As for the configuration, im having this:
<envFactoryName>org.codehaus.mojo.natives.msvc.MSVC2008x86EnvFactory</envFactoryName>
<compilerProvider>msvc</compilerProvider>
<compilerStartOptions>
<compilerStartOption> /GL /EHsc </compilerStartOption>
</compilerStartOptions>
And for the linkerStartOptions, i have this:
<linkerStartOptions>
<linkerStartOption>-g -Fo -lstdc</linkerStartOption>
</linkerStartOptions>
Would be glad if somebody can help me.
I would really discourage the use of the maven native plugin, I had a lot of trouble configuring it, and I don't know if it is maintained as the main page says it was last published on 2011-03-09. What I did to handle the problem of building a C++ library with maven was to use the maven-exec plugin. I load the msbuild tool by calling:
from the command line. After that, msbuild will be available in your scope.
These are the contents of my pom file :
That way the configuration will make that the project responds to both clean and compile goals. You can go even further and use the assembly plugin to pack your library and make it install the library in the local repository so it can be added as a dependency in other projects.