简体   繁体   中英

maven-shade-plugin and licenses

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM