ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Piper" <b...@fal.co.nz>
Subject RE: How to get sources for transitive dependencies with IvyDE
Date Tue, 25 Aug 2009 01:02:26 GMT
After debugging IvyDE and Ivy to figure out what was going on, it turns out that the IvyDE
workspace resolver ('Resolve dependencies in workspace' checkbox is ticked) is getting in
the way of transitive source and javadoc artifacts.  When WorkspaceResolver.download gets
a non-project artifact to download (e.g. commons-validator source), it 'skips' it and sets
the download status to DownloadStatus.NO... however the resolver chain is only progressed
in the case of DownloadStatus.FAILED, hence it never gets as far as my other resolvers.  Since
the top level dependencies already have source artifacts by virtue of me explicitly asking
Ivy (not IvyDE) for them, they never get downloaded via the chain that includes the WorkspaceResolver.

Now that I know what the problem is, I see that it's already been reported (http://issues.apache.org/jira/browse/IVYDE-188).

I had actually misunderstood the meaning of 'Resolve dependencies in workspace', and as it
happens I don't need it enabled after all.  Unfortunately that leads me on to the matter of
IvyDE downloading source and javadoc artifacts whether I ask for them or not, but I suspect
I may find an answer to that in another thread, or can simply live with it.  Having said that,
it might be worth having the ivy.xml files generated from Maven POMs support transitive sources/javadoc
inherently (not through the master conf, but a sources conf on the nested dependencies that
have source artifacts... if that can be determined reliably)... then IvyDE might not need
to do any proactive source/javadoc fetching, and would only attach sources that had been asked
for (directly or transitively).

Thanks for the assistance, Nicolas.

-----Original Message-----
From: Nicolas Lalevée [mailto:nicolas.lalevee@hibnet.org] 
Sent: Monday, 24 August 2009 8:56 p.m.
To: ivy-user@ant.apache.org
Subject: Re: How to get sources for transitive dependencies with IvyDE

On Monday 24 August 2009 00:21:04 Ben Piper wrote:
> I have tried blowing away the org.apache.myfaces.tomahawk and
> commons-validator directories in my local cache just to make sure that they
> weren't artifacts of an older version of Ivy, but it still generates the
> following dependency element for commons-validator (or any other dependency
> with source artifacts for that matter):
>
> <dependency org="commons-validator" name="commons-validator" rev="1.3.1"
> force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
>
> The IVY-325 issue seems to suggest that transitive sources resolution is
> not expected to work.  I've also just noticed
> https://issues.apache.org/jira/browse/IVY-1003 (I should've done a JIRA
> search to begin with).  Having said that, it's curious that you get
> transitive resolution, Nicolas.  Through what configuration (in your
> settings file) do you get on-the-fly POM conversion? By not declaring a
> local cache resolver? Also, I wouldn't have expected that you'd get sources
> with 'default->default' as your conf attribute for the tomahawk dependency.

That was my point, you don't need the specify a special configuration to get 
the sources in IvyDE. In commons-validator's ivy.xml you should have:
<artifact name="commons-validator" type="jar" ext="jar" conf="master"/>
<artifact name="commons-validator" type="source" ext="jar" conf="sources" 
m:classifier="sources"/>

This means that effectively a classical resolve process (with ant for 
instance), you won't have the ability to get the sources transitively. But 
IvyDE is smart enought to look into that ivy.xml and to find the matching 
sources to the retrieved arifacts.

The configuration I used to make it work is the default one, ie not specifying 
any ivysettings.xml.

So that is the way it works today. But maybe things should get simpler if the 
pom.xml should be got transformed by Ivy into an ivy.xml which would better 
contain:
<artifact name="commons-validator" type="source" ext="jar" conf="master" 
m:classifier="sources" />

Nicolas

>
> Thanks,
>
> Ben
>
> -----Original Message-----
> From: Nicolas Lalevée [mailto:nicolas.lalevee@hibnet.org]
> Sent: Saturday, 22 August 2009 3:49 a.m.
> To: ivy-user@ant.apache.org
> Subject: Re: How to get sources for transitive dependencies with IvyDE
>
> On Monday 17 August 2009 01:03:43 Ben Piper wrote:
> > This is the relevant subset of my ivy.xml file.
> >
> >     <configurations>
> >       <conf name="core"/>
> >       <conf name="war"/>
> >     </configurations>
> >     <dependencies>
> >       <dependency org="org.apache.myfaces.tomahawk" name="tomahawk"
> > rev="1.1.6" conf="core->default,sources; war->default"> <exclude
> > org="javax.servlet" name="jstl" />
> >       </dependency>
> >     </dependencies>
> >
> > The 'core' config is used for the Eclipse classpath.  This is the
> > relevant subset of the Ivy report for the whole ivy.xml file.  Sensitive
> > (but not relevant) information has been X'ed out.  As I indicated,
> > there's no question that the commons-validator source artifact will be
> > retrieved if the sources conf is specified for it... it just isn't
> > transitively applied as you can see from the report xml.  The ivy.xml for
> > tomahawk is just the default that is generated by Ivy when resolving a
> > module from a Maven 2 repo (repo1.maven.org in this case).
> >
> >                 <module organisation="org.apache.myfaces.tomahawk"
> > name="tomahawk" > <revision name="1.1.6" status="release"
> > pubdate="20070613210225" resolver="external-repo"
> > artresolver="external-repo" homepage="" downloaded="false"
> > searched="false" default="false" conf="default, compile, runtime, master,
> > sources" position="4"> <metadata-artifact status="no" details=""
> > size="7626" time="0" location="C:\Documents and
> > Settings\benp\.ivy2\cache\org.apache.myfaces.tomahawk\tomahawk\ivy-1.1.6.
> >xm l" searched="false" origin-is-local="false"
> > origin-location="http://ifcsbuilder:80
> > 60/artifactory/external-public-repo/org/apache/myfaces/tomahawk/tomahawk/
> >1. 1.6/tomahawk-1.1.6.pom"/> <caller organisation="XXX" name="XXXX"
> > conf="core" rev="1.1.6" rev-constraint-default="1.1.6"
> > rev-constraint-dynamic="1.1.6" callerrev="X.X.X"/> <artifacts>
> >                                         <artifact name="tomahawk"
> > type="source" ext="jar" extra-classifier="sources" status="no" details=""
> > size="2825626" time="0" location="C:\Documents and
> > Settings\benp\.ivy2\cache\org.apache.myfaces.tomahawk\tomahawk\sources\to
> >ma hawk-1.1.6-so urces.jar">
> >                                                 <origin-location
> > is-local="false"
> > location="http://ifcsbuilder:8060/artifactory/external-public-repo/org/ap
> >ac he/myfaces/tomahawk/tomahawk/1.1.6/tomahawk-1.1.6-sources.jar"/>
> > </artifact> <artifact name="tomahawk" type="jar" ext="jar" status="no"
> > details="" size="2941389" time="0" location="C:\Documents and
> > Settings\benp\.ivy2\cache\org.apache.myfaces.tomahawk\tomahawk\jars\tomah
> >aw k-1.1.6.jar"> <origin-location is-local="false"
> > location="http://ifcsbuilder:8060/artifactory/external-public-repo/org/ap
> >ac he/myfaces/tomahawk/tomahawk/1.1.6/tomahawk-1.1.6.jar"/> </artifact>
> > </artifacts>
> >                         </revision>
> >                 </module>
> >
> >                 <module organisation="commons-validator"
> > name="commons-validator" > <revision name="1.3.1" status="release"
> > pubdate="20061202152731" resolver="external-repo"
> > artresolver="external-repo"
> > homepage="http://jakarta.apache.org/commons/${pom.artifactId.substring(8)
> >}/ " downloaded="false" searched="false" default="false" conf="co mpile,
> > master(*), runtime, compile(*), runtime(*), master" position="5">
> > <license name="The Apache Software License, Version 2.0"
> > url="/LICENSE.txt"/> <metadata-artifact status="no" details=""
> > size="3708" time="0"
> > location="C:\Documents and
> > Settings\benp\.ivy2\cache\commons-validator\commons-validator\ivy-1.3.1.x
> >ml " searched="false" origin-is-local="false"
> > origin-location="http://ifcsbuilder:806
> > 0/artifactory/external-public-repo/commons-validator/commons-validator/1.
> >3. 1/commons-validator-1.3.1.pom"/> <caller
> > organisation="org.apache.myfaces.tomahawk" name="tomahawk" conf="default,
> > compile, runtime, master" rev="1.3.1" rev-constraint-default="1.3.1"
> > rev-constraint-dynamic="1.3.1" callerrev="1.1.6"/> <artifacts>
> >                                         <artifact
> > name="commons-validator" type="jar" ext="jar" status="no" details=""
> > size="138956" time="0" location="C:\Documents and
> > Settings\benp\.ivy2\cache\commons-validator\commons-validator\jars\common
> >s- validator-1.3.1.jar"> <origin-location is-local="false"
> > location="http://ifcsbuilder:8060/artifactory/external-public-repo/common
> >s- validator/commons-validator/1.3.1/commons-validator-1.3.1.jar"/>
> > </artifact> </artifacts>
> >                         </revision>
> >                 </module>
> >
> > -----Original Message-----
> > From: Daniel Becheanu [mailto:daniel.becheanu@gmail.com]
> > Sent: Saturday, 15 August 2009 8:19 p.m.
> > To: ivy-user@ant.apache.org
> > Subject: Re: How to get sources for transitive dependencies with IvyDE
> >
> > Can you give provide a library which you are trying to pull and you
> > don't get sources?
> > Also your ivyconf/ivy.xml will be nice.
> >
> >
> > Daniel
> >
> > On Wed, Aug 12, 2009 at 12:46 AM, Ben Piper<benp@fal.co.nz> wrote:
> > > Hi all,
> > >
> > > I'm using these Eclipse plug-in versions:
> > >
> > > Apache Ivy            2.1.0.cr2_20090704004254
> > > Apache IvyDE    2.0.0.final-200907011148-RELEASE
> > >
> > > and I'm wondering if it's possible to get sources for transitive
> > > dependencies without having to declare them explicitly.  It seems that
> > > because ivy.xml files generated from Maven 2 pom.xml's don't include
> > > sources in the list of confs for transitive dependencies, there's no
> > > way I can indirectly ask for them.  Or is there some specific way of
> > > specifying the conf attribute (or some other attribute) for a parent
> > > dependency so that it will force the sources conf on those transitive
> > > dependencies?
> > >
> > > Obviously if I sneakily add a sources->sources(*) entry for a given
> > > transitive dependency to the parent dependency's ivy.xml file in my
> > > local cache, IvyDE will end up retrieving the sources JAR for that
> > > transitive dependency (assume it exists in this case), but that's not a
> > > solution, and I wonder if Ivy shouldn't be doing that (and adding one
> > > for javadoc) by default? Although I suppose it can't guarantee that
> > > source and javadoc artifacts actually exist, which I assume would cause
> > > a resolve error (even though the parent artifact may have a
> > > source/javadoc artifact).  Perhaps I've answered my own question.
> > >
> > > It's not a major issue for me, but I'd like to avoid explicitly
> > > declaring transitive dependencies just to get their source artifacts if
> > > at all possible.
>
> Yep you shouldn't and it should work correctly.
> And I have created a very simple project in Eclipse with only that
> dependency: <dependency org="org.apache.myfaces.tomahawk" name="tomahawk"
> rev="1.1.6" conf="default->default">
>              <exclude org="javax.servlet" name="jstl" />
>         </dependency>
> And I got the sources of every dependency, including the one of
> commons-validator.
>
> The only difference between your config and mine is that I hit directly a
> maven repository, and you are using some ivy files generated from a maven
> repo. In my config, the ivy file generation is done too but on the fly. So
> probably that at the time you generated that ivy files, you used an older
> version that was not capable of declaring the sources or the javadoc,
> before Ivy 2.0-RC1 [1] ?
>
> Nicolas
>
> [1] https://issues.apache.org/jira/browse/IVY-325

Mime
View raw message