I am currently involved in the conversion of a large multi-module project (~ 100 submodules) to use Maven. We are currently using Ant + Ivy.
So far, no serious problems have arisen, and I am comfortable that Maven is still suitable. However, I am wondering if there is a better way to deal with native dependencies.
So far I have come to the following conclusions.
- It is best to install each of your own dependencies in the maven repository as a stand-alone library or archive package containing several dependencies.
Instead of being mistaken in declaring each dependency with the Maven dependency plugin, I decided to give each classifier (for example, natives-win32) and use the following in the parent POM:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.4</version> <executions> <execution> <id>copy</id> <phase>compile</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <includeScope>runtime</includeScope> <includeClassifiers>natives-win32</includeClassifiers> <outputDirectory>${project.build.directory}/natives</outputDirectory> </configuration> </execution> </executions> </plugin>
So far, this seems like a simple comprehensive solution that does not require too much to add new own dependencies. He also offers me a simple comprehensive solution for managing the natives. The only thing I have to do is make sure the directory my / natives / is defined on java.library.path.
One thing that bothers me (a bit) about this approach is that all of my own dependencies are copied around each submodule that expresses a transitive dependency on them, while my lucky jar libraries are added to the class path referencing where they are sitting in my local storage (no copy required).
Is there no way to be smarter in this matter, and my indigenous people refer to their location in the repository (if I do not have them in the archive, i.e. dll). This would save a bunch of unnecessary copying.
Are there any other potential errors that should be affected by the above approach?
source share