pom.xml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3. <modelVersion>4.0.0</modelVersion>
  4. <parent>
  5. <relativePath>../</relativePath>
  6. <!--<relativePath>../pom.xml</relativePath>-->
  7. <artifactId>wildfirechat-parent</artifactId>
  8. <groupId>cn.wildfirechat</groupId>
  9. <version>0.96</version>
  10. </parent>
  11. <artifactId>distribution</artifactId>
  12. <packaging>pom</packaging>
  13. <name>Moquette - distribution</name>
  14. <!-- Includes all modules -->
  15. <dependencies>
  16. <dependency>
  17. <groupId>${project.groupId}</groupId>
  18. <artifactId>moquette-broker</artifactId>
  19. <version>${project.version}</version>
  20. </dependency>
  21. </dependencies>
  22. <build>
  23. <sourceDirectory>${basedir}/src/main/</sourceDirectory> <!-- Force default maven layout -->
  24. <plugins>
  25. <plugin>
  26. <groupId>pl.project13.maven</groupId>
  27. <artifactId>git-commit-id-plugin</artifactId>
  28. <version>2.1.5</version>
  29. <executions>
  30. <execution>
  31. <goals>
  32. <goal>revision</goal>
  33. </goals>
  34. </execution>
  35. </executions>
  36. <configuration>
  37. <!--日期格式;默认值:dd.MM.yyyy '@' HH:mm:ss z;-->
  38. <dateFormat>yyyyMMddHHmmss</dateFormat>
  39. <!--,构建过程中,是否打印详细信息;默认值:false;-->
  40. <verbose>true</verbose>
  41. <!-- ".git"文件路径;默认值:${project.basedir}/.git; -->
  42. <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
  43. <!--若项目打包类型为pom,是否取消构建;默认值:true;-->
  44. <skipPoms>false</skipPoms>
  45. <!--是否生成"git.properties"文件;默认值:false;-->
  46. <generateGitPropertiesFile>true</generateGitPropertiesFile>
  47. <!--指定"git.properties"文件的存放路径(相对于${project.basedir}的一个路径);-->
  48. <generateGitPropertiesFilename>src/main/resources/git.properties</generateGitPropertiesFilename>
  49. <!--".git"文件夹未找到时,构建是否失败;若设置true,则构建失败;若设置false,则跳过执行该目标;默认值:true;-->
  50. <failOnNoGitDirectory>false</failOnNoGitDirectory>
  51. <!--git描述配置,可选;由JGit提供实现;-->
  52. <gitDescribe>
  53. <!--是否生成描述属性-->
  54. <skip>false</skip>
  55. <!--提交操作未发现tag时,仅打印提交操作ID,-->
  56. <always>false</always>
  57. <!--提交操作ID显式字符长度,最大值为:40;默认值:7;
  58. 0代表特殊意义;后面有解释;
  59. -->
  60. <abbrev>7</abbrev>
  61. <!--构建触发时,代码有修改时(即"dirty state"),添加指定后缀;默认值:"";-->
  62. <dirty>-dirty</dirty>
  63. <!--always print using the "tag-commits_from_tag-g_commit_id-maybe_dirty" format, even if "on" a tag.
  64. The distance will always be 0 if you're "on" the tag.
  65. -->
  66. <forceLongFormat>false</forceLongFormat>
  67. </gitDescribe>
  68. </configuration>
  69. </plugin>
  70. <plugin>
  71. <groupId>org.apache.maven.plugins</groupId>
  72. <artifactId>maven-assembly-plugin</artifactId>
  73. <version>2.4</version>
  74. <executions>
  75. <execution>
  76. <id>distribution-package</id>
  77. <phase>package</phase>
  78. <goals>
  79. <goal>single</goal>
  80. </goals>
  81. <configuration>
  82. <!-- Specifies the configuration file of the assembly plugin -->
  83. <descriptors>
  84. <descriptor>${basedir}/src/main/assembly/assembly.xml</descriptor>
  85. </descriptors>
  86. <tarLongFileMode>gnu</tarLongFileMode>
  87. </configuration>
  88. </execution>
  89. </executions>
  90. </plugin>
  91. <plugin>
  92. <artifactId>jdeb</artifactId>
  93. <groupId>org.vafer</groupId>
  94. <version>1.8</version>
  95. <executions>
  96. <execution>
  97. <phase>package</phase>
  98. <goals>
  99. <goal>jdeb</goal>
  100. </goals>
  101. <configuration>
  102. <controlDir>${project.basedir}/src/main/deb/control</controlDir>
  103. <skipPOMs>false</skipPOMs>
  104. <deb>${project.build.directory}/im-server-${project.version}.deb</deb>
  105. <dataSet>
  106. <data>
  107. <src>${project.build.directory}/distribution-${project.version}-bundle-tar.tar.gz</src>
  108. <type>archive</type>
  109. <mapper>
  110. <type>perm</type>
  111. <prefix>/opt/im-server</prefix>
  112. </mapper>
  113. </data>
  114. <data>
  115. <src>${project.basedir}/../systemd/im-server.service</src>
  116. <type>file</type>
  117. <mapper>
  118. <type>perm</type>
  119. <prefix>/usr/lib/systemd/system</prefix>
  120. </mapper>
  121. </data>
  122. </dataSet>
  123. </configuration>
  124. </execution>
  125. </executions>
  126. </plugin>
  127. <!-- 打包RPM 开始-->
  128. <!-- 打包RPM 包需要本地有rpm命令才可以,linux和mac都可以安装rpm。如果是windows需要cygwin安装rpm才可以,如果不需要rpm包,可以把这个plugin注释掉-->
  129. <plugin>
  130. <groupId>org.codehaus.mojo</groupId>
  131. <artifactId>rpm-maven-plugin</artifactId>
  132. <version>2.2.0</version>
  133. <executions>
  134. <execution>
  135. <id>generate-rpm</id>
  136. <goals>
  137. <goal>rpm</goal>
  138. </goals>
  139. </execution>
  140. </executions>
  141. <configuration>
  142. <group>Applications/Chat</group>
  143. <name>im-server</name>
  144. <needarch>noarch</needarch>
  145. <targetOS>linux</targetOS>
  146. <prefix>/opt/im-server</prefix>
  147. <defineStatements>
  148. <defineStatement>_unpackaged_files_terminate_build 0</defineStatement>
  149. </defineStatements>
  150. <copyTo>
  151. target/im-server-${project.version}.rpm
  152. </copyTo>
  153. <requires>
  154. <require>java-1.8.0-openjdk-headless</require>
  155. </requires>
  156. <mappings>
  157. <mapping>
  158. <directory>/opt/im-server</directory>
  159. <filemode>755</filemode>
  160. <sources>
  161. <source>
  162. <location>${project.build.directory}/distribution-${project.version}-bundle-tar.tar.gz</location>
  163. </source>
  164. </sources>
  165. </mapping>
  166. <mapping>
  167. <directory>/usr/lib/systemd/system</directory>
  168. <filemode>644</filemode>
  169. <username>root</username>
  170. <groupname>root</groupname>
  171. <directoryIncluded>false</directoryIncluded>
  172. <sources>
  173. <source>
  174. <location>${project.basedir}/../systemd/im-server.service</location>
  175. </source>
  176. </sources>
  177. </mapping>
  178. </mappings>
  179. <postinstallScriptlet>
  180. <scriptFile>${project.basedir}/src/main/rpm/install.sh</scriptFile>
  181. <fileEncoding>utf-8</fileEncoding>
  182. <filter>true</filter>
  183. </postinstallScriptlet>
  184. <postremoveScriptlet>
  185. <scriptFile>${project.basedir}/src/main/rpm/uninstall.sh</scriptFile>
  186. <fileEncoding>utf-8</fileEncoding>
  187. <filter>true</filter>
  188. </postremoveScriptlet>
  189. </configuration>
  190. </plugin>
  191. <!-- 打包RPM 结束-->
  192. </plugins>
  193. </build>
  194. </project>