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 Nik <ap...@babel.homelinux.net> on 2009/04/28 08:03:13 UTC
problems publishing local jar
Hi All,
My apologies for another newbie question.
I have a number of external JAR files that my project relies on. These
jars are not in any Ivy repositories that I am aware of - I just
download them.
I'm trying to publish/install them into my local Ivy repository, and I'm
getting errors.
My understanding is that <ivy:deliver> generates the repo metadata for
an artifact. Yet I keep getting errors telling me that Ivy can't find
the metadata in my cache, or in a repository.
The ant file I'm using is here:
<?xml version="1.0" ?>
<project name="master-repo" basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant" >
<property file="/home/ivy/master-repo.properties" />
<ivy:settings id="master-repo" file="/home/ivy/master-repo.xml" />
<target name="downloads"
description="--> install library jars from local dir" >
<ivy:resolve file="/home/ivy/downloads/smslib.xml" />
<ivy:publish resolver="master-repo" organisation="smslib"
module="smslib" revision="3.0.2"
artifactspattern="/home.ivy/downloads/smslib-3.0.2.jar"
pubrevision="3.0.2" forcedeliver="true" />
<!-- <ivy:resolve inline="true" organisation="smslib"
module="smslib" revision="3.0.2" />
<ivy :publish resolver="master-repo" organisation="smslib"
module="smslib" revision="3.0.2"
artifactspattern="/home/ivy/downloads/smslib-3.0.2.jar"
pubrevision="3.0.2" forcedeliver="true" /> -->
</target>
<target name="publish"
description="--> publish artifacts to next level up" >
</target>
</project>
Here is the minimalist ivy.xml file for the module:
<ivy-module version="1.0">
<info organisation="smslib" module="smslib" status="integration">
</info>
<configurations>
<conf name="default" />
</configurations>
<publications>
<artifact name="smslib" type="jar" />
</publications>
<dependencies >
</dependencies>
</ivy-module>
And here is the output I get when I try to install the jar.
[nik@nik ivy]$ ant downloads
Buildfile: build.xml
downloads:
No ivy:settings found for the default reference 'ivy.instance'. A
default instance will be used
no settings file found, using default...
[ivy:resolve] :: Ivy 2.1.0-rc1 - 20090319213629 ::
http://ant.apache.org/ivy/ ::
:: loading settings :: url =
jar:file:/usr/local/apache-ivy/ivy-2.1.0-rc1.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:resolve] :: resolving dependencies ::
smslib#smslib;working@nik.domain.com
[ivy:resolve] confs: [default]
[ivy:resolve] :: resolution report :: resolve 41ms :: artifacts dl 1ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 0 | 0 | 0 | 0 || 0 | 0 |
---------------------------------------------------------------------
:: delivering :: smslib#smslib;3.0.2 :: 3.0.2 :: integration :: Tue Apr
28 15:37:47 EST 2009
BUILD FAILED
/home/ivy/build.xml:26: smslib#smslib;3.0.2:
java.lang.IllegalStateException: ivy file not found in cache for
smslib#smslib;3.0.2: please resolve dependencies before delivering
(/home/nik/.ivy2/cache/resolved-smslib-smslib-3.0.2.xml)
Total time: 0 seconds
================
If I comment out the top ivy:resolve and ivy:publish pair, and uncomment
the bottom two so that I'm using the inline resolve, I get the following:
[nik@nik ivy]$ ant downloads
Buildfile: build.xml
downloads:
No ivy:settings found for the default reference 'ivy.instance'. A
default instance will be used
no settings file found, using default...
[ivy:resolve] :: Ivy 2.1.0-rc1 - 20090319213629 ::
http://ant.apache.org/ivy/ ::
:: loading settings :: url =
jar:file:/usr/local/apache-ivy/ivy-2.1.0-rc1.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:resolve]
[ivy:resolve] :: problems summary ::
[ivy:resolve] :::: WARNINGS
[ivy:resolve] module not found: smslib#smslib;3.0.2
[ivy:resolve] ==== local: tried
[ivy:resolve] /home/nik/.ivy2/local/smslib/smslib/3.0.2/ivys/ivy.xml
[ivy:resolve] -- artifact smslib#smslib;3.0.2!smslib.jar:
[ivy:resolve]
/home/nik/.ivy2/local/smslib/smslib/3.0.2/jars/smslib.jar
[ivy:resolve] ==== shared: tried
[ivy:resolve] /home/nik/.ivy2/shared/smslib/smslib/3.0.2/ivys/ivy.xml
[ivy:resolve] -- artifact smslib#smslib;3.0.2!smslib.jar:
[ivy:resolve]
/home/nik/.ivy2/shared/smslib/smslib/3.0.2/jars/smslib.jar
[ivy:resolve] ==== public: tried
[ivy:resolve]
http://repo1.maven.org/maven2/smslib/smslib/3.0.2/smslib-3.0.2.pom
[ivy:resolve] -- artifact smslib#smslib;3.0.2!smslib.jar:
[ivy:resolve]
http://repo1.maven.org/maven2/smslib/smslib/3.0.2/smslib-3.0.2.jar
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: UNRESOLVED DEPENDENCIES ::
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: smslib#smslib;3.0.2: not found
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve]
[ivy:resolve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
BUILD FAILED
/home/ivy/build.xml:27: impossible to resolve dependencies:
resolve failed - see output for details
Total time: 1 second
Which makes even less sense to me. It seems that it somehow breaks my
configuration of my local repos.
Q: The ivy.xml file I am using is based on that from a local project
which works. What am I doing wrong?
Q: I would actually prefer to use inline resolution, yet trying to do
that seems to break my local configuration. What did I do wrong in there?
All pointers or suggestions welcome!
Cheers!
Nik
Re: problems publishing local jar
Posted by Nik Trevallyn-Jones <ni...@babel.homelinux.net>.
Kirby Files wrote:
> Nik wrote on 04/28/2009 02:03 AM:
>> I have a number of external JAR files that my project relies on. These
>> jars are not in any Ivy repositories that I am aware of - I just
>> download them.
>>
>> I'm trying to publish/install them into my local Ivy repository, and I'm
>> getting errors.
>>
>> My understanding is that <ivy:deliver> generates the repo metadata for
>> an artifact. Yet I keep getting errors telling me that Ivy can't find
>> the metadata in my cache, or in a repository.
>
> I use ivy:install for this purpose, where the from resolver is a local
> filesystem with a simple [artifact]-[revision].[type] pattern, and the
> to resolver is an SFTP or NFS-based resolver:
>
> <ivy:install settingsRef="masergy.settings" organisation="${org}"
> module="${module}" revision="${rev}" type="jar"
> from="${localjar.resolver}" to="${to.resolver}" />
Thanks! That did the trick!
I'm really interested as to why the ivy:publish task fails in this
instance? If anyone can point me to the appropriate reading, I would
really appreciate understanding this better.
Once again, thanks for your great solution.
Cheers!
Nik
Re: problems publishing local jar
Posted by Nik Trevallyn-Jones <ni...@babel.homelinux.net>.
Kirby Files wrote:
> Nik wrote on 04/28/2009 02:03 AM:
>> I have a number of external JAR files that my project relies on. These
>> jars are not in any Ivy repositories that I am aware of - I just
>> download them.
>>
>> I'm trying to publish/install them into my local Ivy repository, and I'm
>> getting errors.
>>
>> My understanding is that <ivy:deliver> generates the repo metadata for
>> an artifact. Yet I keep getting errors telling me that Ivy can't find
>> the metadata in my cache, or in a repository.
>
> I use ivy:install for this purpose, where the from resolver is a local
> filesystem with a simple [artifact]-[revision].[type] pattern, and the
> to resolver is an SFTP or NFS-based resolver:
>
> <ivy:install settingsRef="masergy.settings" organisation="${org}"
> module="${module}" revision="${rev}" type="jar"
> from="${localjar.resolver}" to="${to.resolver}" />
For anyone else following this thread, I've also just discovered the
package resolver. If you are looking for a way to replicate a build
environment reliably without having to ship these downloaded jars
yourself, then the package resolver looks like a nice solution.
I'm currently setting all this up for a CI environment, so installing
previously downloaded jars into the repo as per Kirby's response seems
the most reliable solution for me. :o)
But I am also looking to add an Ivy file to an Open-Source project I
contribute to, and the package resolver looks like the better solution
for that.
Cheers!
Nik
Re: problems publishing local jar
Posted by Kirby Files <kf...@masergy.com>.
Nik wrote on 04/28/2009 02:03 AM:
> I have a number of external JAR files that my project relies on. These
> jars are not in any Ivy repositories that I am aware of - I just
> download them.
>
> I'm trying to publish/install them into my local Ivy repository, and I'm
> getting errors.
>
> My understanding is that <ivy:deliver> generates the repo metadata for
> an artifact. Yet I keep getting errors telling me that Ivy can't find
> the metadata in my cache, or in a repository.
I use ivy:install for this purpose, where the from resolver is a local
filesystem with a simple [artifact]-[revision].[type] pattern, and the
to resolver is an SFTP or NFS-based resolver:
<ivy:install settingsRef="masergy.settings" organisation="${org}"
module="${module}" revision="${rev}" type="jar"
from="${localjar.resolver}" to="${to.resolver}" />
Thanks,
---
Kirby Files
Software Architect
Masergy Communications
kfiles@masergy.com