Examples of IvyConfigure


Examples of org.apache.ivy.ant.IvyConfigure

    /**
     *
     */
    private void configureProjectIvyinstance(String projectIvyInstanceName) {
        IvyConfigure projectIvyInstance = new IvyConfigure();
        projectIvyInstance.setSettingsId(projectIvyInstanceName);
        boolean ivysettingsConfigured = false;
        // project ivy settings can be specified by properties
        if (getProject().getProperty(EasyAntMagicNames.PROJECT_IVY_SETTING_FILE) != null) {
            File projectIvyFile = new File(getProject().getProperty(EasyAntMagicNames.PROJECT_IVY_SETTING_FILE));

            if (projectIvyFile.exists()) {
                projectIvyInstance.setFile(projectIvyFile);
                ivysettingsConfigured = true;
            }

        }
        if (getProject().getProperty(EasyAntMagicNames.PROJECT_IVY_SETTING_URL) != null) {
            String url = getProject().getProperty(EasyAntMagicNames.PROJECT_IVY_SETTING_URL);
            try {
                projectIvyInstance.setUrl(url);
                ivysettingsConfigured = true;
            } catch (MalformedURLException malformedUrl) {
                throw new BuildException("Unable to parse project ivysettings from the following url : " + url,
                        malformedUrl);
            }
        }
        // if no property is set check the default user location
        if (null == null) {
            File userProjectIvyFile = new File(getProject().replaceProperties(
                    EasyAntConstants.DEFAULT_USER_PROJECT_IVYSETTINGS));
            if (userProjectIvyFile.exists()) {
                projectIvyInstance.setFile(userProjectIvyFile);
                ivysettingsConfigured = true;
            }
        }
        // set default project ivy settings location accessible through properties,
        // then users can import it if they don't want to use it directly
        String defaultUrl = this.getClass().getResource("/org/apache/easyant/core/default-project-ivysettings.xml")
                .toExternalForm();
        getProject().setNewProperty(EasyAntMagicNames.PROJECT_DEFAULT_IVYSETTINGS, defaultUrl);
        if (!ivysettingsConfigured) {
            File localSettings = new File(buildModule.getParent(), "ivysettings.xml");
            if (localSettings.exists()) {
                getProject().log("loading local project settings file...", Project.MSG_VERBOSE);
                projectIvyInstance.setFile(localSettings);
                getProject()
                        .setNewProperty(EasyAntMagicNames.PROJECT_IVY_SETTING_FILE, localSettings.getAbsolutePath());

            } else {
                getProject().log("no settings file found, using default...", Project.MSG_VERBOSE);
                getProject().setNewProperty(EasyAntMagicNames.PROJECT_IVY_SETTING_URL, defaultUrl.toString());
                try {
                    projectIvyInstance.setUrl(defaultUrl);
                } catch (MalformedURLException e) {
                    throw new BuildException("Unable to parse project ivysettings from the following url : "
                            + defaultUrl, e);
                }
            }
View Full Code Here

Examples of org.apache.ivy.ant.IvyConfigure

     * @param project
     *            project instance
     * @return a configured {@link IvyAntSettings} instance
     */
    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);
        }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.