| 1 | |
package org.kuali.maven.plugins; |
| 2 | |
|
| 3 | |
import java.util.Properties; |
| 4 | |
import java.util.Set; |
| 5 | |
|
| 6 | |
import org.apache.maven.plugin.AbstractMojo; |
| 7 | |
import org.apache.maven.plugin.MojoExecutionException; |
| 8 | |
import org.apache.maven.plugin.MojoFailureException; |
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | 0 | public class SetSystemPropertiesMojo extends AbstractMojo { |
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
private Properties systemProperties; |
| 25 | |
|
| 26 | |
@Override |
| 27 | |
public void execute() throws MojoExecutionException, MojoFailureException { |
| 28 | |
try { |
| 29 | 0 | if (systemProperties == null) { |
| 30 | 0 | return; |
| 31 | |
} |
| 32 | 0 | Set<String> keys = systemProperties.stringPropertyNames(); |
| 33 | 0 | for (String key : keys) { |
| 34 | 0 | String value = systemProperties.getProperty(key); |
| 35 | 0 | System.setProperty(key, value); |
| 36 | 0 | getLog().info("Setting " + key + "=" + value); |
| 37 | 0 | } |
| 38 | 0 | } catch (Exception e) { |
| 39 | 0 | throw new MojoExecutionException("Unexpected error", e); |
| 40 | 0 | } |
| 41 | 0 | } |
| 42 | |
|
| 43 | |
public Properties getSystemProperties() { |
| 44 | 0 | return systemProperties; |
| 45 | |
} |
| 46 | |
|
| 47 | |
public void setSystemProperties(Properties systemProperties) { |
| 48 | 0 | this.systemProperties = systemProperties; |
| 49 | 0 | } |
| 50 | |
} |