You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Thomas Scheffler <th...@uni-jena.de> on 2009/07/22 08:46:47 UTC

help with maven-dependency-plugin

Hi,

I am using the maven-dependency-plugin to build a big jar file out of direct 
dependencies (code below). If that big jar file is a dependency of another 
project all direct dependencies are also copied over. I just want to copy the 
transitive dependencies of the big jar file.

I tried to mark the dependencies of the big jar file with scope "provided" but 
then also the transitive dependency got marked as "provided".

I am at wits' end now. Can the big jar file mark direct dependencies as 
"provided" but copy the dependencies of it as its own dependencies somehow?

regards

Thomas

<plugin>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
    <execution>
      <id>unpack-dependencies</id>
      <phase>process-resources</phase>
      <goals>
        <goal>unpack-dependencies</goal>
      </goals>
      <configuration>
        <outputDirectory>${project.build.directory}/classes</outputDirectory>
        <excludeTransitive>true</excludeTransitive>
        <excludes>
          LICENSE*, NOTICE*, META-INF/LICENSE*, META-INF/NOTICE*,
          license, license/**/*, test, test/**/*,
          WEB-INF/web.xml,
          WEB-INF/log4j.*,
          WEB-INF/lib, WEB-INF/lib/**/*,
          WEB-INF/classes, WEB-INF/classes/**/*
        </excludes>
      </configuration>
    </execution>
  </executions>
</plugin>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: help with maven-dependency-plugin

Posted by Thomas Scheffler <th...@uni-jena.de>.
Am Mittwoch 22 Juli 2009 09:13:49 schrieb Nicholas Tung:
> 2009/7/21 Thomas Scheffler <th...@uni-jena.de>
>
> > Hi,
> >
> > I am using the maven-dependency-plugin to build a big jar file out of
> > direct
> > dependencies (code below). If that big jar file is a dependency of
> > another project all direct dependencies are also copied over. I just want
> > to copy the
> > transitive dependencies of the big jar file.
> >
> > I tried to mark the dependencies of the big jar file with scope
> > "provided" but
> > then also the transitive dependency got marked as "provided".
> >
> > I am at wits' end now. Can the big jar file mark direct dependencies as
> > "provided" but copy the dependencies of it as its own dependencies
> > somehow?
> >
> > regards
> >
> > Thomas
> >
> > <plugin>
> >  <artifactId>maven-dependency-plugin</artifactId>
> >  <executions>
> >    <execution>
> >      <id>unpack-dependencies</id>
> >      <phase>process-resources</phase>
> >      <goals>
> >        <goal>unpack-dependencies</goal>
> >      </goals>
> >      <configuration>
> >
> >  <outputDirectory>${project.build.directory}/classes</outputDirectory>
> >        <excludeTransitive>true</excludeTransitive>
> >        <excludes>
> >          LICENSE*, NOTICE*, META-INF/LICENSE*, META-INF/NOTICE*,
> >          license, license/**/*, test, test/**/*,
> >          WEB-INF/web.xml,
> >          WEB-INF/log4j.*,
> >          WEB-INF/lib, WEB-INF/lib/**/*,
> >          WEB-INF/classes, WEB-INF/classes/**/*
> >        </excludes>
> >      </configuration>
> >    </execution>
> >  </executions>
> > </plugin>
>
> So you have, e.g.,
> M --> (A, B)
> A --> { D }
> B --> { E }
>
> and you want
> jar(A, B) --> { D, E }
>
> How do jar files express dependencies? Are you trying to create a project
> which then doesn't need to download any more subprojects?

When a project depends on M then A, B should be marked as "provided" (as it is 
provided by M) but D, E should become a direct dependency of M. I hope you can 
understand what I mean.

M is build of 22 little jar files of 22 little project. M is the project which 
builds a big jar out of the 22 little jar files. As M may be a dependency of 
other project, I prefer not to ship 22 little jars with it just the big jar of 
M and the dependencies (D, E in the example) of the 22 little projects (A, B 
in the example)

> You could also use the assembly plugin to generate the jar file; you can
> then specify which modules to include.

The build of the jar file runs fine.

> Maybe you could also manually copy
> dependencies from A and B to M?

I rather prefer some kind of automatic way here. There must exists a solution 
for something like this out there. That's why I was posting to the users 
lists.

Thanks for your help.

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: help with maven-dependency-plugin

Posted by Nicholas Tung <ga...@gmail.com>.
2009/7/21 Thomas Scheffler <th...@uni-jena.de>

> Hi,
>
> I am using the maven-dependency-plugin to build a big jar file out of
> direct
> dependencies (code below). If that big jar file is a dependency of another
> project all direct dependencies are also copied over. I just want to copy
> the
> transitive dependencies of the big jar file.
>
> I tried to mark the dependencies of the big jar file with scope "provided"
> but
> then also the transitive dependency got marked as "provided".
>
> I am at wits' end now. Can the big jar file mark direct dependencies as
> "provided" but copy the dependencies of it as its own dependencies somehow?
>
> regards
>
> Thomas
>
> <plugin>
>  <artifactId>maven-dependency-plugin</artifactId>
>  <executions>
>    <execution>
>      <id>unpack-dependencies</id>
>      <phase>process-resources</phase>
>      <goals>
>        <goal>unpack-dependencies</goal>
>      </goals>
>      <configuration>
>
>  <outputDirectory>${project.build.directory}/classes</outputDirectory>
>        <excludeTransitive>true</excludeTransitive>
>        <excludes>
>          LICENSE*, NOTICE*, META-INF/LICENSE*, META-INF/NOTICE*,
>          license, license/**/*, test, test/**/*,
>          WEB-INF/web.xml,
>          WEB-INF/log4j.*,
>          WEB-INF/lib, WEB-INF/lib/**/*,
>          WEB-INF/classes, WEB-INF/classes/**/*
>        </excludes>
>      </configuration>
>    </execution>
>  </executions>
> </plugin>
>
>
So you have, e.g.,
M --> (A, B)
A --> { D }
B --> { E }

and you want
jar(A, B) --> { D, E }

How do jar files express dependencies? Are you trying to create a project
which then doesn't need to download any more subprojects?

You could also use the assembly plugin to generate the jar file; you can
then specify which modules to include. Maybe you could also manually copy
dependencies from A and B to M?

regards,
Nicholas
https://ntung.com