简体   繁体   English

maven-shade-plugin 和许可证

[英]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.我正在使用 maven-shade-plugin 创建一个最小化的 jar,并且包含很多外部依赖项,即。 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?是否有任何现有方法可以自动将阴影 jar 的内容归因于特定的输入 jar,然后创建一个概述文件来解释哪些类文件/资源​​文件属于哪个输入 jar/许可证?

I was just looking to do the same thing.我只是想做同样的事情。 I thought that ApacheLicenseResourceTransformer would help, but that just removes the licenses.我认为ApacheLicenseResourceTransformer会有所帮助,但这只是删除了许可证。

Best thing I can think of right now is to append all licenses into one file using AppendingTransformer .我现在能想到的最好的事情是使用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.如果您只需要包含 Apache 2 许可的通知,那么ApacheNoticeResourceTransformer可能正是您正在寻找的。

You can add your "explanation" file using IncludeResourceTransformer if needed.如果需要,您可以使用IncludeResourceTransformer添加“说明”文件。

my workaround brought about by manifest collisions is我的明显冲突带来的解决方法是

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

with the dep plugin:使用 dep 插件:

            <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.作为评论,这可能会更好,但我的代表阻止了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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