You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "Nicolas Lalevée (JIRA)" <ji...@apache.org> on 2017/06/01 11:42:04 UTC
[jira] [Resolved] (IVY-1555) Including optional ivysettings of type
'file' doesn't work when file doesn't exist
[ https://issues.apache.org/jira/browse/IVY-1555?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nicolas Lalevée resolved IVY-1555.
----------------------------------
Resolution: Fixed
Assignee: Nicolas Lalevée
Fix Version/s: master
> Including optional ivysettings of type 'file' doesn't work when file doesn't exist
> ----------------------------------------------------------------------------------
>
> Key: IVY-1555
> URL: https://issues.apache.org/jira/browse/IVY-1555
> Project: Ivy
> Issue Type: Bug
> Affects Versions: 2.4.0
> Reporter: Janek Lehr
> Assignee: Nicolas Lalevée
> Priority: Minor
> Fix For: master
>
>
> The 'optional' attribute of the <include> tag in <ivysettings> doesn't work for regular file paths when using the 'file' include type, and the file doesn't exist. It requires using URL format when providing the file path, i.e. 'file:/path/to/settings'.
> Also, 'optional' doesn't do anything when using the 'url' type for include.
> The reason it fails is because [urlFromFileAttribute|https://git-wip-us.apache.org/repos/asf?p=ant-ivy.git;a=blob;f=src/java/org/apache/ivy/core/settings/XmlSettingsParser.java;h=a40cc1ca601ef661b92c1b9ec1ed00fc155bac20;hb=HEAD#l415] is called before checking the 'optional' attribute, which results in a [java.io.FileNotFoundException|https://git-wip-us.apache.org/repos/asf?p=ant-ivy.git;a=blob;f=src/java/org/apache/ivy/core/settings/XmlSettingsParser.java;h=a40cc1ca601ef661b92c1b9ec1ed00fc155bac20;hb=HEAD#l457] when trying to determine the URL path of the file that doesn't exist.
> My current work around is to prepend the file path with 'file:' so that [creating a URL instance|https://git-wip-us.apache.org/repos/asf?p=ant-ivy.git;a=blob;f=src/java/org/apache/ivy/core/settings/XmlSettingsParser.java;h=a40cc1ca601ef661b92c1b9ec1ed00fc155bac20;hb=HEAD#l449] succeeds in urlFromFileAttribute, which returns back to includeStarted where the 'optional' attribute [is checked|https://git-wip-us.apache.org/repos/asf?p=ant-ivy.git;a=blob;f=src/java/org/apache/ivy/core/settings/XmlSettingsParser.java;h=a40cc1ca601ef661b92c1b9ec1ed00fc155bac20;hb=HEAD#l421].
> Here is the exception I'm getting
> {code}
> ==== stderr ====
> java.text.ParseException: failed to load settings from file:/Users/janek.lehr/<removed>/ivysettings.xml: io problem while parsing config file: /path/does/not/exist
> at org.apache.ivy.core.settings.XmlSettingsParser.doParse(XmlSettingsParser.java:165)
> at org.apache.ivy.core.settings.XmlSettingsParser.parse(XmlSettingsParser.java:150)
> at org.apache.ivy.core.settings.IvySettings.load(IvySettings.java:393)
> at org.apache.ivy.Ivy.configure(Ivy.java:417)
> at org.apache.ivy.Main.initSettings(Main.java:452)
> at org.apache.ivy.Main.run(Main.java:247)
> at org.apache.ivy.Main.main(Main.java:219)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at com.martiansoftware.nailgun.NGSession.run(NGSession.java:280)
> Caused by: org.xml.sax.SAXException: io problem while parsing config file: /path/does/not/exist
> java.io.FileNotFoundException: /path/does/not/exist
> at org.apache.ivy.core.settings.XmlSettingsParser.startElement(XmlSettingsParser.java:234)
> at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
> at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
> at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
> at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
> at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
> at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
> at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
> at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
> at javax.xml.parsers.SAXParser.parse(SAXParser.java:274)
> at org.apache.ivy.core.settings.XmlSettingsParser.doParse(XmlSettingsParser.java:160)
> ... 11 more
> Caused by: java.io.FileNotFoundException: /path/does/not/exist
> at org.apache.ivy.core.settings.XmlSettingsParser.urlFromFileAttribute(XmlSettingsParser.java:457)
> at org.apache.ivy.core.settings.XmlSettingsParser.includeStarted(XmlSettingsParser.java:415)
> at org.apache.ivy.core.settings.XmlSettingsParser.startElement(XmlSettingsParser.java:211)
> ... 25 more
> ==== stdout ====
> :: loading settings :: file = /Users/janek.lehr/<removed>/ivysettings.xml
> setting 'ivy.settings.dir' to '/Users/janek.lehr/<removed>'
> setting 'ivy.conf.dir' to '/Users/janek.lehr/<removed>'
> setting 'ivy.settings.file' to '/Users/janek.lehr/<removed>/ivysettings.xml'
> setting 'ivy.conf.file' to '/Users/janek.lehr/<removed>/ivysettings.xml'
> setting 'ivy.settings.url' to 'file:/Users/janek.lehr/<removed>/ivysettings.xml'
> setting 'ivy.conf.url' to 'file:/Users/janek.lehr/<removed>/ivysettings.xml'
> setting 'ivy.settings.dir.url' to 'file:/Users/janek.lehr/<removed>/'
> setting 'ivy.default.ivy.user.dir' to '/Users/janek.lehr/.ivy2'
> setting 'ivy.home' to '/Users/janek.lehr/.ivy2'
> no default ivy user dir defined: set to /Users/janek.lehr/.ivy2
> setting 'ivy.log.modules.in.use' to 'false'
> setting 'ivy.resolver.default.check.modified' to 'false'
> setting 'ivy.default.always.check.exact.revision' to 'false'
> setting 'ivy.retrieve.pattern' to '${ivy.lib.dir}/[artifact]-[revision](-[classifier]).[ext]'
> setting 'ivy.configurations' to '*'
> setting 'ivy.buildlist.ivyfilepath' to 'ivy.xml'
> setting 'ivy.status' to 'integration'
> setting 'ivy.resolve.default.type.filter' to '*'
> setting 'ivy.project.dir' to '${basedir}'
> setting 'ivy.dep.file' to 'ivy.xml'
> 'ivy.settings.file' already set: discarding 'ivysettings.xml'
> setting 'ivy.report.output.pattern' to '[organisation]-[module]-[conf].[ext]'
> setting 'ivy.cache.ttl.default' to '10s'
> setting 'ivy.publish.src.artifacts.pattern' to '${ivy.distrib.dir}/[type]s/[artifact]-[revision](-[classifier]).[ext]'
> setting 'ivy.deliver.ivy.pattern' to '${ivy.distrib.dir}/[type]s/[artifact]-[revision](-[classifier]).[ext]'
> setting 'ivy.build.artifacts.dir' to '${ivy.project.dir}/build/artifacts'
> setting 'ivy.checksums' to 'sha1,md5'
> setting 'ivy.distrib.dir' to '${ivy.project.dir}/distrib'
> setting 'ivy.lib.dir' to '${ivy.project.dir}/lib'
> {code}
> Here is a sanitized version of my ivysettings.xml
> {code}
> $ cat <removed>/ivysettings.xml
> <ivysettings>
> <include file="/path/does/not/exist"
> optional="true" />
> <resolvers>
> <chain returnFirst="true">
> <ibiblio name="ibiblio"
> m2compatible="true" />
> (removed rest of the chain)
> </chain>
> </resolvers>
> </ivysettings>
> {code}
> Changing the include line to
> {code}
> <include file="file:/path/does/not/exist"
> optional="true" />
> {code}
> fixes the problem, but I find it kind of annoying to require a URL format when using the 'file' type.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)