简体   繁体   English

使用来自Scala和sbt的Maven的阴影插件

[英]Using Maven's shade plugin from Scala and sbt

Due to some quirks in some dependencies, I'm having trouble with sbt-assembly , and have been told that people working with Java and have had good results with Maven's shade plugin. 由于某些依赖项中存在一些怪癖,我在使用sbt-assembly遇到了麻烦,并且被告知使用Java并且使用Maven的shade插件获得了良好结果的人。

How can I use Maven's shade plugin for Scala / sbt? 如何为Scala / sbt使用Maven的阴影插件?

You can add the following to your POM 您可以将以下内容添加到POM中

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <filters>
                            <filter>
                                <artifact>*:*</artifact>
                                <excludes>
                                    <exclude>META-INF/*.SF</exclude>
                                    <exclude>META-INF/*.DSA</exclude>
                                    <exclude>META-INF/*.RSA</exclude>
                                </excludes>
                            </filter>
                        </filters>
                        <transformers>
                            <transformer
                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>com.group.id.Launcher1</mainClass>
                            </transformer>
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>

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

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