I'm writing an Ant plugin to search an Ivy repository and retrieve
into a directory a set of module artifacts/dependencies.  (The leaf
projects implement a provider SPI so there's no direct dependency
between the root module and the leaf modules -- therefore the need to
search the repository for the provided implementations.)

I feel like I'm blind doing this because the api docs are a bit sparse
(no biggie), so I'm posting on this list for some help.  Here's what
I've got.

1)  I create my instance of Ivy and my known OrganisationEntry.
2)  I listModuleEntries for the organisation (which returns non-unique
ModuleEntries, which I'm failing to understand -- I filter out the
duplicates).
3)  I listRevisionEntries for each ModuleEntry (which again returns
non-unique RevisionEntries -- argh).
4)  I get a ModuleDescriptor for each RevisionEntry using
ResolveEngine.findModule().
5)  I get the most recent ModuleDescriptor using
SortEngine.sortModuleDescriptors().

Everything up to this point is fine.  I'm just having problems
retrieving the artifacts/dependencies into a directory.  It's
retrieving the dependencies just fine--just not the actual module
artifacts.

6)  For each "most recent" ModuleDescriptor, I check to make sure it's
one that should be retrieved (implemented using those nifty extra
attributes).
7)  Here's the code I'm actually using to do the retrieve (sorry for
the formatting).

                                        RetrieveOptions retrieveOptions = new 
RetrieveOptions();
                                        
retrieveOptions.setArtifactFilter(NoFilter.INSTANCE);
                                        retrieveOptions.setConfs(new String[] 
{"main"});
                                        
                                        try {
                                                
ivy.getRetrieveEngine().determineArtifactsToCopy(mostRecentModuleRevisionId,
pattern, retrieveOptions);
                                                
ivy.getRetrieveEngine().retrieve(mostRecentModuleRevisionId,
pattern, retrieveOptions);
                                        } catch (IOException e) {
                                                throw new BuildException(e);
                                        } catch (ParseException e) {
                                                throw new BuildException(e);
                                        }

As I said, some of the dependencies of my "main" configuration are
being copied, but others are not.  And there's not a single
publication artifact to be found.  In fact, the
RetrieveEngine.determineArtifactsToCopy() lists all the dependencies
(saying they're NOT_NEEDED), but the publication artifact isn't in the
Map.

Can somebody clue me in on how to do this.  I think I'm missing
something simple here.

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

Reply via email to