Hi Pawel,
We came across a strange behaviour in the Maven's copy dependencies task. Details below.
- Maven 3 deploys all snapshot versions with timestamps appended. For example there is no event-0.21-SNAPSHOT.jar (on nexus) but instead event-0.21-<timestamp>.jar. Every time a new snapshot is deployed a new jar with a new snapshot is deployed. Say, nexus has the following event module bundle: event-0.21-<timestamp-1>.jar.
- I deleted .m2 and .motech and installed a test module (outside platform) that depends on event 0.21 snapshot. What I observed is that event-0.21-<timestamp-1>.jar is copied to .m2. Also, a event-0.21-SNAPSHOT.jar is created in .m2 and the SNAPSHOT jar is same as event-0.21-<timestamp-1>.jar but renamed to SNAPSHOT jar. The SNAPSHOT jar was also copied to .motech/bundles by the copy-dependencies plugin.
- I deleted SNAPSHOT jar from .m2 and .motech. Run the deploy task, so now nexus have event-0.21-<timestamp-1>.jar and event-0.21-<timestamp-2>.jar, the latter being the latest. I then installed the test module with -U option. I observed that .m2 now contains event-0.21-<timestamp-1>.jar, event-0.21-<timestamp-2>.jar and event-0.21-SNAPSHOT.jar which is same as event-0.21-<timestamp-2>.jar but renamed. The SNAPSHOT jar was copied to .motech/bundles also.
Summary: mvn install renames the latest snapshot jar (identified by the timestamp) and renames it to SNAPSHOT.jar in .m2. Maven's copy dependencies copies that SNAPSHOT.jar to .motech/bundles.
When I executed the above steps for a platform module that depends on event, say scheduler, I observed the same behaviour for .m2 folder but .motech/bundles didn't have the event-0.21-SNAPSHOT.jar but event-0.21-<timestamp-N>.jar. I created a dummy module in the platform modules and observed the same behaviour.
Summary: If we run platform modules that depends on event event-0.21-<timestamp-N>.jar is copied to .motech/bundles. But if we run a module outside platform that depends on event event-0.21-SNAPSHOT.jar is copied to .motech/bundles.
(Note: I just took event as an example. It is true for any SNAPSHOT dependency)
Hence, often one may find both event-0.21-<timestamp-N>.jar and event-0.21-SNAPSHOT.jar in .motech/bundles. Both these bundles would have the same bundle symbolic name and version. This would not allow the server to startup. The work around would be to delete the duplicate bundles manually.
I have been trying to find out the issue but haven't had any luck yet. Let me know if you have any idea what is causing the problem.
-- Soham