Prior to building NMaven, make sure that you have the following installed on your system:

1. JDK 5.0 Update x
2. For Microsoft builds you will need both Microsoft .NET Framework (1.1) AND NET Framework SDK. For Mono builds, you will need Mono (
3. Subversion client 1.4+. Click here for Windows Subversion Client.
4. Maven 2.0.9 or higher

You will need to make sure that you have both the SDK and the .NET framework locations within your path. On Linux distributions, this should already be in your path. Typical locations for Microsoft include:

* install root: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
* SDK root: C:\Program Files\Microsoft.NET\SDK\v2.0\

On Windows, Mono looks something like:

* install/sdk path: C:\Program Files\Mono-\bin


1. Do an SVN checkout
svn co nmaven

2. Run
mvn install

Linux Setup

Building on Linux, may take some extra steps. By default, on many Linux environments, the GNU Compiler for Java is already installed. The current GNU version will not work with NMaven. To check which version the system uses, type "java -version" on the command line. If you see something similar to the following, you will need to take additional steps to get the build setup:
java version "1.4.2"
gij (GNU libgcj) version 4.1.1 20060525 (Red Hat 4.1.1-1)

Create a file "/etc/profile.d/" with the following entries:
 export JAVA_HOME=/usr/java/jdk1.5.0_09
 export PATH=$JAVA_HOME/bin:$PATH

Type "mvn -version" from the command line. You should see the following:
java version "1.5.0_09"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b01)
Java HotSpot(TM) Client VM (build 1.5.0_09-b01, mixed mode, sharing)

On Linux, you also need Mono version or higher. Type "mono -V" on the command line to see what version you are running. If it is below, then download the latest mono version, unzip and run rpm from the command line. Detailed instructions are located here: Installing Mono. Make sure to su to root before installing with these instructions!

Assembly Info

Provided that you do not have your own AssemblyInfo class in your project, NMaven will automatically generate an AssemblyInfo.* for you. It does the following mapping:
AssemblyDescription ${project.description}
AssemblyVersion ${project.version}
AssemblyTitle ${}
AssemblyCompany ${}
AssemblyProduct ${}-${}
AssemblyCopyright place a COPYRIGHT.txt file in your module directory and NMaven will pick it up and put it in the assembly

Since the pom version is mapped to the assembly manifest, you MUST follow the version convention or the build will fail. You may, however, optionally add additional tags after the version, such as -SNAPSHOT, alpha, etc. Valid versions would include 1.3.4 or 1.2-SNAPSHOT or 1.2-RC1.

Signing Assemblies

To create a key
 sn -k sgKey.snk

NMaven supports compile-time signing of assemblies. You can sign assemblies by using the keyfile field in the maven-dotnet-compiler-plugin.

Key signing is currently only supported for .NET framework 2.0.

Compiling Projects

NMaven supports compiling of exe, winexe, library, and netmodule projects.

Target Type Packaging
exe dotnet:exe
winexe dotnet:winexe
library dotnet:library
netmodule dotnet:module

For example, the pom for compiling a library would look like:
<?xml version="1.0" encoding="UTF-8"?>


Project Dependencies

To use a gac dependency, you will need to set a GACROOT environment variable to point to either the Microsoft or Mono GAC root location. Then use the system scope as shown below. You can also use types: dotnet:gac32 and dotnet:gac.

A typical dependency would look like.

dotnet:winexe and dotnet:exe can also be used as dependency types. dotnet:module can also be used but will not be transitive.


To create a library project:
mvn archetype:create -DarchetypeGroupId=org.apache.maven.dotnet.csharp   /
                     -DarchetypeArtifactId=maven-archetype-class-library /
                     -DarchetypeVersion=0.15-incubating-SNAPSHOT         /
                     -DgroupId=<<groupId>>                                 /

The archetypeArtifactId can be specified as any of the following:

1. maven-archetype-class-library
2. maven-archetype-console-application
3. maven-archetype-windows-application
4. maven-archetype-windows-control

Last edited Dec 4, 2008 at 11:05 PM by sisbell, version 5


No comments yet.