Programmatically having ivy fetch sources -
We have a custom build tool that relies on IVv functionality to resolve the dependency. The configuration of dependencies is not an ivy.xml file, but a custom configuration for which allows .. well, irrelevant. The key is that we are using Ivy programmically.
Looking at a dependency (group id, artifact id, version), we create a module revision ID:
ModuleRevisionId id = ModuleRevisionId .newInstance (orgName, moduleName , RevisionName);
After a module descriptor. This is, I'm guessing, where I do not agree enough to inform Ivy that I want both the target library jar file as well as the formula. I'm not sure that there is a dependency configuration vs. There is only one 'configuration', when a module creates a descriptor.
DefaultModuleDescriptor md = new DefaultModuleDescriptor (ModuleRevisionId.parse ("org # standalone; work"), "integration", new java.util.Date ()); DefaultDependencyDescriptor mainDep = New DefaultDependencyDescriptor (ID, / * force = * / true); MainDep.addDependencyConfiguration ("Collection", "Compilation"); MainDep.addDependencyConfiguration ("Collection", "Source"); Md.addDependency (mainDep); Md.addConfiguration (new configuration ("compile")); Md.addConfiguration (new configuration ("source"));
Nor do I really understand the above verses. Recovery Options vs. Resolve Options
I would like a drink.
OK, so it took some time, but eventually I wrapped my head around some of it.
// Define 'Our' module default module descriptor MD = new default module descriptor (modularization id. Prs ("org # standalone; working"), / * status = * / "integration", new Java.deet ()); // Add a configuration in our module definition md.addConfiguration (new configuration ("compile")); // Define our module (third party, usually) dependencies on dependencies module DefaultDependencyDescriptor mainDep = New DefaultDependencyDescriptor (MD, dependeeModuleId, / * force = * / true, false, true); MainDep.addDependencyConfiguration ("Collection", "Default"); MainDep.addDependencyConfiguration ("Collection", "Source"); // Define which configuration we want to solve (only in this case 1 is anyway) ResolveOptions resolveOptions = new ResolveOptions (); String [] confs = new string [] {"compile"}; ResolveOptions.setConfs (confs); ResolveOptions.setTransitive (true); // solve the default anyway Option .set download (true); // Resolve the default anyway report report = ivy.resolve (MD, solution options);
This pulls both the default jar as well as the source target. Note that Ivy has an issue where it will not take the transit of the sources, although it will move the 'main' jars, so you only define the sources of immediate dependence here, not the sub-dependence.
Another weakness I am trying to understand, it assumes that the goal dependency has a 'source' configuration, I ask it to get any type of source / source / src type. . It does not seem that one has yet.
Comments
Post a Comment