pom.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  2. <modelVersion>4.0.0</modelVersion>
  3. <parent>
  4. <groupId>com.alibaba.otter</groupId>
  5. <artifactId>canal</artifactId>
  6. <version>1.1.7-SNAPSHOT</version>
  7. <relativePath>../pom.xml</relativePath>
  8. </parent>
  9. <groupId>com.alibaba.otter</groupId>
  10. <artifactId>canal.example</artifactId>
  11. <packaging>jar</packaging>
  12. <name>canal example module for otter ${project.version}</name>
  13. <dependencies>
  14. <dependency>
  15. <groupId>com.alibaba.otter</groupId>
  16. <artifactId>canal.client</artifactId>
  17. <version>${project.version}</version>
  18. </dependency>
  19. <dependency>
  20. <groupId>com.alibaba.otter</groupId>
  21. <artifactId>canal.protocol</artifactId>
  22. <version>${project.version}</version>
  23. </dependency>
  24. <!-- test dependency -->
  25. <dependency>
  26. <groupId>junit</groupId>
  27. <artifactId>junit</artifactId>
  28. <scope>test</scope>
  29. </dependency>
  30. </dependencies>
  31. <build>
  32. <plugins>
  33. <!-- deploy模块的packaging通常是jar,如果项目中没有java 源代码或资源文件,加上这一段配置使项目能通过构建 -->
  34. <plugin>
  35. <groupId>org.apache.maven.plugins</groupId>
  36. <artifactId>maven-jar-plugin</artifactId>
  37. <version>2.5</version>
  38. <configuration>
  39. <archive>
  40. <addMavenDescriptor>true</addMavenDescriptor>
  41. </archive>
  42. </configuration>
  43. </plugin>
  44. <plugin>
  45. <groupId>org.apache.maven.plugins</groupId>
  46. <artifactId>maven-assembly-plugin</artifactId>
  47. <!-- 这是最新版本,推荐使用这个版本 -->
  48. <version>2.2.1</version>
  49. <executions>
  50. <execution>
  51. <id>assemble</id>
  52. <goals>
  53. <goal>single</goal>
  54. </goals>
  55. <phase>package</phase>
  56. </execution>
  57. </executions>
  58. <configuration>
  59. <appendAssemblyId>false</appendAssemblyId>
  60. <attach>false</attach>
  61. </configuration>
  62. </plugin>
  63. </plugins>
  64. </build>
  65. <profiles>
  66. <profile>
  67. <id>dev</id>
  68. <activation>
  69. <activeByDefault>true</activeByDefault>
  70. <property>
  71. <name>env</name>
  72. <value>!release</value>
  73. </property>
  74. </activation>
  75. <build>
  76. <plugins>
  77. <plugin>
  78. <artifactId>maven-assembly-plugin</artifactId>
  79. <configuration>
  80. <!-- maven assembly插件需要一个描述文件 来告诉插件包的结构以及打包所需的文件来自哪里 -->
  81. <descriptors>
  82. <descriptor>${basedir}/src/main/assembly/dev.xml</descriptor>
  83. </descriptors>
  84. <finalName>canal-example</finalName>
  85. <outputDirectory>${project.build.directory}</outputDirectory>
  86. </configuration>
  87. </plugin>
  88. </plugins>
  89. </build>
  90. </profile>
  91. <profile>
  92. <id>release</id>
  93. <activation>
  94. <property>
  95. <name>env</name>
  96. <value>release</value>
  97. </property>
  98. </activation>
  99. <build>
  100. <plugins>
  101. <plugin>
  102. <artifactId>maven-assembly-plugin</artifactId>
  103. <configuration>
  104. <!-- 发布模式使用的maven assembly插件描述文件 -->
  105. <descriptors>
  106. <descriptor>${basedir}/src/main/assembly/release.xml</descriptor>
  107. </descriptors>
  108. <!-- 如果一个应用的包含多个deploy模块,如果使用同样的包名, 如果把它们复制的一个目录中可能会失败,所以包名加了 artifactId以示区分 -->
  109. <finalName>${project.artifactId}-${project.version}</finalName>
  110. <!-- scm 要求 release 模式打出的包放到顶级目录下的target子目录中 -->
  111. <outputDirectory>${project.parent.build.directory}</outputDirectory>
  112. </configuration>
  113. </plugin>
  114. </plugins>
  115. </build>
  116. </profile>
  117. </profiles>
  118. </project>