一些心得

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.1</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.AppendingTransformer">
                                <resource>META-INF/spring.handlers</resource>
                            </transformer>

                            <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <resource>META-INF/spring.schemas</resource>
                            </transformer>

                            <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>com.test.consumer.UmeFlightStatus.TestClient</mainClass>
                            </transformer>

                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>

    </plugins>
    </build>

shade 打包时< scope>provided< /scope>在,不会打包进去
若想打包进去将pom.xml文件中的< scope>provided< /scope>标签注释掉即可。如果打依赖包时需要去掉该jar,再加上provided标签就可以了

mvn install:install-file -Dfile=PCHN.jar -DgroupId=com.njcb -DartifactId=PCHN -Dversion=1.0 -Dpackaging=jar

上一篇:C#中的int、long、float、double等类型都占多少个字节的内存?


下一篇:解决AD不能复制粘贴