ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nihal Sinha <nih...@gmail.com>
Subject ivy:install
Date Tue, 06 Mar 2012 14:13:03 GMT
Greetings all,

I have a few changes to propose to ivy:install:


1.)  Allow specification of configuration when downloading artifacts (
https://issues.apache.org/jira/browse/IVY-1313)

By default, ivy:install downloads all (*) configurations of the module(s)
specified.  In my current consulting assignment, my client wishes to create
an enterprise repository and download the absolute minimum number of jars
necessary for a jar to work.  This essentially means including the master
and runtime dependencies while excluding optional dependencies.  I've read
the "Use your own enterprise repository" documentation at
http://ant.apache.org/ivy/history/latest-milestone/bestpractices.html and
want slightly more control than what is offered to build an enterprise
repository.

As such I've attached a patch to IVY-1313 that allows one to specify
configurations on the ivy:install task.  The default behavior is still the
same as before.  I've added a few test cases and all the tests passed on
build.

By the way, this was a good starting point for building an enterprise
repository:
https://svn.apache.org/repos/asf/ant/ivy/core/trunk/src/example/build-a-ivy-repository



2.)  Retrieve source and javadoc artifacts transitively

It appears this is already discussed in a few issues:
https://issues.apache.org/jira/browse/IVY-842
https://issues.apache.org/jira/browse/IVY-1003

The problem seems to be that source dependencies are not configured to
allow for transitive retrieval.  However I simply want to retrieve source
and javadoc artifacts from an m2 repository when using ivy:install so that
I can get all the sources and javadocs in one shot for faster development
with Eclipse/IvyDE.  Therefore I've locally modified the ivy code to
retrieve source and javadoc artifacts by doing the following:

a.)  I've changed InstallEngine to loop through the dependencies resolved
on the initial call to resolveEngine.getDependencies() and check to see if
a "sources"/"javadoc" configuration exists for each dependency resolved.
b.)  If a sources/javadoc dependency does exist, I add it as a dependency
to the apache#ivy-install;1.0 module.
c.)  I call the resolveEngine.getDependencies() a second time and that gets
me sources and javadocs.

This could be implemented more elegantly through an attribute on the
ivy:install task -- let's say we call it "forceRetrieveConf".  The value of
this attribute would simply be a comma-separated list of configuration
names (e.g. "sources,javadoc") that are retrieved for each dependency
initially resolved.  These values would get passed to InstallEngine via
InstallOptions and InstallEngine would retrieve the relevant artifacts.
 This may not be the most elegant solution but it does the job.  Let me
know if I should submit a patch for this and if so on which issue.


Hope this helps someone in a similar situation.

-N

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message