标签:block cto UI 内容 nbsp 拷贝文件 source res cut
<build>
<!-- 将src/main/java及src/main/resources 目录下的配置文件(*.xml/*.properties)拷贝到系统的编译目录-->
<!-- 注:不可以配置 maven-resources-plugin 的全局配置,否则此配置将会失效 -->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<!-- 通用编译器配置-->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- 生成可以直接运行的jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<finalName>bin/${project.build.finalName}</finalName>
<archive>
<manifest>
<!--启动的Main类-->
<addClasspath>true</addClasspath><!-- 把依赖包的路径设置为在lib文件夹下 -->
<classpathPrefix>lib/</classpathPrefix>
<mainClass>LLS.FtpMonitor</mainClass>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
<excludes>
<exclude>*.properties</exclude>
<exclude>script/</exclude>
<exclude>config/</exclude>
</excludes>
</configuration>
</plugin>
<!-- 拷贝依赖jar包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/bin/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- 拷贝配置文件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/bin</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/script</directory>
<includes>
<include>*.sh</include>
<include>*.bat</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources/</directory>
<includes>
<include>*.properties</include>
<include>config/*</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- 使用zip工具进行打包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>pom-pack.xml</descriptor>
</descriptors>
<finalName>${project.build.finalName}</finalName>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
pom-pack.xml内容如下
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<formats>
<format>zip</format>
</formats>
<fileSets>
<!-- 从目标目录拷贝文件去压缩 -->
<fileSet>
<directory>${project.build.directory}/bin</directory>
<includes>
<include>**/*</include>
</includes>
<outputDirectory>.</outputDirectory>
</fileSet>
</fileSets>
</assembly>
maven-war-plugin 配置
<build>
<finalName>cims</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<outputDirectory>${project.build.directory}/bin</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
maven常用配置
标签:block cto UI 内容 nbsp 拷贝文件 source res cut
原文地址:https://www.cnblogs.com/gxiaoyang/p/9205308.html