View Javadoc

1   package com.imcode.ant.tasks;
2   
3   import org.apache.tools.ant.Task;
4   import org.apache.tools.ant.BuildException;
5   
6   public class SetSystemPropertyTask extends Task {
7   
8       private String name ;
9       private String value ;
10  
11      public void setName(String name) {
12          this.name = name;
13      }
14  
15      public void setValue(String value) {
16          this.value = value;
17      }
18  
19      public void execute() throws BuildException {
20          if (null == name || null == value) {
21              throw new BuildException("Both the attributes 'name' and 'value' must be set.");
22          }
23          
24          System.setProperty(name, value) ;
25      }
26  
27  }