Advertisement
Guest User

org.kuali.maven.plugins.properties-maven-plugin

a guest
Apr 21st, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.21 KB | None | 0 0
  1. <!--
  2.  
  3. The intention is to use a password in a properties file to decrypt a common shared password.
  4.  
  5. -->
  6. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  7. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  8. <modelVersion>4.0.0</modelVersion>
  9. <groupId>com.jasypt-stub.app</groupId>
  10. <artifactId>my-app</artifactId>
  11. <packaging>jar</packaging>
  12. <version>1.0-SNAPSHOT</version>
  13. <name>my-app</name>
  14. <url>http://maven.apache.org</url>
  15.  
  16. <properties>
  17. <db>myappdb</db>
  18. <db.schema>myappdb.sql</db.schema>
  19. <db.driver>com.mysql.jdbc.Driver</db.driver>
  20. <db.jdbc>jdbc:mysql://localhost</db.jdbc>
  21. <db.url>${db.jdbc}/${db}</db.url>
  22. <db.user>root</db.user>
  23.  
  24. <db.pass.encrypted>ENC(gGr2qWvdOJTioF7K/E9X3p09FL8wXWMB)</db.pass.encrypted>
  25.  
  26. <!-- defined in property file location specified below -->
  27. <!--enc.password>testpassword</enc.password-->
  28.  
  29. <mysql.driver.version>5.1.38</mysql.driver.version>
  30.  
  31. <plugin.properties.version>2.0.1</plugin.properties.version>
  32. <plugin.sql.version>1.5</plugin.sql.version>
  33. </properties>
  34.  
  35. <build>
  36.  
  37. <pluginManagement>
  38. <plugins>
  39.  
  40. <plugin>
  41. <groupId>org.codehaus.mojo</groupId>
  42. <artifactId>sql-maven-plugin</artifactId>
  43. <version>${plugin.sql.version}</version>
  44. <dependencies>
  45. <dependency>
  46. <groupId>mysql</groupId>
  47. <artifactId>mysql-connector-java</artifactId>
  48. <version>${mysql.driver.version}</version>
  49. </dependency>
  50. </dependencies>
  51. <configuration>
  52. <driver>${db.driver}</driver>
  53. <url>${db.jdbc}</url>
  54. <username>${db.user}</username>
  55. <password>${db.pass}</password>
  56. </configuration>
  57. <executions>
  58. <execution>
  59. <id>create-db</id>
  60. <configuration>
  61. <sqlCommand>create database ${db}</sqlCommand>
  62. </configuration>
  63. </execution>
  64. <execution>
  65. <id>create-schema</id>
  66. <configuration>
  67. <url>${db.url}</url>
  68. <srcFiles>${db.schema}</srcFiles>
  69. </configuration>
  70. </execution>
  71. <execution>
  72. <id>drop-db</id>
  73. <goals>
  74. <goal>drop</goal>
  75. </goals>
  76. <configuration>
  77. <sqlCommand>drop database ${db}</sqlCommand>
  78. </configuration>
  79. </execution>
  80. </executions>
  81. </plugin>
  82.  
  83. <plugin>
  84. <groupId>org.kuali.maven.plugins</groupId>
  85. <artifactId>properties-maven-plugin</artifactId>
  86. <version>${plugin.properties.version}</version>
  87. <executions>
  88. <execution>
  89. <id>decrypt</id>
  90. <goals>
  91. <goal>decryptall</goal>
  92. </goals>
  93. <phase>initialize</phase>
  94. <configuration>
  95. <show>true</show>
  96. <quiet>false</quiet>
  97. <password>${enc.password}</password>
  98. </configuration>
  99. </execution>
  100. <execution>
  101. <id>translate</id>
  102. <phase>initialize</phase>
  103. <goals>
  104. <goal>translate-properties</goal>
  105. </goals>
  106. <configuration>
  107. <properties>
  108. <param>deploy.groupId</param>
  109. </properties>
  110. </configuration>
  111. </execution>
  112. <execution>
  113. <id>read</id>
  114. <phase>initialize</phase>
  115. <goals>
  116. <goal>read-project-properties</goal>
  117. </goals>
  118. <configuration>
  119. <locations>
  120. <param>
  121. <!-- where you would keep the enc.password assuming encrypted home dir and
  122. restricted file access -->
  123. ${user.home}/${db}.properties
  124. </param>
  125. <param>
  126. <!-- under project.home as simplicity for example, putting property file with
  127. enc password under source control would defeat the purpose of encoding -->
  128. ${project.home}/${db}.properties
  129. </param>
  130. </locations>
  131. </configuration>
  132. </execution>
  133. </executions>
  134. </plugin>
  135.  
  136. </plugins>
  137. </pluginManagement>
  138.  
  139. </build>
  140.  
  141. <dependencies>
  142. <dependency>
  143. <groupId>mysql</groupId>
  144. <artifactId>mysql-connector-java</artifactId>
  145. <version>${mysql.driver.version}</version>
  146. </dependency>
  147. </dependencies>
  148. </project>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement