Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--
- The intention is to use a password in a properties file to decrypt a common shared password.
- -->
- <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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.jasypt-stub.app</groupId>
- <artifactId>my-app</artifactId>
- <packaging>jar</packaging>
- <version>1.0-SNAPSHOT</version>
- <name>my-app</name>
- <url>http://maven.apache.org</url>
- <properties>
- <db>myappdb</db>
- <db.schema>myappdb.sql</db.schema>
- <db.driver>com.mysql.jdbc.Driver</db.driver>
- <db.jdbc>jdbc:mysql://localhost</db.jdbc>
- <db.url>${db.jdbc}/${db}</db.url>
- <db.user>root</db.user>
- <db.pass.encrypted>ENC(gGr2qWvdOJTioF7K/E9X3p09FL8wXWMB)</db.pass.encrypted>
- <!-- defined in property file location specified below -->
- <!--enc.password>testpassword</enc.password-->
- <mysql.driver.version>5.1.38</mysql.driver.version>
- <plugin.properties.version>2.0.1</plugin.properties.version>
- <plugin.sql.version>1.5</plugin.sql.version>
- </properties>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>sql-maven-plugin</artifactId>
- <version>${plugin.sql.version}</version>
- <dependencies>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>${mysql.driver.version}</version>
- </dependency>
- </dependencies>
- <configuration>
- <driver>${db.driver}</driver>
- <url>${db.jdbc}</url>
- <username>${db.user}</username>
- <password>${db.pass}</password>
- </configuration>
- <executions>
- <execution>
- <id>create-db</id>
- <configuration>
- <sqlCommand>create database ${db}</sqlCommand>
- </configuration>
- </execution>
- <execution>
- <id>create-schema</id>
- <configuration>
- <url>${db.url}</url>
- <srcFiles>${db.schema}</srcFiles>
- </configuration>
- </execution>
- <execution>
- <id>drop-db</id>
- <goals>
- <goal>drop</goal>
- </goals>
- <configuration>
- <sqlCommand>drop database ${db}</sqlCommand>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.kuali.maven.plugins</groupId>
- <artifactId>properties-maven-plugin</artifactId>
- <version>${plugin.properties.version}</version>
- <executions>
- <execution>
- <id>decrypt</id>
- <goals>
- <goal>decryptall</goal>
- </goals>
- <phase>initialize</phase>
- <configuration>
- <show>true</show>
- <quiet>false</quiet>
- <password>${enc.password}</password>
- </configuration>
- </execution>
- <execution>
- <id>translate</id>
- <phase>initialize</phase>
- <goals>
- <goal>translate-properties</goal>
- </goals>
- <configuration>
- <properties>
- <param>deploy.groupId</param>
- </properties>
- </configuration>
- </execution>
- <execution>
- <id>read</id>
- <phase>initialize</phase>
- <goals>
- <goal>read-project-properties</goal>
- </goals>
- <configuration>
- <locations>
- <param>
- <!-- where you would keep the enc.password assuming encrypted home dir and
- restricted file access -->
- ${user.home}/${db}.properties
- </param>
- <param>
- <!-- under project.home as simplicity for example, putting property file with
- enc password under source control would defeat the purpose of encoding -->
- ${project.home}/${db}.properties
- </param>
- </locations>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
- <dependencies>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>${mysql.driver.version}</version>
- </dependency>
- </dependencies>
- </project>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement