NutzCN Logo
问答 nutzboot:shade怎么不打包provided的依赖?
发布于 1834天前 作者 gengxiaoxiaoxin 1410 次浏览 复制 上一个帖子 下一个帖子
标签:

如以下依赖最后会被打包到Jar包中,很浪费空间。

<dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

发现了这行日志

[INFO] Including org.projectlombok:lombok:jar:1.18.0 in the shaded jar.

5 回复

不用lombok就没问题了

这。。。这如果有其他的Jar还是会有这个问题啊?没有解决办法么?

看看 nutzboot-maven-plugin 如何改一下?

尝试添加了Maven-Shade的配置项

<configuration>
                    <createDependencyReducedPom>false</createDependencyReducedPom>
                    <!--<filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
                    </filters>-->
                    <!--                    <minimizeJar>true</minimizeJar>-->
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <artifactSet>
                                <excludes>
                                    <exclude>org.projectlombok:lombok</exclude>
                                </excludes>
                            </artifactSet>
                        </configuration>
                    </execution>
                </executions>

发现日志输出是在Nutzboot-Shade的时候又重新Including了lombok这个Jar

得改nutzboot-maven-plugin的代码

maven的shade打包会跑不了的

添加回复
请先登陆
回到顶部