开发者

How can I compile a C# solution under maven

We have an application implemented in two languages, Java and C#. The Java application uses maven for it's build and release process, and now I need to integrate C#'s build into maven as well. It's implemented using Visual Studio 2010. Does anyone know how to do this? What is the best plugin right now that I can use. Thanks a lot!

Update:

So far I found the following 4 options. Has anyone successfully used any of these? Also I will eventually need to port the build/release process to Linux and maybe use Mono to compile in maven. Would appreciate any info, thanks.

NPanday http://incubator.apache.org/npanday/docs/1.2/guide/maven/project-types.html

Plexus http://maven.apache.org/plugins/maven-compiler-plugin/non-javac-compiler开发者_JAVA技巧s.html http://snapshots.repository.codehaus.org/org/codehaus/plexus/plexus-compiler-csharp/1.6-SNAPSHOT/

Maven Dotnet Plugin http://maven-dotnet-plugin.appspot.com/

Tutorial: http://docs.codehaus.org/display/MAVENUSER/Using+Maven+to+manage+.NET+projects


I work with Maven in a C#/C++ stack. With maven, the general rule of "If it can be done via command-line, it can be done in maven" holds, so we end up having a lot of .bat, .exe and powershell "glue" to get all the pieces playing together.

Probably the best way of managing C# compiles via maven is to create a component that provides the necessary machinery, in the form of powershell scripts or .bat files. You can then either publish this as a maven plugin or simply have all downstream components add a dependency to the "compile component." The syntax is a little tricky to sort out, but at the end of the day, you're just invoking csc.exe or something similar.

I do highly recommend sticking with the basic maven steps - process-resources, compile, test, deploy, release - and what they are meant to do. This will reduce "process noise" between C# and Java code and build processes, since the meaning of mvn compile (for example) will stay conceptually consistent across all components. You'll most likely end up generating .zip files as artifacts instead of .jar files, then unzipping as part of the copy-dependencies step.

When rolling out, expect a LOT of confusion from the C# guys. Maven is completely unfamiliar to 99% of C#/C++ devs in the world, and its process is sufficiently different from a traditional MSBuild/TFSBuild/ANT approach to cause a lot of confusion.

Hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜