amaurs
amaurs

Reputation: 1642

Maven build order

I have a multi-module maven build and I need one particular module (lets call it project-A) to be build at the end. It depends on a module (lets call it project-B) that holds native code that gets compiled to a dll and installed into the maven repository as a zip file using some maven trickery. As it doesn't depends on it directly because the native code is not a java jar, I use Maven Dependency Plugin to unpack the zip file and place the native dll in my build directory. Everything is working fine except for the building order. It builds first project-A in spite of being declared the other way around in the tag in the parent. I would like to tell maven that project-A depends on project-B. I tried to add project-B as a dependency, but as it builds no jar it throws an ERROR, also this seemed hacky to me. Any help would be appreciated.

Upvotes: 2

Views: 2589

Answers (2)

Hardy
Hardy

Reputation: 19119

The order in which you specify the modules in the parent Pom is also relevant. Maven actually builds in this order unless it has to build a module out of sequence due to direct dependencies.

Upvotes: 1

Manfred Moser
Manfred Moser

Reputation: 29912

Just declare dependency in project A to project B and it will work fine. It does not matter if the project B is a native rather than a java project. Just make sure you declare the dependency correctly taking the packaging into account as type.. (which is probably pom so you would have

<dependency>
  <groupId>...</groupId>
  <artifactId>B</artifactId>
  <version>...</version>
  <type>pom</type>
</dependency>

in Project A)

Upvotes: 5

Related Questions