Maven shade插件可以获取IDE广告罐吗?

时间:2016-09-07 13:35:49

标签: eclipse maven maven-shade-plugin

我试图使用Maven阴影插件(according to the tutorial here)创建一个"胖罐"从我的项目。

我在eclipse中处理我的项目,当我查看(巨大的)生成的胖jar时,我发现它包含了很多(可能是所有)Eclipse IDE代码本身的类。

为什么要这样做以及如何阻止它这样做?

我尝试在<exclude> <filters>中列出一堆目录,但Eclipse JDT jar也在jar中有一些文件&#34; root&#34;文件夹并不容易列出所有这些。

<plugin>文件的pom.xml部分目前看起来像这样:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>${maven.shade.version}</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <createDependencyReducedPom>true</createDependencyReducedPom>
                        <filters>
                            <filter>
                                <artifact>*:*</artifact>
                                <excludes>
                                    <exclude>vertx-unit*/**</exclude>
                                    <exclude>org/apache/derby/**</exclude>
                                    <exclude>javax/annotation/**</exclude>
                                    <exclude>com/google/googlejavaformat/**</exclude>
                                    <exclude>org/eclipse/**</exclude>
                                    <exclude>jdtCompilerAdapter.jar</exclude>
                                    <exclude>ant_tasks/**</exclude>
                                    <exclude>META-INF/services/org.osgi.framework.launch.FrameworkFactory</exclude>
                                    <exclude>about_files/**</exclude>
                                    <exclude>org/osgi/**</exclude>
                                </excludes>
                            </filter>
                        </filters>
                        <transformers>
                            <transformer
                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <manifestEntries>
                                    <Main-Class>io.vertx.core.Starter</Main-Class>
                                    <Main-Verticle>io.thesphere.service.App</Main-Verticle>
                                </manifestEntries>
                            </transformer>
                        </transformers>
                        <artifactSet />
                        <outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar</outputFile>
                    </configuration>
                </execution>
            </executions>
        </plugin>

0 个答案:

没有答案