You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by "Xavier Hanin (JIRA)" <ji...@apache.org> on 2007/10/28 16:29:50 UTC
[jira] Resolved: (IVY-634) ivy:settings and ivy:retrieve with
explicit id causes unwarranted DEPRECATED warning
[ https://issues.apache.org/jira/browse/IVY-634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xavier Hanin resolved IVY-634.
------------------------------
Resolution: Fixed
Fix Version/s: (was: 2.0)
2.0.0-beta-1
I've applied your patch, thanks a lot for your contribution!
> ivy:settings and ivy:retrieve with explicit id causes unwarranted DEPRECATED warning
> ------------------------------------------------------------------------------------
>
> Key: IVY-634
> URL: https://issues.apache.org/jira/browse/IVY-634
> Project: Ivy
> Issue Type: Bug
> Components: Core
> Affects Versions: unspecified
> Environment: trunk revision 588353
> Reporter: Jacob Grydholt Jensen
> Assignee: Xavier Hanin
> Priority: Minor
> Fix For: 2.0.0-beta-1
>
> Attachments: ivy-634-grydholt.patch
>
>
> I use the following build.xml and do an ant resolve. Notice that a retrieve task is run using the id="hubba" defined in the target named ivy-setup.
> {code:xml}
> <project name="hello-ivy" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
> <!-- some variables used -->
> <property name="lib.dir" value="lib" />
> <property name="build.dir" value="build" />
> <property name="src.dir" value="src" />
>
> <target name="ivy-setup" description="--> read settings">
> <ivy:settings id="hubba" file="./ivysettings.xml" />
> </target>
> <!-- =================================
> target: resolve
> ================================= -->
> <target name="resolve" depends="ivy-setup" description="--> retreive dependencies with ivy">
> <ivy:retrieve settingsRef="hubba"/>
> </target>
>
> <!-- =================================
> target: report
> ================================= -->
> <target name="report" depends="resolve" description="--> generates a report of dependencies">
> <ivy:report todir="${build.dir}"/>
> </target>
> <!-- =================================
> target: clean-cache
> ================================= -->
> <target name="clean-cache" description="--> clean the ivy cache">
> <ivy:cleancache />
> </target>
> </project>
> {code}
> The ivysettings.xml file referenced is a copy of the default file:
> {code:xml}
> <ivysettings>
> <settings defaultResolver="default"/>
> <include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>
> <include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>
> <include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>
> <include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>
> <include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml"/>
> </ivysettings>
> {code}
> When I run the ant target I get the following deprecation warning:
> Buildfile: build.xml
> {noformat}
> ivy-setup:
> resolve:
> [ivy:retrieve] :: Ivy 2.0.0-beta1-local-20071025224054 - 20071025224054 :: http://ant.apache.org/ivy/ ::
> [ivy:retrieve] :: loading settings :: file = /home/grydholt/ivy-work/tutorial/ivysettings.xml
> [ivy:retrieve] No ivy:settings found for the default reference 'ivy.instance'. A default instance will be used
> [ivy:retrieve] ivy.conf.file = /home/grydholt/ivy-work/tutorial/ivysettings.xml
> [ivy:retrieve] DEPRECATED: 'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead
> [ivy:retrieve] :: loading settings :: file = /home/grydholt/ivy-work/tutorial/ivysettings.xml
> [ivy:retrieve] :: resolving dependencies :: [ apache | hello-ivy | working@grydholt-development ]
> [ivy:retrieve] confs: [default]
> {noformat}
> I find it strange that the settings file seems to be loaded twice. Anyway, the DEPRECATED-warning is unwarranted. I think the problem stems from the following two pieces of code. First, in IvySettings.java:
> {code:java}
> public void setSettingsVariables(File settingsFile) {
> try {
> setVariable("ivy.settings.dir", new File(settingsFile.getAbsolutePath()).getParent());
> setDeprecatedVariable("ivy.conf.dir", "ivy.settings.dir");
> setVariable("ivy.settings.file", settingsFile.getAbsolutePath());
> setDeprecatedVariable("ivy.conf.file", "ivy.settings.file");
> setVariable("ivy.settings.url", settingsFile.toURL().toExternalForm());
> setDeprecatedVariable("ivy.conf.url", "ivy.settings.url");
> } catch (MalformedURLException e) {
> IllegalArgumentException iae = new IllegalArgumentException(
> "given file cannot be transformed to url: " + settingsFile);
> iae.initCause(e);
> throw iae;
> }
> }
> /**
> * Sets a deprecated variable with the value of the new variable
> *
> * @param deprecatedKey
> * the deprecated variable name
> * @param newKey
> * the new variable name
> */
> private void setDeprecatedVariable(String deprecatedKey, String newKey) {
> setVariable(deprecatedKey, getVariable(newKey));
> }
> {code}
> It looks as though the ivy.conf.file receives the value of the ivy.settings.file. So if ivy.settings.file is non-null, then so will ivy.conf.file be.
> Now, for the second piece of code, from IvyAntSettings.java:
> {code:java}
> private void defineDefaultSettingFile(IvyVariableContainer variableContainer) {
> String settingsFileName = variableContainer.getVariable("ivy.conf.file");
> if (settingsFileName != null) {
> Message.deprecated("'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead");
> } else {
> settingsFileName = variableContainer.getVariable("ivy.settings.file");
> }
> {code}
> We see that if ivy.conf.file is set, we will get a deprecation warning.
> Summing up. If ivy.settings.file is set, then ivy.conf.file will be set. And when ivy.conf.file is set, we get a deprecation error.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.