maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Paynter <kittl...@gmail.com>
Subject Re: Problem unpacking dependencies
Date Fri, 01 Oct 2010 21:18:14 GMT
On Fri, Oct 1, 2010 at 2:02 PM, Phillip Hellewell <sshock@gmail.com> wrote:

> Hi all,
>
> I'm using the dependency plugin to unpack artifacts, and I've ran into
> a little problem.  I can leave out the <version> tag for the artificat
> if it is an immediate dependency listed earlier in the pom.xml, but
> for a dependency of a dependency, I can't leave it out; It gives an
> error :(
>
> How come normal dependency resolution can figure out all the versions
> for the entire tree of dependencies, but the dependency plugin can't?
>
> Having the version number in the <artifactItem> where I do the unpack
> will cause a maintenance nightmare.  If A -> B -> C and I update C to
> a new version, A will correctly get the new version of C into the
> repository, but it won't unpack the new version of C when I don't
> update that version number in <artifactItem> where I do the unpack.
>
> On a related note, is there a way to get it to automatically unpack
> every dependency, without having to write out a bunch of
> <artifactItem>?  In other words, could I write a plugin that would do
> the equivalent of a "dependency:resolve" to figure out what all the
> dependencies are and their versions, and then do an unpack on each
> one.  Or better yet, somehow hook into the normal dependency resolve
> goal and do it there (if an <unpack>true</unpack> is specified with
>  that dependency).


Try something like this.  It works fairly well for me

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
  <outputDirectory>myOutputDirectory</outputDirectory>
   <overWriteReleases>false</overWriteReleases>
   <overWriteSnapshots>false</overWriteSnapshots>
   <overWriteIfNewer>true</overWriteIfNewer>
 <copyPom>false</copyPom>
   <useSubDirectoryPerArtifact>true</useSubDirectoryPerArtifact>
</configuration>
</execution>
</executions>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message