Building NMS

Currently our main build tool for NMS is NAnt.

Setup For *NIX Users
  • Install Mono
  • On some operating systems (e.g. OS X), you may need to point the PKG_CONFIG_PATH environment variable at the mono packages
    Excerpt from ~/.bash_profile
    export PKG_CONFIG_PATH="/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig/:${PKG_CONFIG_PATH}"
    
  • Depending on your installation of Mono, you may need additional steps to get NAnt going on OS X. The more recent versions of the Mono installer for OS X seem to set things up properly. However, if you are having problems running NAnt, try the following:
    • download the binary of NAnt
    • create a script file called nant
    • chmod a+x nant
    • put the following into the script...
      #!/bin/sh
      exec /usr/bin/mono /path/to/nant/NAnt.exe "$@"
      

Thanks to the hints from this page.

Building NMS with Nant

To build the code with Nant you will need to build the individual modules, starting with the main NMS module first. Following are the steps needed to build all of the modules, but depending on which provider you are using, you may only need to build the main Apache.NMS module and then your specific provider module. For example, if you are only working with ActiveMQ, then you would need to build the Apache.NMS module and the Apache.NMS.ActiveMQ provider module. Here are the steps to build all of the modules for the trunk version. Modify the paths to build a particular tag release (e.g., change the trunk folder to tags\1.0.0):

cd activemq-dotnetcd Apache.NMS\trunk
nant

cd ..\..\Apache.NMS.ActiveMQ\trunk
nant

cd ..\..\Apache.NMS.MSMQ\trunk
nant

cd ..\..\Apache.NMS.EMS\trunk
nant

cd ..\..\Apache.NMS.WCF\trunk
nant

This will build all of the providers. The only module that needs to be built first is the Apache.NMS module, as all of the other provider modules depend upon that module. IMPORTANT: In order to build the Apache.NMS.EMS module, you must have a licensed copy of the TIBCO.EMS.dll. This module is not available from The Apache Software Foundation.

Running the Unit Tests

The unit tests depend on an ActiveMQ broker running on tcp://localhost:61616 so that the test cases can connect to ActiveMQ and send and receive messages etc. So if you have a distribution of ActiveMQ, run the broker first before testing Apache.NMS.ActiveMQ.

If you want to run a build with the unit tests (assuming you have a broker running) then type the following from the trunk folder of the provider module:

nant test

Alternatively, you can use the NUnit graphical interface to load the appropriate module's nunit project file. Each project includes a file named Apache.NMS.modulename.Test.nunit, where modulename matches the provider module's name (e.g., ActiveMQ, EMS, MSMQ or WCF). This file can be loaded into the NUnit's graphical application to run all of the unit tests and see their output.

Building NMS using Maven 2  is not directly supported

Maven 2 support is incomplete.  Ultimately we'd prefer to use Maven to build NMS, as then we'd have a single tool for creating distros & doing builds etc.

You can use the Maven C# plugin to build the code if you have Maven 2.0.2 or later installed.

First you need to tell maven the location of the .NET environment and where to get the Maven C# Plugins. To do that you need to edit your ~/.m2/settings.xml so that it looks like the following. This file works on OS X - for other platforms use the correct value of dotnet.home for where Mono/.Net is on your machine.

<settings>

   <profiles>
     <profile>
      <id>default</id>
         <properties>
           <dotnet.home>/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/1.0</dotnet.home>
         </properties>

          <repositories>
              <repository>
                <id>maven-csharp</id>
                <name>maven-csharp</name>
                <url>http://maven-csharp.javaforge.com/repo</url>
               </repository>
               <repository>
                  <id>codehaus-snapshot</id>
                  <name>CodeHaus Snapshot Repo</name>
                  <url>http://snapshots.maven.codehaus.org/maven2</url>
               </repository>
           </repositories>

           <pluginRepositories>
                  <pluginRepository>
                    <id>maven-csharp-plugins</id>
                    <name>maven-csharp</name>
                    <url>http://maven-csharp.javaforge.com/repo</url>
                  </pluginRepository>
           </pluginRepositories>

     </profile>
   </profiles>

  <activeProfiles>
     <activeProfile>default</activeProfile>
 </activeProfiles>

  <pluginGroups>
    <pluginGroup>com.javaforge.maven-csharp</pluginGroup>
  </pluginGroups>

</settings>

Once that's done you only need to:

cd activemq-dotnet
mvn install

IDE Tips

If you are on windows then you probably want to use Visual Studio 2008; we highly recommend using ReSharper as well, - its a shame there is not a distro for OS X and Linux .

Using X-develop to edit C#

If you are on OS X we recommend the use of X-developfor editing, refactoring and running the code.  Just tell it to load the activemq-dotnet.sln file and X-develop should be ready to go.

Using Eclipse to edit C#

You can use Eclipse as your IDE to edit C# code.

If you want to use Eclipse there are the following two C# eclipse plugins we are aware of

We tend to use BlackSun as it has auto-format and outline view support along with compiler warnings (though you might want to change the default font size).

Graphic Design By Hiram