Dependencies on other NARs

Dependencies on other NARs are handled by the maven dependency mechanism. The type for NAR files is nar. A NAR dependency is specified in the following way:

<dependency>
    <groupId>DependentGroup</groupId>
    <artifactId>DependentArtifact-nar</artifactId>
    <version>DependentVersion</version>
    <type>nar</type>
</dependency>
            

The artifactId needs to specify a -nar suffix since artifactIds need to be unique and a jar file may exist with the same name.

When a nar dependency is found in the POM, Maven will download the property file :

DependentGroup/nars/DependentArtifact-nar-DependentVersion.nar
            

This file is normally generated by the NAR plugin for the DependentArtifact and may specify the following properties:

Property Description Default Value
freehep.nar.nars Space separated list of other nar files to download. DependentArtifact-nar-DependentVersion.noarch.nar DependentArtifact-nar-DependentVersion.${aol}.nar

The default files specified for download will have the common and machine-os specific parts in them respectively.

The NAR plugin will look in the project.properties file followed by the DependentArtifact-nar-DependentVersion.nar file for any of the following properties:

Property Description Default Value
[arch.[os.[linker.]DependentArtifact-nar.local Specifies that the DependentArtifact is installed locally (in a different place than the local repository. The property freehep.nar.nars will be ignored. One would typically use this for standard libs such as zlib and others. false
[arch.[os.[linker.]DependentArtifact-nar.dir Specify a local directory where the DependentArtifact libs can be found.
[arch.[os.[linker.]DependentArtifact-nar.include Specify a local directory where the DependentArtifact includes can be found.
[arch.[os.[linker.]DependentArtifact-nar.libs Specify the libs to use for linking ${DependentArtifact}-nar-${DependentVersion}
[arch.[os.[linker.]DependentArtifact-nar.local.libs Specify the libs to use for linking if the libs are local ${DependentArtifact}-nar.libs
[arch.[os.[linker.]DependentArtifact-nar.type Specify the type of linking ${freehep.nar.libs.type}
[arch.[os.[linker.]DependentArtifact-nar.linkLibs Specify if libraries should be linked with (there are distributions with only include files). true
DependentArtifact-nar.AOL Converts one AOL into another. For example: YourLib-nar.i386-Linux-g++=i386-Linux-gcc will make sure you can link from g++ as well as from gcc to YourLib. YourLib needs to be dsitributed as a gcc linked lib in this case. ${freehep.nar.aol.name}

If the property DependentArtifact-nar.local is set to true, then no further files will be downloaded or installed and the properties DependentArtifact-nar.dir and DependentArtifact-nar.include will be used for compilation and linking with this DependentArtifact. In the other case the files specified by freehep.nar.nars will be downloaded, installed in the local repository, unpacked and used for compilation and linking. Setting DependentArtifact-nar.local allows the user to avoid downloading a library which is already installed as a non-NAR file somewhere else on his machine. The other properties are used in both the local and the NAR case.

When generating a set of NAR files, the Artifact-nar-Version.nar file will be generated for you. This file may contain any of the properties listed above. The NAR plugin generates the properties freehep.nar.nars and Artifact-nar.linkLibs. Any other properties can be specified in the nar.properties file in the artifact's top directory (alongside project.properties) and will be concatenated to the generated nar file.