Hello,
Looked into an issue I've encountered with assembly not using
snapshots correctly. I believe it's due to Maven 3.0.3 restricting
libraries to "configured" repositories only, but not sure why the
assembly plugin doesn't have the repository in question "configured" for
use.
I've basically got...
A
|----------B <-- assembly is run from here (mvn package
assembly:assembly -Dmaven.test.skip=true)
|
---------C
---------D
E
Assembly puts all the sub projects artifacts into a zip file with some
organization, fairly simple. Projects C, D require project E, which is
listed as 3.1.0.0_b1-SNAPSHOT as a dependency. During compile, running
tests, etc, project E is downloaded from our repo (we use Artifactory)
and all is well. When the assembly pukes, it says that it cannot find
project E version 3.1.0.0_b1-SNAPSHOT and yet the dependency is in the
local .m2. I have the following repositories setup in the project A pom
file:
<repositories>
<repository>
<id>central</id>
<url>http://build.x.com:8080/artifactory/repo</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>http://build.x.com:8080/artifactory/repo</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
Like I said, if I remove the artifact and try to run assembly, it will
download the file (for package goal) but then say it can't find it for
assembly. It did suggest to mvn install the file, which I did and to my
surprise assembly then worked. Looking further into it, it appears that
"local repo tracking" feature that's new to Maven 3.0.3 that's causing
the issue. For the project E artifact, I noticed when I deleted it from
local .m2 and did a mvn install, it created a _maven.repositories file
that did NOT specify the repository (assembly worked fine with this).
So to be clear, when I did mvn install I get a _maven.repository file
with E-3.1.0.0_b1-SNAPSHOT.jar>= and when assembly fails, that same file
will have E-3.1.0.0_b1-SNAPSHOT.jar>snapshots= and I do understand why
it has snapshots listed as "normally" it downloads the artfact from our
artifactory repo which, according to repositories entries (above) is
called snapshots.
What I don't understand here is why doesn't the assembly plugin think
it's ok for it to use artifacts from the snapshots repository?
So to recap...
If I remove project E from local .m2, manually install project E
artifact, assembly works fine (no maven repository is associated with
project E artifact in local .m2).
If I remove project E from local .m2, project E artifact is downloaded
from repo and assembly fails. Project E is listed as coming from
snapshots repository.
Repository scope issue somehow between main build "context" and
assembly?
Sugestions? Thoughts?
Thanks!!!!
Randall