public IvyAntSettings configureEasyAntIvyInstance()

in src/main/java/org/apache/easyant/core/EasyAntEngine.java [89:142]


    public IvyAntSettings configureEasyAntIvyInstance(Project project) {
        IvyConfigure easyantIvyConfigure = new IvyConfigure();
        easyantIvyConfigure.setSettingsId(EasyAntMagicNames.EASYANT_IVY_INSTANCE);

        project.setNewProperty(EasyAntMagicNames.EASYANT_DEFAULT_IVYSETTINGS,
                this.getClass().getResource("/org/apache/easyant/core/default-easyant-ivysettings.xml")
                        .toExternalForm());

        project.setNewProperty(EasyAntMagicNames.EASYANT_CORE_JAR_URL, guessEasyantCoreJarUrl().toExternalForm());

        try {
            File userSettings = getUserEasyAntIvySettings(project);
            URL globalSettings = getGlobalEasyAntIvySettings(project);
            boolean isIgnoringUserIvysettings = Project.toBoolean(project
                    .getProperty(EasyAntMagicNames.IGNORE_USER_IVYSETTINGS));

            if (userSettings.exists() && !isIgnoringUserIvysettings) {
                project.log("loading user's easyant ivysettings file from " + userSettings.getAbsolutePath(),
                        Project.MSG_DEBUG);
                easyantIvyConfigure.setFile(userSettings);
            } else if (globalSettings != null) {
                project.log("loading global easyant ivysettings file from " + globalSettings.toExternalForm(),
                        Project.MSG_DEBUG);
                easyantIvyConfigure.setUrl(globalSettings);

            } else {
                project.log("using easyant default ivy settings file", Project.MSG_VERBOSE);
                String url = project.getProperty(EasyAntMagicNames.EASYANT_DEFAULT_IVYSETTINGS);
                easyantIvyConfigure.setUrl(url);
            }
        } catch (MalformedURLException malformedUrl) {
            throw new BuildException("Unable to parse easyant ivysettings from given url", malformedUrl);
        }

        executeTask(easyantIvyConfigure, "configure-easyant", project);

        configureEasyAntOfflineRepository(project);

        IvyAntSettings easyantIvySettings = IvyInstanceHelper.getEasyAntIvyAntSettings(project);

        // FIXME: hack as ResolutionCacheManager and RepositoryCacheManger use XmlModuleDescriptorParser under the hood
        Ivy easyantIvyInstance = easyantIvySettings.getConfiguredIvyInstance(easyantIvyConfigure);

        EasyAntRepositoryCacheManager cacheManager = new EasyAntRepositoryCacheManager("default-easyant-cache",
                easyantIvyInstance.getSettings(), easyantIvyInstance.getSettings().getDefaultCache());
        easyantIvyInstance.getSettings().setDefaultRepositoryCacheManager(cacheManager);

        EasyantResolutionCacheManager resolutionCacheManager = new EasyantResolutionCacheManager();
        resolutionCacheManager.setBasedir(easyantIvyInstance.getSettings().getDefaultResolutionCacheBasedir());
        resolutionCacheManager.setSettings(easyantIvyInstance.getSettings());
        easyantIvyInstance.getSettings().setResolutionCacheManager(resolutionCacheManager);

        return easyantIvySettings;
    }