<build> <finalName>Spring_boot</finalName> <plugins> <!--配置jar包相关属性--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <!--是否依赖jar文件--> <addClasspath>true</addClasspath> <!--依赖jar文件的路径--> <classpathPrefix>lib/</classpathPrefix> <!--程序入口--> <mainClass>Run.RunApplication</mainClass> </manifest> <!--将资源文件添加到classspah中,,打包时会在该目录下加载配置文件--> <manifestEntries> <!--配置文件相对于jar包的路径--> <Class-Path>.</Class-Path> </manifestEntries> </archive> <!--不打以下文件--> <excludes> <exclude>**/*.xml</exclude> <exclude>**/*.conf</exclude> <exclude>**/*.sh</exclude> </excludes> <!--将jar包打到以下目录--> <outputDirectory>${project.build.directory}/${artifactId}</outputDirectory> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <!--跳过测试用例,但编译测试类--> <skipTests>true</skipTests> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.7</version> <executions> <execution> <id>copy-resources</id> <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <!--资源复制目标目录--> <outputDirectory>${project.build.directory}/${artifactId}</outputDirectory> <resources> <!--资源目录--> <resource> <directory>src/main/resources/</directory> <!--包括哪些文件--> <includes> <exclude>**/*.xml</exclude> <exclude>**/*.conf</exclude> <exclude>**/*.sh</exclude> </includes> </resource> </resources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-dependency</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/${artifactId}/lib</outputDirectory> <!--是否不包含间接依赖--> <excludeTransitive>false</excludeTransitive> <!--忽略版本--> <stripVersion>false</stripVersion> </configuration> </execution> </executions> </plugin> <!--<plugin>--> <!--<groupId>org.apache.maven.plugins</groupId>--> <!--<artifactId>maven-war-plugin</artifactId>--> <!--<version>2.6</version>--> <!--<configuration>--> <!--<webResources>--> <!--<resource>--> <!--<!–源文件位置–>--> <!--<directory>src/main/webapp/WEB-INF</directory>--> <!--<!–是否过滤配置文件–>--> <!--<fitering>false</fitering>--> <!--<!–目标路径–>--> <!--<target>WEB-INF</target>--> <!--</resource>--> <!--</webResources>--> <!--</configuration>--> <!----> <!--</plugin>--> <!----> <plugin> <groupId>net.alchim31.maven</groupId> <artifactId>scala-maven-plugin</artifactId> <version>3.2.2</version> <executions> <execution> <id>scala-compile-first</id> <goals> <goal>compile</goal> </goals> </execution> <execution> <id>scala-test-compile</id> <goals> <goal>testCompile</goal> </goals> </execution> </executions> <configuration> <excludes> <exclude>**/*.xml</exclude> <exclude>**/*.conf</exclude> <exclude>**/*.sh</exclude> </excludes> </configuration> </plugin> </plugins> </build>
maven打包插件解释
最新推荐文章于 2024-02-04 14:44:21 发布