Sections * {{{environment-configuration.html#Configuring the Environment}Configuring the Environment}} * {{{environment-configuration.html#Sample Configuration Files}Sample Configuration Files}} {Configuring the Environment} * Introduction NMaven is based on the concept of platform capabilities and platform requirements. Examples of platform capabilities include: [[1]] Linux (or Windows OS) [[2]] Mono 1.1.18 installed, Microsoft 2.0 installed [[3]] PHP .NET compiler (from 3rd party) Platform requirements are those build requirements specified by the developer. Typically, the requirements are given either within the pom.xml or the nmaven-settings.xml file. Examples of platform requirements include: [[1]] C# target language [[2]] Microsoft SDK [[3]] Framework version 2.0 [[3]] Compact Profile It is up to NMaven to understand what the developer is asking for (platform requirements) and to determine whether the build machine can support the requirements (with its platform capabilities). If the capabilities match the requirements, NMaven will return an executable (or compiler) that satifies the requirements. * Capability/Requirement Matching [./images/matching_diagram.png] Consider the sequence diagram above. The developer provides the compiler requirements - vendor, vendor version, framework version, language and profile - within the pom.xml build file. +----+ org.apache.maven.plugins maven-compile-plugin true MICROSOFT C_SHARP 1.1.4322 COMPACT +----+ Next, the <<>> class instance creates a <<>> object (2), which contains artifact type (library, module) and key info. The compiler needs the configuration information during execution, but the information is not necessary for NMaven to match the correct compiler. The <<>> object invokes the <<>> method, passing in the <<>> and <<>> objects as parameters (3). In step (18), the <<>> method returns a fully initialized <<>> object. From the <<>> class instance perspective, it simply constructs <<>> and <<>> objects based on parameters within the pom and gets back a fully initialized <<>> object from the <<>>. Now let’s dig a little deeper and see what’s going on underneath. The <<>> object creates a <<>> object (4) and populates the <<>> object with information – vendor, vendor version and framework version – from the <<>> object (5). In short, we have a transfer of specific vendor information from the <<>> object to the <<>> object because the <<>> is only concerned with the vendor information, which is the only required information for making a capability match (others are optionally used, if specified, but no attempt is made to infer them if they don't exist). The <<>> fills in the missing vendor info (6, 7) based on a set of rules. Vendor-info may be missing for any number of reasons. For example, a project may compile across multiple vendors (Microsoft/Novell) or framework versions. In this case, the developer may choose to leave say the \ and \ tags within the pom.xml blank. The <<>> object uses the ~/.m2/nmaven-settings.xml file (if it exists) to assist in infering the vendor information for the specific build machine. As you can see below, within the nmaven-settings.xml file there is a default setup (which the developer can change). +----+ MICROSOFT 2.0.50727 2.0.50727 ... +----+ There are 23 states of vendor-info and both a start and stop state (for a total of 25 states). The notation is \{Vendor, Vendor Version, Framework Version}. For Vendor, M denotes Microsoft, N denotes Novell, G denotes DotGNU and F denotes false (unknown vendor). For Vendor Version and Framework Version, T denotes true (it exists), while F denotes false (does not exist). So NFT means that the NMaven knows that it needs to choose a Novell (MONO) compiler and knows the framework version but not the vendor version. The 23 vendor-info states are defined below. They are divided between general states, states that can be determined through an nmaven-settings file and states that can be determined without an nmaven-settings file. *-----------------------------------------------------------------------------------+----------------------------------+ | <> | <> *-----------------------------------------------------------------------------------+----------------------------------+ | <> *-----------------------------------------------------------------------------------+----------------------------------+ | MTT | Vendor is Microsoft, vendor version exists, framework version exists *-----------------------------------------------------------------------------------+----------------------------------+ | MTF | Vendor is Microsoft, vendor version does not exist, framework version exists *-----------------------------------------------------------------------------------+----------------------------------+ | MFT | Vendor is Microsoft, vendor version does not exist, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | NTT | Vendor is Novell, vendor version exists, framework version exists *-----------------------------------------------------------------------------------+----------------------------------+ | <> *-----------------------------------------------------------------------------------+----------------------------------+ | MFF | Vendor is Microsoft, vendor version does not exist, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | FTF | Vendor is unknown, vendor version exists, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | FFT | Vendor is unknown, vendor version does not exist, framework version exists *-----------------------------------------------------------------------------------+----------------------------------+ | FTT | Vendor is unknown, vendor version exists, framework version exists *-----------------------------------------------------------------------------------+----------------------------------+ | FFF | Vendor is unknown, vendor version does not exist, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | NFT | Vendor is Novell, vendor version does not exist, framework version exists *-----------------------------------------------------------------------------------+----------------------------------+ | NTF | Vendor is Novell, vendor version exists, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | NTT | Vendor is Novell, vendor version exists, framework version exist *-----------------------------------------------------------------------------------+----------------------------------+ | NFF | Vendor is Novell, vendor version does not exist, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | GFF | Vendor is GNU vendor version does not exist, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | <> *-----------------------------------------------------------------------------------+----------------------------------+ | MFF_NoSettings | Vendor is Microsoft, vendor version does not exist, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | NFT_NoSettings | Vendor is Novell, vendor version exists, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | NTF_NoSettings | Vendor is Novell, vendor version exists, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | FTF_NoSettings | Vendor is unknown, vendor version exists, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | FFT_NoSettings | Vendor is unknown, vendor version does not exist, framework version exists *-----------------------------------------------------------------------------------+----------------------------------+ | FTT_NoSettings | Vendor is unknown, vendor version exists, framework version exists *-----------------------------------------------------------------------------------+----------------------------------+ | FFF_NoSettings | Vendor is unknown, vendor version does not exist, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | NFF_NoSettings | Vendor is Novell, vendor version does not exist, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ | GFF_NoSettings | Vendor is GNU vendor version does not exist, framework version does not exist *-----------------------------------------------------------------------------------+----------------------------------+ Going back to the sequence diagram, the <<>> object fills in the missing vendor information into the <<>> object (8): we now have a complete <<>> to use for matching. The <<>> object initializes the <<>>, passing in the <<>> and <<>> objects. During initialization, the <<>> object invokes <<>> (10). The <<>> class instance creates a list of platform capabilities (11) and matches <<>> properties to the <<>> properties (12). The <<>> gets the class name of the <<>> by invoking <<>> (13). The <<>> dynamically instatiates and initializes the <<>> (14). The <<>> is returned to the <<>> (16, 17, 18), which then executes the Compiler (19). {Sample Configuration Files} * CSharp2.0:exe:Microsoft +----+ 4.0.0 org.apache.maven.ms.csharp it-0001 exe 0.1.0.0 csharp: it-0001 src/main/csharp src/test/csharp org.apache.maven.plugins maven-compile-plugin true +----+ * CSharp3.0:exe:Microsoft (on Windows) +----+ 4.0.0 org.apache.maven.ms.csharp it-0001 exe 0.1.0.0 csharp: it-0001 src/main/csharp src/test/csharp org.apache.maven.plugins maven-compile-plugin true 3.0 +----+ * CSharp1.1:exe:Microsoft (on Windows) +----+ 4.0.0 org.apache.maven.ms.csharp it-0001 exe 0.1.0.0 csharp: it-0001 src/main/csharp src/test/csharp org.apache.maven.plugins maven-compile-plugin true 1.1.4322 +----+ * CSharp1.1:exe:Mono (on Linux) +----+ 4.0.0 org.apache.maven.ms.csharp it-0001 exe 0.1.0.0 csharp: it-0001 src/main/csharp src/test/csharp org.apache.maven.plugins maven-compile-plugin true 1.1.4322 +----+ * VB2.0: library:MS +----+ 4.0.0 org.apache.maven.ms.csharp it-0001 library 0.1.0.0 vb:it-0001 src/main/vb src/test/vb org.apache.maven.plugins maven-compile-plugin true VB +----+ * CSharp1.1:module:Mono (on Windows) You will only need to use the MONO vendor field if you want to build MONO on windows: MONO is the default vendor for other OS's. +----+ 4.0.0 org.apache.maven.mono.csharp it-0001 module 0.1.0.0 csharp: it-0001 src/main/csharp src/test/csharp org.apache.maven.plugins maven-compile-plugin true MONO 1.1.4322 +----+ * CSharp2.0:library:Mono +----+ 4.0.0 org.apache.maven.mono.csharp it-0001 library 0.1.0.0 csharp: it-0001 src/main/csharp src/test/csharp org.apache.maven.plugins maven-compile-plugin true MONO +----+ * CSharp:library:DotGNU +----+ 4.0.0 org.apache.maven.mono.csharp it-0001 library 0.1.0.0 csharp: it-0001 src/main/csharp src/test/csharp org.apache.maven.plugins maven-compile-plugin true DotGNU +----+ * Nemerle:library:Mono +----+ 4.0.0 org.apache.maven.mono.nemerle it-0001 library 0.1.0.0 nemerle: it-0001 src/main/nemerle src/test/nemerle org.apache.maven.plugins maven-compile-plugin true NEMERLE MONO +----+ * PHP:library:Mono To get PHP to run with NMaven, you will need to include mPHPRuntime.dll under each module directory. This is a work around until I create a mavenizer-plugin that will handle non-nmaven generated assemblies. +----+ 4.0.0 org.apache.maven.mono.php it-0001 library 0.1.0.0 php: it-0001 src/main/php src/test/php org.apache.maven.plugins maven-compile-plugin true PHP MONO +----+