You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by "Sillence, Martin (GE Oil & Gas)" <Ma...@ge.com> on 2012/12/06 13:53:12 UTC

returnFirst/latest="latest-time" not working

Hi,

I'm trying to use a dual repository, one filesystem local and the other
remote - nexus
The remote repo has our artefacts from continuous build and the
filesystem has from our local build.
What I want to happen is to use the latest version from wherever when we
run our scripts
It would appear that ivy should support this but in practice this isn't
working.

We have a chain resolver:
		<chain name="resolver.snapshot" checkmodified="true"
changingPattern=".*SNAPSHOT" returnFirst="false" latest="latest-time">
			<filesystem name="local.cache"
m2compatible="true" local="false" changingPattern=".*SNAPSHOT"
checkmodified="true">
				<artifact
pattern="${ivy.default.ivy.user.dir}/local/[organisation]/[module]/[type
]s/[artifact]-[revision](-[classifier]).[ext]"/>
			</filesystem>
			<ibiblio name="snapshot" m2compatible="true"
usepoms="false" root="${snapshot.url}"
	
pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[clas
sifier]).[ext]"/>
		</chain>

Where the url resolver is defined as:

		<url name="snapshot" m2compatible="true"
changingPattern=".*SNAPSHOT" checkmodified="true">
			<artifact
pattern="${snapshot.url}/[organisation]/[module]/[revision]/[artifact]-[
revision](-[classifier]).[ext]"/>
		</url>

What actually happens is the first result is returned depending on if we
put the filesystem or ibiblio resolver first, I've tried switching
ibiblio to an ivy url resolver and turning off m2compatible but we still
have the same problem.

Suffer the same problem with the latest build 2.3.0RC2 and the previous
build 2.3.0RC1

Is there an obvious mistake or should I raise a ticket?

Thanks,
M

Re: returnFirst/latest="latest-time" not working

Posted by marcdb <md...@gmail.com>.
Probably the revision numbers in both your repositories are identical ?
When Ivy finds in the first repository a specific revision, I think that it
will
no longer analyse the same revision in your second repository.
This may seem strange, but you should know that Ivy relies very much
on the fact that revisions are unique in your repositories.

I see that you have set the attributes checkmodified="true" and
latest="latest-time".
These settings may however not cover completely what you're trying to
achieve:
* checkmodified=true: compares the lastmodified timestamp of the ivy.xml
with the one in your cache (but probably not with the ones in other
repositories).
* latest="latest-time": uses the timestamp if the ivy.xml file to know what
revision to choose: I never used this myself, but I suppose this means that
a build with rev="1.0" and timestamp 20121210, will be selected above a
build with rev="1.1" and timestamp 20121209. It will however not force Ivy
to search in all repositories for th

My advice would be to use different revision numbers for your local repo and
for the central/remote ones.
For example for the local repo, you could take: X.Y.Z.LOCAL.SNAPSHOT, and
for the remote one you could use X.Y.Z.CENTRAL.SNAPSHOT.
The changingpattern in the definition of the resolver should stay
".*SNAPSHOT" however.
In your environment, I would keep the checkmodified=true attribute, but I
would not use the latest-time strategy.

Regards,
Marc

-- 
View this message in context: http://old.nabble.com/returnFirst-latest%3D%22latest-time%22-not-working-tp34766197p34781177.html
Sent from the ivy-user mailing list archive at Nabble.com.