This section defines the basic configuration of adding dependencies (otherwise known as references) into the project. To avoid runtime errors, make sure that the library to be loaded does not have conflicting instance(s) and/or is not yet loaded in the .NET Framework.
Dependency Types:
Adding dependencies follows the normal Maven pattern, using the NPanday packaging types. For example:
<dependency> <groupId>NUnit</groupId> <artifactId>NUnit.Framework</artifactId> <version>2.2.8.0</version> <type>library</type> </dependency>
These dependencies can also refer to other modules in a multi-module build, which will be installed in the local Maven repository before building the project that depends on them.
As mentioned above, the special type of gac_msil is available to refer to dependencies in the GAC.
For all other dependencies, they should be located in a remote artifact repository. NPanday offers a few dependencies in the repository http://repo.npanday.org/archiva/repository/3rdparty/. More commonly however, you will establish and populate your own artifact repository as described in Setting up an Artifact Repository.
If you are testing a new library and do not yet have it available in a remote artifact repository, you may wish to install it locally.
Use the following command:
mvn npanday.plugin:maven-install-plugin:install-file -Dfile=[path_to_file] \ -DgroupId=[group_id] -DartifactId=[artifact_id] -DartifactVersion=[version] \ -Dpackaging=[packaging_type]
and supply appropriate values:
To add a system scope dependency, add a configuration similar to the following in the project's pom.xml:
<dependency> <groupId>artifact_group_id</groupId> <artifactId>my.lib</artifactId> <version>2.2</version> <type>library</type> <scope>system</scope> <systemPath>C:\path\to\your\library.dll</systemPath> </dependency>
Supply the proper values for the dependency's <groupId>, <artifactId>, <version>, <type>, <scope>, and <systemPath>. Exact match of artifactId and version are required when manually adding dependencies into the project's pom.xml.
Note that in general system dependencies are not recommended as they may be located elsewhere on a different machine. If they are required, you may mitigate this problem by using a property value that can be set differently on another system:
<dependencies> [...] <dependency> <groupId>artifact_group_id</groupId> <artifactId>my.lib</artifactId> <version>2.2</version> <type>library</type> <scope>system</scope> <systemPath>${some.property}\library.dll</systemPath> </dependency> [...] </dependencies> [...] <properties> <some.property>C:\path\to\your</some.property> </properties>
The other system can then override it with mvn -Dsome.property=c:\another\path ... or by adding it to Maven's settings.xml file.