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 Alan Chaney <al...@writingshow.com> on 2009/03/11 00:52:05 UTC
ivy:resolve appears to ignore 'type'
I have a setup with a chain repository which has a repository for jar
files used to build a set of war files (using a number of different
permutations). I publish the jar files into one element of the chain and
the war files into another. The war files are then made available via a
company-wide repository.
It so happens that one of the war files has the same name as a jar file.
As part of the build process for a JAR I resolve that jar in-line to get
the most recent build number. However, for some reason, the resolver
insists on returning the WAR file build number which happens to be
wildly different from the jar file and not what I want at all.
I tried to set the type="jar" in the retrieve (as below) but it makes no
difference. So then I looked a bit more closely and determined that
maybe I should try a static resolve mode with a limit on the version
number. But that doesn't work either! The resolve fails, and, sure
enough, the next thing that happens is that the buildnumber task uses
'latest.integration'.
Is there a way of getting the buildnumber task to only consider
particular artifacts? Of course, another way (apart from renaming the
jar which would not be very convenient) is to create a different
settings file which specifically points to the jar resolver, I suppose.
Maybe somebody has some other suggestions?
Here's an extract from my build.
<target name="ivy-new-version" depends="configure">
<!-- asks ivy for an available version number -->
<!-- Use an in-line resolve of the jar file to see if its there.
Set haltonfailure 'false' to allow the buildnumber task to happen
when this is the first publish (ever) of this particular jar.
-->
<ivy:resolve
inline="true"
organisation="${ivy.organisation}"
module="${ivy.module}"
transitive="false"
resolveMode="static"
revision="2.0-"
conf="jar"
settingsref="mycompany.settings"
haltonfailure="false"
/>
<!-- get the build number from the resolved file
<ivy:buildnumber
organisation="${ivy.organisation}"
module="${ivy.module}"
defaultBuildNumber="1"
default="1.0.0"
/>
<echo>Current version = ${ivy.revision}</echo>
<echo>New revision ${ivy.new.revision}</echo>
<echo> buildnumber = ${ivy.build.number}</echo>
</target>
Regards
Alan Chaney
Re: ivy:resolve appears to ignore 'type'
Posted by Alan Chaney <al...@writingshow.com>.
Tom Widmer wrote:
> Alan Chaney wrote:
>> I have a setup with a chain repository which has a repository for jar
>> files used to build a set of war files (using a number of different
>> permutations). I publish the jar files into one element of the chain
>> and the war files into another. The war files are then made available
>> via a company-wide repository.
>>
>> It so happens that one of the war files has the same name as a jar file.
>
> Why not rename the module rather than the jar? As far as I can tell,
> the jar and the war are not part of the same module, so why give them
> the same module name? The artifact names need not change in order to
> change the module names.
>
> I hope this helps - I may have missed the issue.
>
No, actually thats what I did in the end. The actual web application was
very small and had a tiny little skeleton library in it which was used
as part of a remote service to "plug in" to a much bigger library in
another dependency and so I was just being lazy in trying to avoid
having two separate projects! It was one of those things where you start
digging a particular hole and its sometimes difficult to realize that
the best thing to do is to start a new one.
It certainly clarified my thoughts about exactly what an ivy "module"
represents. The conclusion I came to was that the ivy module represents
a "deliverable" - and although this deliverable may have more than one
manifestation (class library jar, javadocs, source) they all represents
aspects of the same 'thing'. What I was trying to do was to fool ivy
into handling two different 'thing's within the same module.
Thanks for your comments, they were helpful.
Alan
Re: ivy:resolve appears to ignore 'type'
Posted by Tom Widmer <to...@googlemail.com>.
Alan Chaney wrote:
> I have a setup with a chain repository which has a repository for jar
> files used to build a set of war files (using a number of different
> permutations). I publish the jar files into one element of the chain and
> the war files into another. The war files are then made available via a
> company-wide repository.
>
> It so happens that one of the war files has the same name as a jar file.
You mean that org and module are the modules having completely different
artifacts? That doesn't seem like a good idea. You're meant to have
different module names for different ivy files (obviously ivy files
change over time (revision) and potentially branch, but they are still
the same logical module with the same artifacts).
> As part of the build process for a JAR I resolve that jar in-line to get
> the most recent build number. However, for some reason, the resolver
> insists on returning the WAR file build number which happens to be
> wildly different from the jar file and not what I want at all.
>
> I tried to set the type="jar" in the retrieve (as below) but it makes no
> difference. So then I looked a bit more closely and determined that
> maybe I should try a static resolve mode with a limit on the version
> number. But that doesn't work either! The resolve fails, and, sure
> enough, the next thing that happens is that the buildnumber task uses
> 'latest.integration'.
"2.0-" doesn't match the documentation for version < 2.0 (is that what
you were trying?). I think you need:
"(,2.0["
(see
http://ant.apache.org/ivy/history/latest-release/ivyfile/dependency.html)
> Is there a way of getting the buildnumber task to only consider
> particular artifacts?
All artifacts for a ivy file have the same revision number anyway, so
I'm not sure that would help.
Of course, another way (apart from renaming the
> jar which would not be very convenient) is to create a different
> settings file which specifically points to the jar resolver, I suppose.
Why not rename the module rather than the jar? As far as I can tell, the
jar and the war are not part of the same module, so why give them the
same module name? The artifact names need not change in order to change
the module names.
I hope this helps - I may have missed the issue.
Tom