Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


When the developer executes a Maven plugin (written in Java) from the command line, the Maven framework resolves the plugin and dependent artifacts: this does not cover non-Java artifacts. The problem with using non-Java artifacts within the runtime build environment is that it is not a matter of creating a classpath and referencing the artifacts from the local Maven repository; but rather, the artifacts may need to reside in specific locations on the build machine. For example, I have artifacts that NMaven resolves and installs into the GAC to support the Maven plugins written in .NET. Similar problems exist within C (or Java with JNI) environments with the need to resolve and add artifacts to the LD_LIBRARY path. In short, to support non-Java builds with Maven, we must be able to resolve and install artifacts into multiple locations and/or repositories.

More specifically, when a developer wants to support a new language within Maven, they face the need to mix both Java and the target language within the plugins/components. For example, NMaven supports writing Maven plugins in C#, which, in turn, requires a custom AppDomainManager to load the .NET Mojos within their own application domain (similar to separate classloaders). The .NET framework requires the assembly containing the custom AppDomainManager class to be signed and installed into the GAC. I have created a net-dependencies.xml file - packaged into one of the core components - that contains information on which NMaven assemblies should be installed into the GAC. This is adequate for my purposes. This leads to an important issue, however: third-party developers have no standard way of leveraging a mix of Java and .NET assemblies to extend NMaven's build runtime. They would not be able to use NMaven's resolver since it relies on the net-dependencies.xml file and would have to build their own resolver/installer implementation. It is important to note that this is a general problem for the developer adding language support to Maven and is not a problem for the end-user developer who is building artifacts for the target language.


At a minimum, the solution should tell the Maven client where to install the artifact: LD_LIBRARY, GAC, PAB (Private Assembly Base), Maven repo, etc. The artifact provider (the one who built the artifact) should be able to specify multiple endpoints, since there are cases where the artifact may be used, say, within both the GAC and PAB. The place this information is specified in the pom could exist within a general requirements section of the pom (say installation-requirement).

Given that the installation instruction may vary considerably based on language and environment, the instructions should be general enough to account for adding new environments. One approach would be to have Maven assign Resolver(s)/Installer(s) based on the artifact endpoint type (GAC, LD_LIBRARY). For instance, if Maven sees that the artifact is a dll and that it has instructions to install into the GAC and PAB, then Maven would instantiate the GacResolverInstaller implementation and the PabResolverInstaller implementation and invoke installation method(s) on each.