[ 
https://issues.apache.org/jira/browse/IVY-608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12529849
 ] 

Jan Matèrne commented on IVY-608:
---------------------------------

Regarding the maintenance of Ant code ... some thoughts ...

interface EnvironmentLoader {
    Map getEnvironment();
}
abstract class EnvLoaderFactory {
    EnvironmentLoader getEnvLoader() {
        // 1. check for Java5, then return the Java5EnvLoader
        // 2. check if Ants <property> is on classpath; then use AntEnvLoader
        // 3. other implementations?
        // NoEnvLoader
    }
}
interface EnvironmentLoader {
    Map getEnvironment();
}
public class NoEnvironmentLoader implements EnvironmentLoader {
    Map getEnvironment() {
        // error statements
        // maybe an exception?
    }
}
public class AntEnvironmentLoader implements EnvironmentLoader {
    Map getEnvironment() {
        oata.taskdefs.Properties propTask = new ...
        // some more configuration needed?
        propTask.setEnvironment("env");
        propTask.execute();
        // read the env key-value pairs
        return ...
    }
}
public class Java5EnvLoader implements EnvironmentLoader {
    Map getEnvironment() {
        // based on Jings implementation
    }
}

> Add support for importing environment variables
> -----------------------------------------------
>
>                 Key: IVY-608
>                 URL: https://issues.apache.org/jira/browse/IVY-608
>             Project: Ivy
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 2.0.0-alpha-2
>            Reporter: Jing Xue
>            Priority: Minor
>         Attachments: import-env-1.patch
>
>
> Ant supports importing environment variables into properties via the 
> <properties environment="env" /> task.  If an ivysettings.xml relies on an 
> environment variable, the lack of support for this feature in Ivy makes it 
> difficult to reuse the same ivysettings.xml in a non-Ant environment, such as 
> in IvyDE.  I'm submitting a patch to add the support for JDK 1.5+. This 
> implementation will throw an exception when running in lesser JVMs.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to