2

I'm creating a minimized jar using the maven-shade-plugin and have quite a lot of dependencies included that are external, ie. having all sorts of open licenses. How do I preserve those licenses in a convenient and appropriate manner?

Is there any existing way to automatically attribute the contents of the shaded jar to specific input jars and then create an overview file that explains which class files/resources files belong to which input jar/license?

linuts
  • 6,608
  • 4
  • 35
  • 37
user1050755
  • 11,218
  • 4
  • 45
  • 56
  • If that's a licensing question I can't see why you would need to. But maybe it's a technical question... – david.pfx Apr 10 '14 at 15:07

2 Answers2

0

I was just looking to do the same thing. I thought that ApacheLicenseResourceTransformer would help, but that just removes the licenses.

Best thing I can think of right now is to append all licenses into one file using AppendingTransformer.

If all you need to include is the notices which can be the case for Apache 2 licenses then ApacheNoticeResourceTransformer is probably exactly what you are looking for.

You can add your "explanation" file using IncludeResourceTransformer if needed.

Andrew Wynham
  • 2,310
  • 21
  • 25
  • You said "ApacheLicenseResourceTransformer just removes the license", but I can see at least META-INF/LICENSE is converted from a plain file into a dir and it includes multiple files. In my case, LICENSE.commons-logging.txt, for example. I'm not sure about how overlapping root level LICENSE files are treated. – juhoautio Apr 19 '21 at 09:37
0

my workaround brought about by manifest collisions is

-cp "$PWD/target/classes:$PWD/target/lib/*" pkg.random.ClassWithMain

with the dep plugin:

            <plugins>
                <plugin>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                        <execution>
                            <phase>install</phase>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>

this might be better as a comment but my rep prevents it.

jnorthrup
  • 23
  • 5