sakhtar1979 / onejar-maven-plugin

Automatically exported from code.google.com/p/onejar-maven-plugin
0 stars 0 forks source link

Artifacts should be copied by user selection (runtime, compile, etc) #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. The one-jar maven plugin will copy all dependency libraries in to the 
one.jar/lib/ directory.

2. This includes even <scope>compile</scope> libraries of transitive 
dependencies, which are in 99% of all cases not needed to run the one.jar.

3. This means there are unnecessary libraries in the one.jar, bloating the 
resulting archive.

Ideally I should be able to pick

a) if transitive dependencies should be copied at all
b) for all dependencies (transitive or not) what scopes should be considered
c) probably, the default should be to copy transitive dependencies with 
<scope>runtime</scope> and not any other scope

What version of onejar-maven-plugin are you using?

1.4.3
What is the output of "mvn -version" on your machine?

Please provide any additional information below.

Original issue reported on code.google.com by christia...@gmail.com on 8 Jul 2010 at 10:12

GoogleCodeExporter commented 9 years ago
This is a classic problem with artifacts which are not declared correctly, 
bringing in too many or too few transitive dependencies. It should be handled 
by the authors/maintainers of those dependencies, but can be overridden by you 
in the <dependency> declaration using <excludes>.

Original comment by hugo.josefson.old@gmail.com on 6 Oct 2010 at 8:48

GoogleCodeExporter commented 9 years ago
I know how to declare dependencies and their transitive behavior and I'm quite 
sure I've not made a mistake.  Compile scoped transitive dependencies should 
not be copied into the one-jar archive but they are.

Related to this bug: one-jar also copies <optional>true</optional> transitive 
dependencies into the archive.

Original comment by christia...@gmail.com on 6 Oct 2010 at 9:08

GoogleCodeExporter commented 9 years ago
My mistake; I was too quick to dismiss. Thanks for clarifying!

Original comment by hugo.josefson.old@gmail.com on 7 Oct 2010 at 3:55

GoogleCodeExporter commented 9 years ago
This declaration in my parent pom:

            <dependency>
                <groupId>javax.inject</groupId>
                <artifactId>javax.inject</artifactId>
                <version>${javax.inject.version}</version>
                <scope>compile</scope>
                <optional>true</optional>
            </dependency>

Results in the javax.inject jar inside my one-jar archive.  Why?

Original comment by b.k.ox...@gmail.com on 18 Nov 2011 at 6:13