pom.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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.7</jdk.version>
  10. <dropwizard.version>0.8.1</dropwizard.version>
  11. <mysql-connector-java.version>5.1.35</mysql-connector-java.version>
  12. <mongojack.version>2.3.0</mongojack.version>
  13. <postgres-jdbc.version>9.4-1201-jdbc41</postgres-jdbc.version>
  14. <dropwizard.java8.version>0.8.0-1</dropwizard.java8.version>
  15. <main.class>com.example.helloworld.HelloWorldService</main.class>
  16. </properties>
  17. <profiles>
  18. <profile>
  19. <id>mysql</id>
  20. <dependencies>
  21. <dependency>
  22. <groupId>mysql</groupId>
  23. <artifactId>mysql-connector-java</artifactId>
  24. <version>${mysql-connector-java.version}</version>
  25. </dependency>
  26. </dependencies>
  27. </profile>
  28. <profile>
  29. <id>mongo</id>
  30. <properties>
  31. <main.class>com.example.helloworld.HelloMongoService</main.class>
  32. </properties>
  33. </profile>
  34. <profile>
  35. <id>postgres</id>
  36. <dependencies>
  37. <dependency>
  38. <groupId>org.postgresql</groupId>
  39. <artifactId>postgresql</artifactId>
  40. <version>${postgres-jdbc.version}</version>
  41. </dependency>
  42. </dependencies>
  43. </profile>
  44. </profiles>
  45. <dependencies>
  46. <dependency>
  47. <groupId>io.dropwizard</groupId>
  48. <artifactId>dropwizard-core</artifactId>
  49. <version>${dropwizard.version}</version>
  50. </dependency>
  51. <dependency>
  52. <groupId>io.dropwizard</groupId>
  53. <artifactId>dropwizard-hibernate</artifactId>
  54. <version>${dropwizard.version}</version>
  55. </dependency>
  56. <dependency>
  57. <groupId>io.dropwizard</groupId>
  58. <artifactId>dropwizard-views-mustache</artifactId>
  59. <version>${dropwizard.version}</version>
  60. </dependency>
  61. <dependency>
  62. <groupId>io.dropwizard.modules</groupId>
  63. <artifactId>dropwizard-java8</artifactId>
  64. <version>${dropwizard.java8.version}</version>
  65. </dependency>
  66. <dependency>
  67. <groupId>org.mongojack</groupId>
  68. <artifactId>mongojack</artifactId>
  69. <version>${mongojack.version}</version>
  70. <exclusions>
  71. <exclusion>
  72. <groupId>com.fasterxml.jackson.core</groupId>
  73. <artifactId>jackson-databind</artifactId>
  74. </exclusion>
  75. </exclusions>
  76. </dependency>
  77. </dependencies>
  78. <build>
  79. <plugins>
  80. <plugin>
  81. <groupId>org.apache.maven.plugins</groupId>
  82. <artifactId>maven-compiler-plugin</artifactId>
  83. <version>2.3.2</version>
  84. <configuration>
  85. <source>${jdk.version}</source>
  86. <target>${jdk.version}</target>
  87. </configuration>
  88. </plugin>
  89. <plugin>
  90. <groupId>org.apache.maven.plugins</groupId>
  91. <artifactId>maven-jar-plugin</artifactId>
  92. <version>2.3.2</version>
  93. <configuration>
  94. <archive>
  95. <manifest>
  96. <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
  97. </manifest>
  98. </archive>
  99. </configuration>
  100. </plugin>
  101. <plugin>
  102. <groupId>org.apache.maven.plugins</groupId>
  103. <artifactId>maven-shade-plugin</artifactId>
  104. <version>1.6</version>
  105. <configuration>
  106. <createDependencyReducedPom>true</createDependencyReducedPom>
  107. <filters>
  108. <filter>
  109. <artifact>*:*</artifact>
  110. <excludes>
  111. <exclude>META-INF/*.SF</exclude>
  112. <exclude>META-INF/*.DSA</exclude>
  113. <exclude>META-INF/*.RSA</exclude>
  114. </excludes>
  115. </filter>
  116. </filters>
  117. </configuration>
  118. <executions>
  119. <execution>
  120. <phase>package</phase>
  121. <goals>
  122. <goal>shade</goal>
  123. </goals>
  124. <configuration>
  125. <transformers>
  126. <transformer
  127. implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
  128. <transformer
  129. implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
  130. <mainClass>${main.class}</mainClass>
  131. </transformer>
  132. </transformers>
  133. </configuration>
  134. </execution>
  135. </executions>
  136. </plugin>
  137. </plugins>
  138. </build>
  139. </project>