Java Code Examples for org.apache.ivy.util.Message#deprecated()

The following examples show how to use org.apache.ivy.util.Message#deprecated() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IvyBuildList.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
/**
 * @param skipBuildFilesWithoutIvy boolean
 * @deprecated use {@link #setOnMissingDescriptor(String)} instead.
 */
@Deprecated
public void setSkipbuildwithoutivy(boolean skipBuildFilesWithoutIvy) {
    Message.deprecated("skipbuildwithoutivy is deprecated, use onMissingDescriptor instead.");
    this.onMissingDescriptor = skipBuildFilesWithoutIvy ? OnMissingDescriptor.SKIP
            : OnMissingDescriptor.FAIL;
}
 
Example 2
Source File: Main.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
private static IvySettings initSettings(CommandLine line, Ivy ivy)
        throws java.text.ParseException, IOException, ParseException {
    IvySettings settings = ivy.getSettings();
    settings.addAllVariables(System.getProperties());
    if (line.hasOption("properties")) {
        settings.addAllVariables(new PropertiesFile(new File(line.getOptionValue("properties")),
                "additional properties"));
    }
    if (line.hasOption("m2compatible")) {
        settings.setVariable("ivy.default.configuration.m2compatible", "true");
    }

    configureURLHandler(line.getOptionValue("realm", null), line.getOptionValue("host", null),
        line.getOptionValue("username", null), line.getOptionValue("passwd", null));

    String settingsPath = line.getOptionValue("settings", "");
    if ("".equals(settingsPath)) {
        settingsPath = line.getOptionValue("conf", "");
        if (!"".equals(settingsPath)) {
            Message.deprecated("-conf is deprecated, use -settings instead");
        }
    }
    if ("".equals(settingsPath)) {
        ivy.configureDefault();
    } else {
        File conffile = new File(settingsPath);
        if (!conffile.exists()) {
            error("ivy configuration file not found: " + conffile);
        } else if (conffile.isDirectory()) {
            error("ivy configuration file is not a file: " + conffile);
        }
        ivy.configure(conffile);
    }
    return settings;
}
 
Example 3
Source File: XmlSettingsParser.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
private void cachesStarted(String qName, Map<String, String> attributes) {
    anyConfiguratorStarted(qName);
    defaultLock = attributes.get("lockStrategy");
    defaultCacheManager = attributes.get("default");

    String cache = attributes.get("defaultCacheDir");
    if (cache != null) {
        ivy.setDefaultCache(Checks.checkAbsolute(cache, "defaultCacheDir"));
    }
    String up2d = attributes.get("checkUpToDate");
    if (up2d != null) {
        Message.deprecated("'checkUpToDate' is deprecated, "
                + "use the 'overwriteMode' on the 'ivy:retrieve' task instead (" + settings
                + ")");
        ivy.setCheckUpToDate(Boolean.valueOf(up2d));
    }
    String resolutionDir = attributes.get("resolutionCacheDir");
    if (resolutionDir != null) {
        ivy.setDefaultResolutionCacheBasedir(resolutionDir);
    }
    String useOrigin = attributes.get("useOrigin");
    if (useOrigin != null) {
        ivy.setDefaultUseOrigin(Boolean.valueOf(useOrigin));
    }
    String cacheIvyPattern = attributes.get("ivyPattern");
    if (cacheIvyPattern != null) {
        ivy.setDefaultCacheIvyPattern(cacheIvyPattern);
    }
    String cacheArtPattern = attributes.get("artifactPattern");
    if (cacheArtPattern != null) {
        ivy.setDefaultCacheArtifactPattern(cacheArtPattern);
    }
    String repositoryDir = attributes.get("repositoryCacheDir");
    if (repositoryDir != null) {
        ivy.setDefaultRepositoryCacheBasedir(repositoryDir);
    }
}
 
Example 4
Source File: Ivy14.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public ArtifactDownloadReport download(Artifact artifact, File cache, boolean useOrigin) {
    Message.deprecated("using cache and useOrigin when calling download is not supported anymore");
    return ivy.getResolveEngine().download(artifact, new DownloadOptions());
}
 
Example 5
Source File: IvySettings.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public synchronized void useDeprecatedUseOrigin() {
    Message.deprecated("useOrigin option is deprecated when calling resolve, use useOrigin"
            + " setting on the cache implementation instead");
    setDefaultUseOrigin(true);

}
 
Example 6
Source File: XmlSettingsParser.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
private void settingsStarted(String qName, Map<String, String> attributes) {
    if ("conf".equals(qName) && !deprecatedMessagePrinted) {
        Message.deprecated("'conf' is deprecated, use 'settings' instead (" + settings + ")");
    }
    String cache = attributes.get("defaultCache");
    if (cache != null) {
        Message.deprecated("'defaultCache' is deprecated, "
                + "use 'caches[@defaultCacheDir]' instead (" + settings + ")");
        ivy.setDefaultCache(Checks.checkAbsolute(cache, "defaultCache"));
    }
    String defaultBranch = attributes.get("defaultBranch");
    if (defaultBranch != null) {
        ivy.setDefaultBranch(defaultBranch);
    }
    String defaultResolveMode = attributes.get("defaultResolveMode");
    if (defaultResolveMode != null) {
        ivy.setDefaultResolveMode(defaultResolveMode);
    }
    String validate = attributes.get("validate");
    if (validate != null) {
        ivy.setValidate(Boolean.valueOf(validate));
    }
    String up2d = attributes.get("checkUpToDate");
    if (up2d != null) {
        Message.deprecated("'checkUpToDate' is deprecated, "
                + "use the 'overwriteMode' on the 'ivy:retrieve' task instead (" + settings
                + ")");
        ivy.setCheckUpToDate(Boolean.valueOf(up2d));
    }
    String useRemoteConfig = attributes.get("useRemoteConfig");
    if (useRemoteConfig != null) {
        ivy.setUseRemoteConfig(Boolean.valueOf(useRemoteConfig));
    }
    String cacheIvyPattern = attributes.get("cacheIvyPattern");
    if (cacheIvyPattern != null) {
        Message.deprecated("'cacheIvyPattern' is deprecated, use 'caches[@ivyPattern]' instead"
                + " (" + settings + ")");
        ivy.setDefaultCacheIvyPattern(cacheIvyPattern);
    }
    String cacheArtPattern = attributes.get("cacheArtifactPattern");
    if (cacheArtPattern != null) {
        Message.deprecated("'cacheArtifactPattern' is deprecated, "
                + "use 'caches[@artifactPattern]' instead (" + settings + ")");
        ivy.setDefaultCacheArtifactPattern(cacheArtPattern);
    }

    // we do not set following defaults here since no instances has been registered yet
    defaultResolver = attributes.get("defaultResolver");
    defaultCM = attributes.get("defaultConflictManager");
    defaultLatest = attributes.get("defaultLatestStrategy");
    defaultCircular = attributes.get("circularDependencyStrategy");

    String requestMethod = attributes.get("httpRequestMethod");
    if ("head".equalsIgnoreCase(requestMethod)) {
        URLHandlerRegistry.getHttp().setRequestMethod(TimeoutConstrainedURLHandler.REQUEST_METHOD_HEAD);
    } else if ("get".equalsIgnoreCase(requestMethod)) {
        URLHandlerRegistry.getHttp().setRequestMethod(TimeoutConstrainedURLHandler.REQUEST_METHOD_GET);
    } else if (!isNullOrEmpty(requestMethod)) {
        throw new IllegalArgumentException(
                "Invalid httpRequestMethod specified, must be one of {'HEAD', 'GET'}");
    }
}
 
Example 7
Source File: XmlModuleDescriptorParser.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
        throws SAXException {
    try {
        if (state == State.DESCRIPTION) {
            // make sure we don't interpret any tag while in description tag
            getBuffer().append("<").append(qName);
            for (int i = 0; i < attributes.getLength(); i++) {
                getBuffer().append(" ");
                getBuffer().append(attributes.getQName(i));
                getBuffer().append("=\"");
                getBuffer().append(attributes.getValue(i));
                getBuffer().append("\"");
            }
            getBuffer().append(">");
        } else if ("ivy-module".equals(qName)) {
            ivyModuleStarted(attributes);
        } else if ("info".equals(qName)) {
            infoStarted(attributes);
        } else if (state == State.INFO && "extends".equals(qName)) {
            extendsStarted(attributes);
        } else if (state == State.INFO && "license".equals(qName)) {
            getMd().addLicense(
                new License(settings.substitute(attributes.getValue("name")), settings
                        .substitute(attributes.getValue("url"))));
        } else if (state == State.INFO && "description".equals(qName)) {
            getMd().setHomePage(settings.substitute(attributes.getValue("homepage")));
            state = State.DESCRIPTION;
            buffer = new StringBuilder();
        } else if (state == State.INFO && "ivyauthor".equals(qName)) {
            // nothing to do, we don't store this
        } else if (state == State.INFO && "repository".equals(qName)) {
            // nothing to do, we don't store this
        } else if (state == State.EXTRA_INFO || state == State.INFO
                && isOtherNamespace(qName)) {
            buffer = new StringBuilder();
            state = State.EXTRA_INFO;
            ExtraInfoHolder extraInfo = new ExtraInfoHolder();
            extraInfo.setName(qName);
            for (int i = 0; i < attributes.getLength(); i++) {
                extraInfo.getAttributes().put(attributes.getQName(i),
                    attributes.getValue(i));
            }
            extraInfoStack.push(extraInfo);
        } else if ("configurations".equals(qName)) {
            configurationStarted(attributes);
        } else if ("publications".equals(qName)) {
            publicationsStarted(attributes);
        } else if ("dependencies".equals(qName)) {
            dependenciesStarted(attributes);
        } else if ("conflicts".equals(qName)) {
            if (!descriptorVersion.startsWith("1.")) {
                Message.deprecated("using conflicts section is deprecated: "
                        + "please use hints section instead. Ivy file URL: "
                        + descriptorURL);
            }
            state = State.CONFLICT;
            checkConfigurations();
        } else if ("artifact".equals(qName)) {
            artifactStarted(qName, attributes);
        } else if ("include".equals(qName) && state == State.DEP) {
            addIncludeRule(qName, attributes);
        } else if ("exclude".equals(qName) && state == State.DEP) {
            addExcludeRule(qName, attributes);
        } else if ("exclude".equals(qName) && state == State.DEPS) {
            state = State.EXCLUDE;
            parseRule(qName, attributes);
            getMd().addExcludeRule((ExcludeRule) confAware);
        } else if ("dependency".equals(qName)) {
            dependencyStarted(attributes);
        } else if ("conf".equals(qName)) {
            confStarted(attributes);
        } else if ("mapped".equals(qName)) {
            dd.addDependencyConfiguration(conf,
                settings.substitute(attributes.getValue("name")));
        } else if ("conflict".equals(qName) && state == State.DEPS
                || "manager".equals(qName) && state == State.CONFLICT) {
            managerStarted(attributes, state == State.CONFLICT ? "name" : "manager");
        } else if ("override".equals(qName) && state == State.DEPS) {
            mediationOverrideStarted(attributes);
        } else if ("include".equals(qName) && state == State.CONF) {
            includeConfStarted(attributes);
        } else if (validate && state != State.EXTRA_INFO && state != State.DESCRIPTION) {
            addError("unknown tag " + qName);
        }
    } catch (Exception ex) {
        if (ex instanceof SAXException) {
            throw (SAXException) ex;
        }
        throw new SAXException("Problem occurred while parsing ivy file: "
                + ex.getMessage(), ex);
    }
}
 
Example 8
Source File: BasicResolver.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public void setAllownomd(boolean b) {
    Message.deprecated("allownomd is deprecated, please use descriptor=\""
            + (b ? DESCRIPTOR_OPTIONAL : DESCRIPTOR_REQUIRED) + "\" instead");
    allownomd = b;
}
 
Example 9
Source File: DualResolver.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public void setAllownomd(boolean allownomd) {
    Message.deprecated("allownomd is deprecated, please use descriptor=\""
            + (allownomd ? DESCRIPTOR_OPTIONAL : DESCRIPTOR_REQUIRED) + "\" instead");
    this.allownomd = allownomd;
}