2

This is similar to the asked and answered question Maven test dependency on multi module project. However, this has nothing to do with the test phase, instead I'm having problems with package.

I have a multi-module project something like:

root
|
|-parent-client
| |
| |-client-1
| |
| \-client-2
|
\-parent-server
  |
  |-server-1
  |
  |-server-2
  |
  |-server-3
  |
  \-server-4

My dependencies are client-1 -> client-2 -> server-1 -> server-2 -> server-3 -> server-4, which is to say that client-2 depends on server-1, server-1 depends on server-2, and so on. Each is scoped to compile.

So the problem is that when I run mvn clean package in the root, I get a compilation failure in server-2 that package server-3 does not exist.

When I run mvn clean compile followed by mvn package in the root, it runs through without issue.

It always fails at the same module when it fails.

My understanding of the Build Lifecycle is that compile package is redundant since package includes the compile lifecycle.

The project is more complex, with a total of 41 modules, two parents and one root. Creating a simple example inevitably works as expected.

I'm stumped as to how I should proceed.


Update 2015-10-25

Turns out I was wrong about the order of commands for success. I've updated my question and the description, and included debug output per Michael-O's request:

<snip/>

[INFO] --- maven-ejb-plugin:2.3:ejb (default-ejb) @ terradatum-systemconfig ---
[INFO] Building EJB terradatum-systemconfig-4.8.1-SNAPSHOT with EJB version 3.0
[INFO] Building jar: /home/rbellamy/Development/Terradatum/metrics-project/metrics-server/systemconfig/ejb/target/terradatum-systemconfig-4.8.1-SNAPSHOT.jar
[INFO] Building EJB client terradatum-systemconfig-4.8.1-SNAPSHOT-client
[INFO] Building jar: /home/rbellamy/Development/Terradatum/metrics-project/metrics-server/systemconfig/ejb/target/terradatum-systemconfig-4.8.1-SNAPSHOT-client.jar

<snip/>

[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building terradatum-payment 4.8.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ terradatum-payment ---
[INFO] Deleting /home/rbellamy/Development/Terradatum/metrics-project/metrics-server/payment/ejb/target
[INFO] 
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ terradatum-payment ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ terradatum-payment ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to /home/rbellamy/Development/Terradatum/metrics-project/metrics-server/payment/ejb/target/classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING : 
[INFO] -------------------------------------------------------------
[WARNING] bootstrap class path not set in conjunction with -source 1.6
[INFO] 1 warning
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/rbellamy/Development/Terradatum/metrics-project/metrics-server/payment/ejb/src/main/java/com/terradatum/common/payment/PaymentRemoteDelegate.java:[13,42] package com.terradatum.common.systemconfig does not exist

<snip/>

Update 2015-11-16

After much refactoring the build no longer fails in the same place. I've seen it fail in a similar way, consistently, but the location of the failure moves around. I am not running multiple threads, but it seems very clear to me there's a race somewhere in which an obviously available package (absolutely located and reachable in my ~/.m2/repository local cache, and added to the classpath) is not visible to the Maven compiler.

And knowing what I know about race conditions, I have no idea how I would file a bug report of any substance given I can't offer anything more than supposition and finger pointing.

4

0 回答 0