使用Maven for C / C ++项目 [英] Using Maven for C/C++ projects
问题描述
我的问题是 - 我应该使用
maven-native-plugin
的短文件或使用 exec-maven-plugin
来简单地执行这些? 我有很不错的体验后者做.NET,不知道是否应该投入
native
插件或留在 exec
? 我强烈建议您使用 href =http://duns.github.io/maven-nar-plugin/> maven-nar-plugin 。我发现它在许多方面优于替代品。它不需要列出源文件,处理多个操作系统和体系结构,处理单元和集成测试,一般遵循maven方式。它引入了一种新型的包装--NAR(或本地存档),它包含您关心的工件(.dll,.so,.a,.exe等),还包括元数据,
它需要一些前期工作将第三方软件打包到NAR中,但它非常简单。一旦它们是NAR,你只需使用正常的Maven依赖性机制来链接它们,例如:
< dependency>
< groupId> cppunit< / groupId>
< artifactId> cppunit< / artifactId>
< scope> test< / scope>
< / dependency>
一个缺点是它似乎没有积极维护,但它是全功能的一个相当令人印象深刻的Maven插件创作的例子。
I'm putting Maven build around cluster of amateur, poorly written and frankly - primitive C/C++ code (meaning some C, some C++). Problem is - there's lots of it in circulation currently and cannot be easily replaced. Building it requires a lot of tribal knowledge (you have to go from cube to cube just to find out how to compile/build various parts) and releasing is total nightmare. (No - I'm not going to rewrite it, plz don't ask)
My question is - should I use maven-native-plugin
to replace multitude of short makefiles or use exec-maven-plugin
to simply execute these?
I had pretty good experience so far with the latter doing .NET and don't know if I should invest into native
plugin or stay with exec
? If you had experience with "Mavenizing" C/C++ I would love to get some advice.
I highly recommend the maven-nar-plugin. I find it superior in many ways to the alternatives. It doesn't require listing out source files, handles multiple OSes and architectures, handles unit and integration tests, and generally follows "the maven way". It introduces a new kind of packaging - the NAR, or "native archive", that contains the artifact you care about (.dll, .so, .a, .exe, etc.) but also metadata, headers, etc. in a way that makes sense.
It does require a bit of up front work to package third-party software up into NARs, but its pretty straightforward. Once they are NARs, you simply use the normal Maven dependency mechanism to link with them, for example:
<dependency>
<groupId>cppunit</groupId>
<artifactId>cppunit</artifactId>
<scope>test</scope>
</dependency>
One drawback is that it does not appear to be actively maintained, but it is full-featured and is a rather impressive example of Maven plugin authoring.
这篇关于使用Maven for C / C ++项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!