[
https://issues.jboss.org/browse/SHRINKWRAP-448?page=com.atlassian.jira.pl...
]
Michal Matloka commented on SHRINKWRAP-448:
-------------------------------------------
IRC discussion from Mar 18. Filtered messages only concerning this issue.
{quote}
Mar 18 20:38:28 <jbossbot> new jira [SHRINKWRAP-448] Using asSingleFile only works
if you return a single file [Open (Unresolved) Feature Request, Major, Unassigned]
https://issues.jboss.org/browse/SHRINKWRAP-448
Mar 18 20:40:31 <mmatloka> johnament: I think asSingleFile intends to work as it
works now - if returns more than one file throw exception
Mar 18 20:41:13 <johnament> mmatloka: might be, but i've been told by ALR in the
past that I should use asSingleFile whenever I use asFile()[0] :-)
Mar 18 20:45:13 <mmatloka> johnament: 1. concerning asSingleFile - so when it
resolves more than one file, and order is not specified, how would asSingleFiel work -
return random one really?
Mar 18 20:46:00 <johnament> mmatloka: it's a crap shoot, but would have the same
issue here.
Mar 18 20:47:12 <vineetreynolds> asSingleFile should throw some runtimeexception if
there's more than one file in the resolution result imho
Mar 18 20:47:47 <mmatloka> vineetreynolds: it throws NonUniqueResultException
Mar 18 20:48:18 <johnament> but then it should only be available if you are using
withoutTransitivity.
Mar 18 20:48:19 <vineetreynolds> hmm
Mar 18 20:49:42 <mmatloka> but even with withTransitivity it can return only single
file?
Mar 18 20:49:57 <johnament> mmatloka: no
Mar 18 20:50:07 <johnament> mmatloka: with transitivity you get the file + all its
dependencies.
Mar 18 20:50:16 <johnament> without you should just get the file.
Mar 18 20:50:25 <johnament> at least that's my understanding of maven
Mar 18 20:50:25 <mmatloka> but it can have no dependencies what I mean :P
Mar 18 20:50:39 <johnament> mmatloka: possible, but not likely.
Mar 18 20:50:51 <johnament> if you had no depenendencies, then why use maven?
Mar 18 20:51:27 <mmatloka> you're resolving project which internals you dont
know, and to be sure you use transitivity
Mar 18 20:53:08 <johnament> mmatloka: exactly.
Mar 18 20:53:19 <johnament> so in that case, i'm pretty sure my file is in [0]
Mar 18 20:53:29 <johnament> because its the top of the resolver chain
Mar 18 20:55:48 <mmatloka> 1. so theoretically, If we would assume that shrinkwrap
does not change anywhere order of artifacts, maybe something like getSingleTopXXX would be
more appropriate
Mar 18 20:57:05 <johnament> mmatloka: getFirstFile
Mar 18 20:57:14 <mmatloka> yeah
Mar 18 20:57:19 <johnament> but that's longer than .asFile()[0]
Mar 18 20:57:40 <johnament> plus then you need to reresolve for .asFile()]1]
Mar 18 20:57:44 <johnament> [1]
Mar 18 21:08:24 <mmatloka> johnament: but using current asSingleFile still would be
longer than .asFile()[0]?
Mar 18 21:08:55 <johnament> mmatloka: yes
Mar 18 21:09:05 <johnament> mmatloka: i'm not a fan of asSingleFile
{quote}
Using asSingleFile only works if you return a single file
---------------------------------------------------------
Key: SHRINKWRAP-448
URL:
https://issues.jboss.org/browse/SHRINKWRAP-448
Project: ShrinkWrap
Issue Type: Feature Request
Reporter: John Ament
In this code example
return Maven.resolver().offline().loadPomFromFile("pom.xml")
.resolve(artifact)
.withTransitivity().asFile()[0];
You should be able to replace asFile()[0] with asSingleFile, however it doesn't work
since multiple files are actually returned.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira