Re: Using IVY programatically

2010-10-30 Thread shacoshe

who can i tell ivy what artifacts are currently install ,
and how to get dependencies by the new now

can u provide an example please?
-- 
View this message in context: 
http://ant.1045680.n5.nabble.com/Using-IVY-programatically-tp3204508p3243439.html
Sent from the Ant - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-26 Thread shacoshe

why so complicated , is there some examples of this 
-- 
View this message in context: 
http://ant.1045680.n5.nabble.com/Using-IVY-programatically-tp3204508p3237587.html
Sent from the Ant - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-26 Thread Maarten Coene
You could use the Ivy ant tasks as an example.

Maarten




- Original Message 
From: shacoshe shay...@gmail.com
To: dev@ant.apache.org
Sent: Tue, October 26, 2010 8:37:15 PM
Subject: Re: Using IVY programatically


why so complicated , is there some examples of this 
-- 
View this message in context: 
http://ant.1045680.n5.nabble.com/Using-IVY-programatically-tp3204508p3237587.html

Sent from the Ant - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org


  

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-26 Thread shacoshe

ok ,what example where ? :)

task with no xml ?
-- 
View this message in context: 
http://ant.1045680.n5.nabble.com/Using-IVY-programatically-tp3204508p3237836.html
Sent from the Ant - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-26 Thread Maarten Coene
Sorry, I probably don't understand your question, but if you are looking for 
some example code for using Ivy programatically, you could take a look at how 
the Ivy Ant tasks are implemented.
If that was not your question, please forgive me :-)

Maarten




- Original Message 
From: shacoshe shay...@gmail.com
To: dev@ant.apache.org
Sent: Tue, October 26, 2010 11:26:32 PM
Subject: Re: Using IVY programatically


ok ,what example where ? :)

task with no xml ?
-- 
View this message in context: 
http://ant.1045680.n5.nabble.com/Using-IVY-programatically-tp3204508p3237836.html

Sent from the Ant - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org


  

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-26 Thread shacoshe

yes i want to use Ivy programatically
can u direct me to where should i look.

and why cant i do this with the provided example

-- 
View this message in context: 
http://ant.1045680.n5.nabble.com/Using-IVY-programatically-tp3204508p3237848.html
Sent from the Ant - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-25 Thread shacoshe

it was weird that i am passing to 
PomModuleDescriptorParser.getInstance().parseDescriptor  a new IVYSettings 
so i passed the instance i created before , 
cause in the logger i see that ,ivy is trying to use file inside IVY jar 

:: loading settings :: url =
jar:file:/D:/programming/eclipse_projects/ivyTest/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml

here is my exception:
java.lang.IllegalArgumentException: optional part hasn't been closed in
pattern [module]/[revision]/[module]-[revision](-[classifier]
at
org.apache.ivy.core.IvyPatternHelper.substituteTokens(IvyPatternHelper.java:306)
at
org.apache.ivy.core.IvyPatternHelper.substitute(IvyPatternHelper.java:150)
at
org.apache.ivy.core.IvyPatternHelper.substitute(IvyPatternHelper.java:99)
at
org.apache.ivy.core.IvyPatternHelper.substitute(IvyPatternHelper.java:86)
at
org.apache.ivy.core.cache.DefaultRepositoryCacheManager.getArchivePathInCache(DefaultRepositoryCacheManager.java:384)
at
org.apache.ivy.core.cache.DefaultRepositoryCacheManager.getArchiveFileInCache(DefaultRepositoryCacheManager.java:349)
at
org.apache.ivy.core.cache.DefaultRepositoryCacheManager.lockMetadataArtifact(DefaultRepositoryCacheManager.java:1077)
at
org.apache.ivy.core.cache.DefaultRepositoryCacheManager.getSavedArtifactOrigin(DefaultRepositoryCacheManager.java:460)
at
org.apache.ivy.plugins.resolver.BasicResolver.locate(BasicResolver.java:783)




-


also before(using new IvySettings()) the resolve did not throw any exception 
but the retrive did throw same exception


thank you 

-- 
View this message in context: 
http://ant.1045680.n5.nabble.com/Using-IVY-programatically-tp3204508p3235878.html
Sent from the Ant - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-24 Thread Maarten Coene
You should do a resolve first.
The retriece expects that the resolve has been performed and looks for 
information in the cache

Maarten



- Original Message 
From: shacoshe shay...@gmail.com
To: dev@ant.apache.org
Sent: Sat, October 23, 2010 8:04:49 PM
Subject: Re: Using IVY programatically


thank you for your help .

this is what i am trying now 

try{
  File pom = null; // a provided maven pom

  // Create a FileSystemResolver pointing to the local maven repository
//  FileSystemResolver fsResolver = new FileSystemResolver();
//  fsResolver.setName(local-maven-repo);
//  fsResolver.setM2compatible(true);
//  fsResolver.setLocal(true);
//
fsResolver.addArtifactPattern(D:/programming/eclipse_projects/ivyTest/repo/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).jar);

//
fsResolver.addIvyPattern(D:/programming/eclipse_projects/ivyTest/repo/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).pom);

  
  IvySettings settings = new IvySettings();
  IBiblioResolver resolver = new IBiblioResolver();
  resolver.setRoot(http://localhost:8080/archiva;);
  settings.addResolver(resolver);
  settings.setDefaultIvyUserDir(new
File(D:/programming/eclipse_projects/ivyTest/repo/));
  settings.setDefaultCache(new
File(D:/programming/eclipse_projects/ivyTest/repo/cache/));

settings.setDefaultCacheArtifactPattern([module]/[revision]/[module]-[revision](-[classifier]);

  
  Ivy ivy = Ivy.newInstance(settings);
  
  ivy.getLoggerEngine().pushLogger(new
DefaultMessageLogger(Message.MSG_VERBOSE));

  ModuleDescriptor md = 
PomModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(),
new File(src/movies.pom).toURL(), true);
  
  RetrieveOptions retriveOptions = new RetrieveOptions();
  retriveOptions.setUseOrigin(true);
  retriveOptions.setConfs(md.getConfigurationsNames());
  ivy.retrieve(md.getModuleRevisionId(), lib/[conf]/[artifact].[ext],
retriveOptions);
}catch(Exception e){
  e.printStackTrace();
}


but i am getting this exception 


:: loading settings :: url =
jar:file:/D:/programming/eclipse_projects/ivyTest/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml

:: retrieving :: org.jtpc#movies
checkUpToDate=true
confs: [default, master, compile, provided, runtime, test, system, sources,
javadoc, optional]
java.lang.RuntimeException: problem during retrieve of org.jtpc#movies:
java.lang.IllegalStateException: Report file
'D:\programming\eclipse_projects\ivyTest\repo\cache\org.jtpc-movies-default.xml'
does not exist.
at
org.apache.ivy.core.retrieve.RetrieveEngine.retrieve(RetrieveEngine.java:206)
at org.apache.ivy.Ivy.retrieve(Ivy.java:540)
at Test.main(Test.java:66)
Caused by: java.lang.IllegalStateException: Report file
'D:\programming\eclipse_projects\ivyTest\repo\cache\org.jtpc-movies-default.xml'
does not exist.
at
org.apache.ivy.plugins.report.XmlReportParser.parse(XmlReportParser.java:294)
at
org.apache.ivy.core.retrieve.RetrieveEngine.determineArtifactsToCopy(RetrieveEngine.java:288)

at
org.apache.ivy.core.retrieve.RetrieveEngine.retrieve(RetrieveEngine.java:104)
... 2 more


why he is looking for a file that dose not exists 
'D:\programming\eclipse_projects\ivyTest\repo\cache\org.jtpc-movies-default.xml'



thank you 
-- 
View this message in context: 
http://ant.1045680.n5.nabble.com/Using-IVY-programatically-tp3204508p3233660.html

Sent from the Ant - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org


  

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-23 Thread shacoshe

why IVY is so complicated to use problematically , 
and way do you force me to use XML ,
why there is a lake of API for that ,

i can see why nobody helps / can help me 
-- 
View this message in context: 
http://ant.1045680.n5.nabble.com/Using-IVY-programatically-tp3204508p3233346.html
Sent from the Ant - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-23 Thread Nicolas Lalevée

Le 23 oct. 2010 à 13:07, shacoshe a écrit :

 
 why IVY is so complicated to use problematically , 

nice slip-up ;)

 and way do you force me to use XML ,
 why there is a lake of API for that ,
 
 i can see why nobody helps / can help me 

Ivy is mainly designed to be used in Ant tasks, yes. There is a Java API 
though. But I understand it is not trivial to use, there is a lack of 
documentation, I can say in its use in IvyDE.

For your issue, you have to do in java what you would do in the ivysettings.xml.
You want to add a repository. To do so in Java, use 
IvySettings#addResolver(DependencyResolver resolver).
Your archiva repository is probably a maven like repository ? So you will be 
probably interested in instantiating an IBiblioResolver as resolver. Set its 
name, its root. And I think it will work then.

Nicolas


-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-23 Thread shacoshe

thank you for your help .

this is what i am trying now 

try{
  File pom = null; // a provided maven pom

  // Create a FileSystemResolver pointing to the local maven repository
//  FileSystemResolver fsResolver = new FileSystemResolver();
//  fsResolver.setName(local-maven-repo);
//  fsResolver.setM2compatible(true);
//  fsResolver.setLocal(true);
// 
fsResolver.addArtifactPattern(D:/programming/eclipse_projects/ivyTest/repo/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).jar);
// 
fsResolver.addIvyPattern(D:/programming/eclipse_projects/ivyTest/repo/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).pom);
  
  IvySettings settings = new IvySettings();
  IBiblioResolver resolver = new IBiblioResolver();
  resolver.setRoot(http://localhost:8080/archiva;);
  settings.addResolver(resolver);
  settings.setDefaultIvyUserDir(new
File(D:/programming/eclipse_projects/ivyTest/repo/));
  settings.setDefaultCache(new
File(D:/programming/eclipse_projects/ivyTest/repo/cache/));
 
settings.setDefaultCacheArtifactPattern([module]/[revision]/[module]-[revision](-[classifier]);
  
  Ivy ivy = Ivy.newInstance(settings);
  
  ivy.getLoggerEngine().pushLogger(new
DefaultMessageLogger(Message.MSG_VERBOSE));

  ModuleDescriptor md = 
PomModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(),
new File(src/movies.pom).toURL(), true);
  
  RetrieveOptions retriveOptions = new RetrieveOptions();
  retriveOptions.setUseOrigin(true);
  retriveOptions.setConfs(md.getConfigurationsNames());
  ivy.retrieve(md.getModuleRevisionId(), lib/[conf]/[artifact].[ext],
retriveOptions);
}catch(Exception e){
  e.printStackTrace();
}


but i am getting this exception 


:: loading settings :: url =
jar:file:/D:/programming/eclipse_projects/ivyTest/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
:: retrieving :: org.jtpc#movies
checkUpToDate=true
confs: [default, master, compile, provided, runtime, test, system, 
sources,
javadoc, optional]
java.lang.RuntimeException: problem during retrieve of org.jtpc#movies:
java.lang.IllegalStateException: Report file
'D:\programming\eclipse_projects\ivyTest\repo\cache\org.jtpc-movies-default.xml'
does not exist.
at
org.apache.ivy.core.retrieve.RetrieveEngine.retrieve(RetrieveEngine.java:206)
at org.apache.ivy.Ivy.retrieve(Ivy.java:540)
at Test.main(Test.java:66)
Caused by: java.lang.IllegalStateException: Report file
'D:\programming\eclipse_projects\ivyTest\repo\cache\org.jtpc-movies-default.xml'
does not exist.
at
org.apache.ivy.plugins.report.XmlReportParser.parse(XmlReportParser.java:294)
at
org.apache.ivy.core.retrieve.RetrieveEngine.determineArtifactsToCopy(RetrieveEngine.java:288)
at
org.apache.ivy.core.retrieve.RetrieveEngine.retrieve(RetrieveEngine.java:104)
... 2 more


why he is looking for a file that dose not exists 
'D:\programming\eclipse_projects\ivyTest\repo\cache\org.jtpc-movies-default.xml'


thank you 
-- 
View this message in context: 
http://ant.1045680.n5.nabble.com/Using-IVY-programatically-tp3204508p3233660.html
Sent from the Ant - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-21 Thread shacoshe

ok , i made a little test ,
i came to some errors , And i dont know how to define my archiva
repository 
can u help me 

this what i have so far : 

IvySettings settings = new IvySettings();
  
settings.setDefaultIvyUserDir(new
File(D:/programming/eclipse_projects/ivyTest/repo/));

settings.setDefaultCache(new
File(D:/programming/eclipse_projects/ivyTest/repo/cache/));
settings.setDefaultCacheArtifactPattern([module]/[revision]/[module]-[revision](-[classifier]);
  
Ivy ivy = Ivy.newInstance(settings);
  
ivy.getLoggerEngine().pushLogger(new
DefaultMessageLogger(Message.MSG_VERBOSE));

ModuleDescriptor md = 
PomModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(),
new File(src/test.pom).toURL(), true);
  
RetrieveOptions retriveOptions = new RetrieveOptions();
retriveOptions.setUseOrigin(true);
retriveOptions.setConfs(md.getConfigurationsNames());
ivy.retrieve(md.getModuleRevisionId(), lib/[conf]/[artifact].[ext],
retriveOptions);
-- 
View this message in context: 
http://ant.1045680.n5.nabble.com/Using-IVY-programatically-tp3204508p3229246.html
Sent from the Ant - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-19 Thread shacoshe

hey , 
how i can give a POM file (for new plugin) , and ask IVY what dependencies
are required
base on CORE application jars , and on installed plug-in jars 

and when uninstalling a plug-in i want to call again and check dependencies 
are ok .
can u help me please 

thank you
-- 
View this message in context: 
http://ant.1045680.n5.nabble.com/Using-IVY-programatically-tp3204508p3218360.html
Sent from the Ant - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-08 Thread Antoine Levy-Lambert

 Hello Shay,

yes, ivy can be used programmatically. I think nearly all classes have 
public interfaces.


here a snippet of a piece of code written on my project using ivy 2.1.x 
APIs (not sure if there is any change in 2.2.x)


import org.apache.ivy.Ivy;
import org.apache.ivy.Ivy.IvyCallback;
import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;


Ivy ivy = new Ivy();
configureIvy(ivy);
// using the ivycallback system
MyModuleDescriptor myModuleDescriptor = new MyModuleDescriptor();
ModuleDescriptor md = myModuleDescriptor.parse(ivyFile, ivy);

AFAIK the class org.apache.ivy.Ivy has most of the methods that you need.

Hopes this helps,

Antoine

On 10/8/2010 8:09 AM, shay te wrote:

hey all.

i am writing an java application based on plug-ins ,
i wish to use IVY ,to help me with dependencies issue when installing a
plug-in at run time

each plug-in should have some jar's he depends on ,
i need IVY to help me with what jar i can keep and what jar are not
necessary

i am new to IVY ,and i notice only XML configuration tutorial


am i at the right direction?
can IVY help me completing my task?

thank you




-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Using IVY programatically

2010-10-08 Thread Maarten Coene
Shay,

please don't post Ivy questions to ivy-...@incubator.apache.org since that list 
is no longer used.
You should post your Ivy questions to ivy-u...@ant.apache.org instead (or 
dev@ant.apache.org if they are related to Ivy development).

Maarten



- Original Message 
From: Antoine Levy-Lambert anto...@gmx.de
To: Ant Developers List dev@ant.apache.org
Sent: Fri, October 8, 2010 2:33:12 PM
Subject: Re: Using IVY programatically

Hello Shay,

yes, ivy can be used programmatically. I think nearly all classes have public 
interfaces.

here a snippet of a piece of code written on my project using ivy 2.1.x APIs 
(not sure if there is any change in 2.2.x)

import org.apache.ivy.Ivy;
import org.apache.ivy.Ivy.IvyCallback;
import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;


Ivy ivy = new Ivy();
configureIvy(ivy);
// using the ivycallback system
MyModuleDescriptor myModuleDescriptor = new MyModuleDescriptor();
ModuleDescriptor md = myModuleDescriptor.parse(ivyFile, ivy);

AFAIK the class org.apache.ivy.Ivy has most of the methods that you need.

Hopes this helps,

Antoine

On 10/8/2010 8:09 AM, shay te wrote:
 hey all.
 
 i am writing an java application based on plug-ins ,
 i wish to use IVY ,to help me with dependencies issue when installing a
 plug-in at run time
 
 each plug-in should have some jar's he depends on ,
 i need IVY to help me with what jar i can keep and what jar are not
 necessary
 
 i am new to IVY ,and i notice only XML configuration tutorial
 
 
 am i at the right direction?
 can IVY help me completing my task?
 
 thank you
 


-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org


  

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org