maven 打jar包时将 依赖复制到同级lib目录

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <!-- 不指定前缀的话 MANIFEST.MF 默认为根目录。即 Class-Path: axis2-1.6.3.jar hutool-all-5.4.3.jar   。指定了为 Class-Path: lib/axis2-1.6.3.jar lib/hutool-all-5.4.3.jar-->
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>top.lishuoboy.maven.MainTest</mainClass> <!-- 此处为主入口-->
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

 

posted on 2020-12-27 23:35  小石头小祖宗  阅读(31)  评论(0编辑  收藏  举报  来源

导航