pom.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <groupId>com.xekm</groupId>
  6. <artifactId>hello-world</artifactId>
  7. <version>0.0.1-SNAPSHOT</version>
  8. <properties>
  9. <jdk.version>1.8</jdk.version>
  10. <dropwizard.version>1.0.3</dropwizard.version>
  11. <mysql-connector-java.version>5.1.38</mysql-connector-java.version>
  12. <mongojack.version>2.6.1</mongojack.version>
  13. <postgres-jdbc.version>9.4.1208</postgres-jdbc.version>
  14. <main.class>com.example.helloworld.HelloWorldService</main.class>
  15. </properties>
  16. <profiles>
  17. <profile>
  18. <id>mysql</id>
  19. <dependencies>
  20. <dependency>
  21. <groupId>mysql</groupId>
  22. <artifactId>mysql-connector-java</artifactId>
  23. <version>${mysql-connector-java.version}</version>
  24. </dependency>
  25. </dependencies>
  26. </profile>
  27. <profile>
  28. <id>mongo</id>
  29. <properties>
  30. <main.class>com.example.helloworld.HelloMongoService</main.class>
  31. </properties>
  32. </profile>
  33. <profile>
  34. <id>postgres</id>
  35. <dependencies>
  36. <dependency>
  37. <groupId>org.postgresql</groupId>
  38. <artifactId>postgresql</artifactId>
  39. <version>${postgres-jdbc.version}</version>
  40. </dependency>
  41. </dependencies>
  42. </profile>
  43. </profiles>
  44. <dependencies>
  45. <dependency>
  46. <groupId>io.dropwizard</groupId>
  47. <artifactId>dropwizard-core</artifactId>
  48. <version>${dropwizard.version}</version>
  49. </dependency>
  50. <dependency>
  51. <groupId>io.dropwizard</groupId>
  52. <artifactId>dropwizard-hibernate</artifactId>
  53. <version>${dropwizard.version}</version>
  54. </dependency>
  55. <dependency>
  56. <groupId>io.dropwizard</groupId>
  57. <artifactId>dropwizard-views-mustache</artifactId>
  58. <version>${dropwizard.version}</version>
  59. </dependency>
  60. <dependency>
  61. <groupId>org.mongojack</groupId>
  62. <artifactId>mongojack</artifactId>
  63. <version>${mongojack.version}</version>
  64. <exclusions>
  65. <exclusion>
  66. <groupId>com.fasterxml.jackson.core</groupId>
  67. <artifactId>jackson-databind</artifactId>
  68. </exclusion>
  69. </exclusions>
  70. </dependency>
  71. </dependencies>
  72. <build>
  73. <plugins>
  74. <plugin>
  75. <groupId>org.apache.maven.plugins</groupId>
  76. <artifactId>maven-compiler-plugin</artifactId>
  77. <version>2.3.2</version>
  78. <configuration>
  79. <source>${jdk.version}</source>
  80. <target>${jdk.version}</target>
  81. </configuration>
  82. </plugin>
  83. <plugin>
  84. <groupId>org.apache.maven.plugins</groupId>
  85. <artifactId>maven-jar-plugin</artifactId>
  86. <version>2.3.2</version>
  87. <configuration>
  88. <archive>
  89. <manifest>
  90. <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
  91. </manifest>
  92. </archive>
  93. </configuration>
  94. </plugin>
  95. <plugin>
  96. <groupId>org.apache.maven.plugins</groupId>
  97. <artifactId>maven-shade-plugin</artifactId>
  98. <version>1.6</version>
  99. <configuration>
  100. <createDependencyReducedPom>true</createDependencyReducedPom>
  101. <filters>
  102. <filter>
  103. <artifact>*:*</artifact>
  104. <excludes>
  105. <exclude>META-INF/*.SF</exclude>
  106. <exclude>META-INF/*.DSA</exclude>
  107. <exclude>META-INF/*.RSA</exclude>
  108. </excludes>
  109. </filter>
  110. </filters>
  111. </configuration>
  112. <executions>
  113. <execution>
  114. <phase>package</phase>
  115. <goals>
  116. <goal>shade</goal>
  117. </goals>
  118. <configuration>
  119. <transformers>
  120. <transformer
  121. implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
  122. <transformer
  123. implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
  124. <mainClass>${main.class}</mainClass>
  125. </transformer>
  126. </transformers>
  127. </configuration>
  128. </execution>
  129. </executions>
  130. </plugin>
  131. </plugins>
  132. </build>
  133. </project>