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 teknokrat <te...@yahoo.com> on 2007/11/26 14:19:48 UTC
How to publish file?
I am writing some code to publish jars using a filesystem resolver for a
plugin. So far I have tried
String path = IvyPatternHelper.substitute("", organisation, module,
revision, "ivy", "ivy", "xml");
File ivyFile = new File(path);
if (!ivyFile.exists()) {
IvyDeliver deliver = new IvyDeliver();
deliver.setModule(module);
deliver.setOrganisation(organisation);
deliver.setRevision(revision);
deliver.execute();
}
This throws NPEs. How can I use the Ivy API to publish a jar file from a
java program? What fields are mandatory and how do i add the
configuration details? There does not appear to be any javadoc link on
the main site.
cheers
Re: How to publish file?
Posted by Xavier Hanin <xa...@gmail.com>.
Just copying the file works fine, Ivy doesn't require any meta information.
Xavier
teknokrat wrote:
>
> Xavier Hanin wrote:
>> If you only have a jar the easiest is to do a mere file copy instead of
>> using Ivy publish. If you have an ivy file, use publish, for the deliver
>> first problem you should use the update = true in the publish options. If
>> you don't see the method with PublishOptions, maybe it's because you
>> don't
>> use Ivy 2; I suggest using the trunk, it will soon be released as a beta
>> and
>> is pretty stable.
>
> I am using ivy 1.4. Are you saying that i can just copy the jar into the
> repository and things will work? Aren't there any config files that need
> creating or something?
>
>
>
>> Xavier
>>
>> On Nov 27, 2007 5:32 PM, teknokrat <te...@yahoo.com> wrote:
>>
>>> teknokrat wrote:
>>>> Xavier Hanin wrote:
>>>>> The deliver task does not publish, it only updates the ivy file for
>>>>> delivery, replacing some metadata information. To publish I suggest
>>>>> having a
>>>>> look at the publish task code, which does something like this:
>>>>> ivy.publish(mrid, artifactspattern, publishResolverName,
>>>>> new PublishOptions()
>>>>> .setPubrevision(getPubrevision())
>>>>> .setCache(CacheManager.getInstance(settings, cache))
>>>>> .setSrcIvyPattern(publishivy ? srcivypattern : null)
>>>>> .setStatus(getStatus())
>>>>> .setPubdate(pubdate)
>>>>> .setExtraArtifacts((Artifact[]) artifacts.toArray(new Artifact[
>>>>> artifacts.size()]))
>>>>> .setValidate(doValidate(settings))
>>>>> .setOverwrite(overwrite)
>>>>> .setUpdate(update)
>>>>> .setConfs(splitConfs(conf)));
>>>>>
>>>>> This should give you a pretty good idea of the options you have to
>>>>> call
>>>>> publish yourself.
>>>>>
>>>> The only Ivy.publish method i found was
>>>>
>>>> publish(ModuleRevisionId, String, File, String, String, String,
>>>> boolean)
>>>>
>>>> But I have no idea what the parameters should be.
>>>>
>>> Ok, now I get some errors telling me I need to deliver the file first.
>>> Here is my situation, I have uploaded the jar file via a servlet to
>>> c:\temp on the repository machine. What is the simplest way for me to
>>> tell ivy to add this to the local repository? The only parameters I am
>>> using are the organisation, module and revision.
>>>
>>>
>>>
>>>
>>>>> Xavier
>>>>>
>>>>> On Nov 26, 2007 2:19 PM, teknokrat
>>>>> <te...@yahoo.com> wrote:
>>>>>
>>>>>> I am writing some code to publish jars using a filesystem resolver
>>>>>> for
>>> a
>>>>>> plugin. So far I have tried
>>>>>>
>>>>>> String path = IvyPatternHelper.substitute("", organisation, module,
>>>>>> revision, "ivy", "ivy", "xml");
>>>>>> File ivyFile = new File(path);
>>>>>> if (!ivyFile.exists()) {
>>>>>> IvyDeliver deliver = new IvyDeliver();
>>>>>> deliver.setModule(module);
>>>>>> deliver.setOrganisation(organisation);
>>>>>> deliver.setRevision(revision);
>>>>>> deliver.execute();
>>>>>> }
>>>>>>
>>>>>> This throws NPEs. How can I use the Ivy API to publish a jar file
>>>>>> from
>>> a
>>>>>> java program? What fields are mandatory and how do i add the
>>>>>> configuration details? There does not appear to be any javadoc link
>>>>>> on
>>>>>> the main site.
>>>>>>
>>>>>> cheers
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>
>
>
--
View this message in context: http://www.nabble.com/How-to-publish-file--tf4875168.html#a13992201
Sent from the ivy-user mailing list archive at Nabble.com.
Re: How to publish file?
Posted by teknokrat <te...@yahoo.com>.
Xavier Hanin wrote:
> If you only have a jar the easiest is to do a mere file copy instead of
> using Ivy publish. If you have an ivy file, use publish, for the deliver
> first problem you should use the update = true in the publish options. If
> you don't see the method with PublishOptions, maybe it's because you don't
> use Ivy 2; I suggest using the trunk, it will soon be released as a beta and
> is pretty stable.
I am using ivy 1.4. Are you saying that i can just copy the jar into the
repository and things will work? Aren't there any config files that need
creating or something?
> Xavier
>
> On Nov 27, 2007 5:32 PM, teknokrat <te...@yahoo.com> wrote:
>
>> teknokrat wrote:
>>> Xavier Hanin wrote:
>>>> The deliver task does not publish, it only updates the ivy file for
>>>> delivery, replacing some metadata information. To publish I suggest
>>>> having a
>>>> look at the publish task code, which does something like this:
>>>> ivy.publish(mrid, artifactspattern, publishResolverName,
>>>> new PublishOptions()
>>>> .setPubrevision(getPubrevision())
>>>> .setCache(CacheManager.getInstance(settings, cache))
>>>> .setSrcIvyPattern(publishivy ? srcivypattern : null)
>>>> .setStatus(getStatus())
>>>> .setPubdate(pubdate)
>>>> .setExtraArtifacts((Artifact[]) artifacts.toArray(new Artifact[
>>>> artifacts.size()]))
>>>> .setValidate(doValidate(settings))
>>>> .setOverwrite(overwrite)
>>>> .setUpdate(update)
>>>> .setConfs(splitConfs(conf)));
>>>>
>>>> This should give you a pretty good idea of the options you have to call
>>>> publish yourself.
>>>>
>>> The only Ivy.publish method i found was
>>>
>>> publish(ModuleRevisionId, String, File, String, String, String, boolean)
>>>
>>> But I have no idea what the parameters should be.
>>>
>> Ok, now I get some errors telling me I need to deliver the file first.
>> Here is my situation, I have uploaded the jar file via a servlet to
>> c:\temp on the repository machine. What is the simplest way for me to
>> tell ivy to add this to the local repository? The only parameters I am
>> using are the organisation, module and revision.
>>
>>
>>
>>
>>>> Xavier
>>>>
>>>> On Nov 26, 2007 2:19 PM, teknokrat
>>>> <te...@yahoo.com> wrote:
>>>>
>>>>> I am writing some code to publish jars using a filesystem resolver for
>> a
>>>>> plugin. So far I have tried
>>>>>
>>>>> String path = IvyPatternHelper.substitute("", organisation, module,
>>>>> revision, "ivy", "ivy", "xml");
>>>>> File ivyFile = new File(path);
>>>>> if (!ivyFile.exists()) {
>>>>> IvyDeliver deliver = new IvyDeliver();
>>>>> deliver.setModule(module);
>>>>> deliver.setOrganisation(organisation);
>>>>> deliver.setRevision(revision);
>>>>> deliver.execute();
>>>>> }
>>>>>
>>>>> This throws NPEs. How can I use the Ivy API to publish a jar file from
>> a
>>>>> java program? What fields are mandatory and how do i add the
>>>>> configuration details? There does not appear to be any javadoc link on
>>>>> the main site.
>>>>>
>>>>> cheers
>>>>>
>>>>>
>>>>
>>>
>>
>
>
Re: How to publish file?
Posted by Xavier Hanin <xa...@gmail.com>.
If you only have a jar the easiest is to do a mere file copy instead of
using Ivy publish. If you have an ivy file, use publish, for the deliver
first problem you should use the update = true in the publish options. If
you don't see the method with PublishOptions, maybe it's because you don't
use Ivy 2; I suggest using the trunk, it will soon be released as a beta and
is pretty stable.
Xavier
On Nov 27, 2007 5:32 PM, teknokrat <te...@yahoo.com> wrote:
> teknokrat wrote:
> > Xavier Hanin wrote:
> >> The deliver task does not publish, it only updates the ivy file for
> >> delivery, replacing some metadata information. To publish I suggest
> >> having a
> >> look at the publish task code, which does something like this:
> >> ivy.publish(mrid, artifactspattern, publishResolverName,
> >> new PublishOptions()
> >> .setPubrevision(getPubrevision())
> >> .setCache(CacheManager.getInstance(settings, cache))
> >> .setSrcIvyPattern(publishivy ? srcivypattern : null)
> >> .setStatus(getStatus())
> >> .setPubdate(pubdate)
> >> .setExtraArtifacts((Artifact[]) artifacts.toArray(new Artifact[
> >> artifacts.size()]))
> >> .setValidate(doValidate(settings))
> >> .setOverwrite(overwrite)
> >> .setUpdate(update)
> >> .setConfs(splitConfs(conf)));
> >>
> >> This should give you a pretty good idea of the options you have to call
> >> publish yourself.
> >>
> >
> > The only Ivy.publish method i found was
> >
> > publish(ModuleRevisionId, String, File, String, String, String, boolean)
> >
> > But I have no idea what the parameters should be.
> >
>
> Ok, now I get some errors telling me I need to deliver the file first.
> Here is my situation, I have uploaded the jar file via a servlet to
> c:\temp on the repository machine. What is the simplest way for me to
> tell ivy to add this to the local repository? The only parameters I am
> using are the organisation, module and revision.
>
>
>
>
> >> Xavier
> >>
> >> On Nov 26, 2007 2:19 PM, teknokrat
> >> <te...@yahoo.com> wrote:
> >>
> >>> I am writing some code to publish jars using a filesystem resolver for
> a
> >>> plugin. So far I have tried
> >>>
> >>> String path = IvyPatternHelper.substitute("", organisation, module,
> >>> revision, "ivy", "ivy", "xml");
> >>> File ivyFile = new File(path);
> >>> if (!ivyFile.exists()) {
> >>> IvyDeliver deliver = new IvyDeliver();
> >>> deliver.setModule(module);
> >>> deliver.setOrganisation(organisation);
> >>> deliver.setRevision(revision);
> >>> deliver.execute();
> >>> }
> >>>
> >>> This throws NPEs. How can I use the Ivy API to publish a jar file from
> a
> >>> java program? What fields are mandatory and how do i add the
> >>> configuration details? There does not appear to be any javadoc link on
> >>> the main site.
> >>>
> >>> cheers
> >>>
> >>>
> >>
> >>
> >
> >
>
>
--
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/
Re: How to publish file?
Posted by teknokrat <te...@yahoo.com>.
teknokrat wrote:
> Xavier Hanin wrote:
>> The deliver task does not publish, it only updates the ivy file for
>> delivery, replacing some metadata information. To publish I suggest
>> having a
>> look at the publish task code, which does something like this:
>> ivy.publish(mrid, artifactspattern, publishResolverName,
>> new PublishOptions()
>> .setPubrevision(getPubrevision())
>> .setCache(CacheManager.getInstance(settings, cache))
>> .setSrcIvyPattern(publishivy ? srcivypattern : null)
>> .setStatus(getStatus())
>> .setPubdate(pubdate)
>> .setExtraArtifacts((Artifact[]) artifacts.toArray(new Artifact[
>> artifacts.size()]))
>> .setValidate(doValidate(settings))
>> .setOverwrite(overwrite)
>> .setUpdate(update)
>> .setConfs(splitConfs(conf)));
>>
>> This should give you a pretty good idea of the options you have to call
>> publish yourself.
>>
>
> The only Ivy.publish method i found was
>
> publish(ModuleRevisionId, String, File, String, String, String, boolean)
>
> But I have no idea what the parameters should be.
>
Ok, now I get some errors telling me I need to deliver the file first.
Here is my situation, I have uploaded the jar file via a servlet to
c:\temp on the repository machine. What is the simplest way for me to
tell ivy to add this to the local repository? The only parameters I am
using are the organisation, module and revision.
>> Xavier
>>
>> On Nov 26, 2007 2:19 PM, teknokrat
>> <te...@yahoo.com> wrote:
>>
>>> I am writing some code to publish jars using a filesystem resolver for a
>>> plugin. So far I have tried
>>>
>>> String path = IvyPatternHelper.substitute("", organisation, module,
>>> revision, "ivy", "ivy", "xml");
>>> File ivyFile = new File(path);
>>> if (!ivyFile.exists()) {
>>> IvyDeliver deliver = new IvyDeliver();
>>> deliver.setModule(module);
>>> deliver.setOrganisation(organisation);
>>> deliver.setRevision(revision);
>>> deliver.execute();
>>> }
>>>
>>> This throws NPEs. How can I use the Ivy API to publish a jar file from a
>>> java program? What fields are mandatory and how do i add the
>>> configuration details? There does not appear to be any javadoc link on
>>> the main site.
>>>
>>> cheers
>>>
>>>
>>
>>
>
>
Re: How to publish file?
Posted by teknokrat <te...@yahoo.com>.
Xavier Hanin wrote:
> The deliver task does not publish, it only updates the ivy file for
> delivery, replacing some metadata information. To publish I suggest having a
> look at the publish task code, which does something like this:
> ivy.publish(mrid, artifactspattern, publishResolverName,
> new PublishOptions()
> .setPubrevision(getPubrevision())
> .setCache(CacheManager.getInstance(settings, cache))
> .setSrcIvyPattern(publishivy ? srcivypattern : null)
> .setStatus(getStatus())
> .setPubdate(pubdate)
> .setExtraArtifacts((Artifact[]) artifacts.toArray(new Artifact[
> artifacts.size()]))
> .setValidate(doValidate(settings))
> .setOverwrite(overwrite)
> .setUpdate(update)
> .setConfs(splitConfs(conf)));
>
> This should give you a pretty good idea of the options you have to call
> publish yourself.
>
The only Ivy.publish method i found was
publish(ModuleRevisionId, String, File, String, String, String, boolean)
But I have no idea what the parameters should be.
> Xavier
>
> On Nov 26, 2007 2:19 PM, teknokrat <te...@yahoo.com> wrote:
>
>> I am writing some code to publish jars using a filesystem resolver for a
>> plugin. So far I have tried
>>
>> String path = IvyPatternHelper.substitute("", organisation, module,
>> revision, "ivy", "ivy", "xml");
>> File ivyFile = new File(path);
>> if (!ivyFile.exists()) {
>> IvyDeliver deliver = new IvyDeliver();
>> deliver.setModule(module);
>> deliver.setOrganisation(organisation);
>> deliver.setRevision(revision);
>> deliver.execute();
>> }
>>
>> This throws NPEs. How can I use the Ivy API to publish a jar file from a
>> java program? What fields are mandatory and how do i add the
>> configuration details? There does not appear to be any javadoc link on
>> the main site.
>>
>> cheers
>>
>>
>
>
Re: How to publish file?
Posted by Xavier Hanin <xa...@gmail.com>.
The deliver task does not publish, it only updates the ivy file for
delivery, replacing some metadata information. To publish I suggest having a
look at the publish task code, which does something like this:
ivy.publish(mrid, artifactspattern, publishResolverName,
new PublishOptions()
.setPubrevision(getPubrevision())
.setCache(CacheManager.getInstance(settings, cache))
.setSrcIvyPattern(publishivy ? srcivypattern : null)
.setStatus(getStatus())
.setPubdate(pubdate)
.setExtraArtifacts((Artifact[]) artifacts.toArray(new Artifact[
artifacts.size()]))
.setValidate(doValidate(settings))
.setOverwrite(overwrite)
.setUpdate(update)
.setConfs(splitConfs(conf)));
This should give you a pretty good idea of the options you have to call
publish yourself.
Xavier
On Nov 26, 2007 2:19 PM, teknokrat <te...@yahoo.com> wrote:
> I am writing some code to publish jars using a filesystem resolver for a
> plugin. So far I have tried
>
> String path = IvyPatternHelper.substitute("", organisation, module,
> revision, "ivy", "ivy", "xml");
> File ivyFile = new File(path);
> if (!ivyFile.exists()) {
> IvyDeliver deliver = new IvyDeliver();
> deliver.setModule(module);
> deliver.setOrganisation(organisation);
> deliver.setRevision(revision);
> deliver.execute();
> }
>
> This throws NPEs. How can I use the Ivy API to publish a jar file from a
> java program? What fields are mandatory and how do i add the
> configuration details? There does not appear to be any javadoc link on
> the main site.
>
> cheers
>
>
--
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/