ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shacoshe <shay...@gmail.com>
Subject Re: Using IVY programatically
Date Sat, 23 Oct 2010 18:04:49 GMT

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-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message