You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by "Hågen P. Hasle" <hp...@knowit.no> on 2010/02/08 13:53:07 UTC

Attach source in Eclipse

Hi!

I have rewritten a rather big project to use Ivy and IvyDE in Eclipse.  
It's working good, but I'm not sure how to attach sourcecode to the 
dependencies in Eclipse. 

We are using a filebased Maven-repo on a network share, and I've built 
this repo from our old (manual) dependencies.  I've seen some 
suggestions as to how you can attach sources in Eclipse, but if I 
understand correctly all of them assume you use an Ivy repo.

This is from the settings-file for the shared repo:
<ivysettings>
    <resolvers>
        <filesystem name="shared" m2compatible="true" local="false">       
            <artifact 
pattern="L:\nsbesb\maven\repository/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" 
/>           
        </filesystem>
    </resolvers>   
</ivysettings>

If I for example have a jar-file called X.jar in the repo, then I have 
tried to add a x-sources.jar.  This seems to be the way it is done in 
Maven, and from the (rather sparse) documentation I've found for IvyDE, 
it seems to be the way it's supposed to be done in Ivy(DE) too. 

I've tried a couple of different approaches (adding a sources-conf, 
adding another artifact to the settings-file for the shared repo, ++), 
but so far without luck.  Can anyone help me?


Regards, Haagen Hasle

Re: Attach source in Eclipse

Posted by "Hågen P. Hasle" <hp...@knowit.no>.
Hi!

Could you explain to me how you do this with 2 separate retrieves?  I'm 
still struggling with the same problem.

I haven't configured IvyDE to retrieve the jars at all, it refers to the 
jars directly in the ivy cache.  But the sources are never copied into 
the cache..


regards, Haagen

John skrev:
> Is it possible to get get jars as "name"-"version".jar and sources as
> "name"-"version"-source.jar within 1 retrieve statement? If yes, how?
> How to do it in 2 separate retrieves is clear to me.
>
> 2010/2/13  <hp...@knowit.no>:
>   
>> Thank you for your answer.
>>
>> I have tried to put the sources in the same directory as the lib in the
>> maven repo, and named them with "name"-"version"-source.jar. That didn't
>> help.
>>
>> What I don't understand is how I can set the type of the artifact in the
>> maven repo? In my ivy.xml files I've always written "compile->default" when
>> I depend on a file in maven. I tried to write "compile->source", but then
>> Ivy told me I had used a nonexisting type.
>>
>> I guess it would have been easier if I had used an Ivy-repo instead of a
>> Maven-repo, but we use Maven in other projects, so I wanted to share the
>>  repo.
>>
>> Regards, Hågen
>>
>> Sendt fra min iPhone
>>
>> Den 13. feb. 2010 kl. 10.36 skrev Nicolas Lalevée
>> <ni...@hibnet.org>:
>>
>>     
>>> Le 10 févr. 2010 à 14:13, Hågen P. Hasle a écrit :
>>>
>>>       
>>>> Can nobody help me with this?  Am I asking the wrong question, or not
>>>> giving enough information?
>>>> Or maybe I'm giving too much information.  All I want is to attach source
>>>> to a library in Eclipse that IvyDE resolves for me from a local filebased
>>>> Maven repository.  I'm sure there must be a way to do this..?
>>>>         
>>> The sources are automatically attached based on the found artifacts of a
>>> module. IvyDE will look for source artifacts which has the type "source" or
>>> "src" or "sources" (configurable in the container configuration panel), and
>>> it will try to make the name match with suffixes: for X.jar it will search
>>> for X.jar, X-src.jar, X-sources.jar, X-source.jar, (also configurable).
>>>
>>> But there is an issue with transitive dependencies of source and javadoc
>>> in the maven integration [1] which might get your case not working.
>>>
>>> Nicolas
>>>
>>> [1] https://issues.apache.org/jira/browse/IVY-1003
>>>
>>>       
>>>> Regards, Haagen
>>>>
>>>> Hågen P. Hasle skrev:
>>>>         
>>>>> Hi!
>>>>>
>>>>> I have rewritten a rather big project to use Ivy and IvyDE in Eclipse.
>>>>>  It's working good, but I'm not sure how to attach sourcecode to the
>>>>> dependencies in Eclipse.
>>>>> We are using a filebased Maven-repo on a network share, and I've built
>>>>> this repo from our old (manual) dependencies.  I've seen some suggestions as
>>>>> to how you can attach sources in Eclipse, but if I understand correctly all
>>>>> of them assume you use an Ivy repo.
>>>>>
>>>>> This is from the settings-file for the shared repo:
>>>>> <ivysettings>
>>>>>  <resolvers>
>>>>>     <filesystem name="shared" m2compatible="true" local="false">
>>>>>          <artifact
>>>>> pattern="L:\nsbesb\maven\repository/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
>>>>> />                  </filesystem>
>>>>>  </resolvers>   </ivysettings>
>>>>>
>>>>> If I for example have a jar-file called X.jar in the repo, then I have
>>>>> tried to add a x-sources.jar.  This seems to be the way it is done in Maven,
>>>>> and from the (rather sparse) documentation I've found for IvyDE, it seems to
>>>>> be the way it's supposed to be done in Ivy(DE) too.
>>>>> I've tried a couple of different approaches (adding a sources-conf,
>>>>> adding another artifact to the settings-file for the shared repo, ++), but
>>>>> so far without luck.  Can anyone help me?
>>>>>
>>>>>
>>>>> Regards, Haagen Hasle
>>>>>           

Re: Attach source in Eclipse

Posted by John <ve...@gmx.net>.
Is it possible to get get jars as "name"-"version".jar and sources as
"name"-"version"-source.jar within 1 retrieve statement? If yes, how?
How to do it in 2 separate retrieves is clear to me.

2010/2/13  <hp...@knowit.no>:
> Thank you for your answer.
>
> I have tried to put the sources in the same directory as the lib in the
> maven repo, and named them with "name"-"version"-source.jar. That didn't
> help.
>
> What I don't understand is how I can set the type of the artifact in the
> maven repo? In my ivy.xml files I've always written "compile->default" when
> I depend on a file in maven. I tried to write "compile->source", but then
> Ivy told me I had used a nonexisting type.
>
> I guess it would have been easier if I had used an Ivy-repo instead of a
> Maven-repo, but we use Maven in other projects, so I wanted to share the
>  repo.
>
> Regards, Hågen
>
> Sendt fra min iPhone
>
> Den 13. feb. 2010 kl. 10.36 skrev Nicolas Lalevée
> <ni...@hibnet.org>:
>
>>
>> Le 10 févr. 2010 à 14:13, Hågen P. Hasle a écrit :
>>
>>>
>>> Can nobody help me with this?  Am I asking the wrong question, or not
>>> giving enough information?
>>> Or maybe I'm giving too much information.  All I want is to attach source
>>> to a library in Eclipse that IvyDE resolves for me from a local filebased
>>> Maven repository.  I'm sure there must be a way to do this..?
>>
>> The sources are automatically attached based on the found artifacts of a
>> module. IvyDE will look for source artifacts which has the type "source" or
>> "src" or "sources" (configurable in the container configuration panel), and
>> it will try to make the name match with suffixes: for X.jar it will search
>> for X.jar, X-src.jar, X-sources.jar, X-source.jar, (also configurable).
>>
>> But there is an issue with transitive dependencies of source and javadoc
>> in the maven integration [1] which might get your case not working.
>>
>> Nicolas
>>
>> [1] https://issues.apache.org/jira/browse/IVY-1003
>>
>>>
>>>
>>> Regards, Haagen
>>>
>>> Hågen P. Hasle skrev:
>>>>
>>>> Hi!
>>>>
>>>> I have rewritten a rather big project to use Ivy and IvyDE in Eclipse.
>>>>  It's working good, but I'm not sure how to attach sourcecode to the
>>>> dependencies in Eclipse.
>>>> We are using a filebased Maven-repo on a network share, and I've built
>>>> this repo from our old (manual) dependencies.  I've seen some suggestions as
>>>> to how you can attach sources in Eclipse, but if I understand correctly all
>>>> of them assume you use an Ivy repo.
>>>>
>>>> This is from the settings-file for the shared repo:
>>>> <ivysettings>
>>>>  <resolvers>
>>>>     <filesystem name="shared" m2compatible="true" local="false">
>>>>          <artifact
>>>> pattern="L:\nsbesb\maven\repository/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
>>>> />                  </filesystem>
>>>>  </resolvers>   </ivysettings>
>>>>
>>>> If I for example have a jar-file called X.jar in the repo, then I have
>>>> tried to add a x-sources.jar.  This seems to be the way it is done in Maven,
>>>> and from the (rather sparse) documentation I've found for IvyDE, it seems to
>>>> be the way it's supposed to be done in Ivy(DE) too.
>>>> I've tried a couple of different approaches (adding a sources-conf,
>>>> adding another artifact to the settings-file for the shared repo, ++), but
>>>> so far without luck.  Can anyone help me?
>>>>
>>>>
>>>> Regards, Haagen Hasle
>>
>

Re: Attach source in Eclipse

Posted by hp...@knowit.no.
Thank you for your answer.

I have tried to put the sources in the same directory as the lib in  
the maven repo, and named them with "name"-"version"-source.jar. That  
didn't help.

What I don't understand is how I can set the type of the artifact in  
the maven repo? In my ivy.xml files I've always written "compile- 
 >default" when I depend on a file in maven. I tried to write "compile- 
 >source", but then Ivy told me I had used a nonexisting type.

I guess it would have been easier if I had used an Ivy-repo instead of  
a Maven-repo, but we use Maven in other projects, so I wanted to share  
the  repo.

Regards, Hågen

Sendt fra min iPhone

Den 13. feb. 2010 kl. 10.36 skrev Nicolas Lalevée <nicolas.lalevee@hibnet.or 
g>:

>
> Le 10 févr. 2010 à 14:13, Hågen P. Hasle a écrit :
>
>>
>> Can nobody help me with this?  Am I asking the wrong question, or  
>> not giving enough information?
>> Or maybe I'm giving too much information.  All I want is to attach  
>> source to a library in Eclipse that IvyDE resolves for me from a  
>> local filebased Maven repository.  I'm sure there must be a way to  
>> do this..?
>
> The sources are automatically attached based on the found artifacts  
> of a module. IvyDE will look for source artifacts which has the type  
> "source" or "src" or "sources" (configurable in the container  
> configuration panel), and it will try to make the name match with  
> suffixes: for X.jar it will search for X.jar, X-src.jar, X- 
> sources.jar, X-source.jar, (also configurable).
>
> But there is an issue with transitive dependencies of source and  
> javadoc in the maven integration [1] which might get your case not  
> working.
>
> Nicolas
>
> [1] https://issues.apache.org/jira/browse/IVY-1003
>
>>
>>
>> Regards, Haagen
>>
>> Hågen P. Hasle skrev:
>>> Hi!
>>>
>>> I have rewritten a rather big project to use Ivy and IvyDE in  
>>> Eclipse.  It's working good, but I'm not sure how to attach  
>>> sourcecode to the dependencies in Eclipse.
>>> We are using a filebased Maven-repo on a network share, and I've  
>>> built this repo from our old (manual) dependencies.  I've seen  
>>> some suggestions as to how you can attach sources in Eclipse, but  
>>> if I understand correctly all of them assume you use an Ivy repo.
>>>
>>> This is from the settings-file for the shared repo:
>>> <ivysettings>
>>>  <resolvers>
>>>      <filesystem name="shared" m2compatible="true"  
>>> local="false">                  <artifact pattern="L:\nsbesb\maven 
>>> \repository/[organisation]/[module]/[revision]/[artifact]- 
>>> [revision].[ext]" />                  </filesystem>
>>>  </resolvers>   </ivysettings>
>>>
>>> If I for example have a jar-file called X.jar in the repo, then I  
>>> have tried to add a x-sources.jar.  This seems to be the way it is  
>>> done in Maven, and from the (rather sparse) documentation I've  
>>> found for IvyDE, it seems to be the way it's supposed to be done  
>>> in Ivy(DE) too.
>>> I've tried a couple of different approaches (adding a sources- 
>>> conf, adding another artifact to the settings-file for the shared  
>>> repo, ++), but so far without luck.  Can anyone help me?
>>>
>>>
>>> Regards, Haagen Hasle
>

Re: Attach source in Eclipse

Posted by Nicolas Lalevée <ni...@hibnet.org>.
Le 10 févr. 2010 à 14:13, Hågen P. Hasle a écrit :

> 
> Can nobody help me with this?  Am I asking the wrong question, or not giving enough information? 
> Or maybe I'm giving too much information.  All I want is to attach source to a library in Eclipse that IvyDE resolves for me from a local filebased Maven repository.  I'm sure there must be a way to do this..?

The sources are automatically attached based on the found artifacts of a module. IvyDE will look for source artifacts which has the type "source" or "src" or "sources" (configurable in the container configuration panel), and it will try to make the name match with suffixes: for X.jar it will search for X.jar, X-src.jar, X-sources.jar, X-source.jar, (also configurable).

But there is an issue with transitive dependencies of source and javadoc in the maven integration [1] which might get your case not working.

Nicolas

[1] https://issues.apache.org/jira/browse/IVY-1003

> 
> 
> Regards, Haagen
> 
> Hågen P. Hasle skrev:
>> Hi!
>> 
>> I have rewritten a rather big project to use Ivy and IvyDE in Eclipse.  It's working good, but I'm not sure how to attach sourcecode to the dependencies in Eclipse.
>> We are using a filebased Maven-repo on a network share, and I've built this repo from our old (manual) dependencies.  I've seen some suggestions as to how you can attach sources in Eclipse, but if I understand correctly all of them assume you use an Ivy repo.
>> 
>> This is from the settings-file for the shared repo:
>> <ivysettings>
>>   <resolvers>
>>       <filesystem name="shared" m2compatible="true" local="false">                  <artifact pattern="L:\nsbesb\maven\repository/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />                  </filesystem>
>>   </resolvers>   </ivysettings>
>> 
>> If I for example have a jar-file called X.jar in the repo, then I have tried to add a x-sources.jar.  This seems to be the way it is done in Maven, and from the (rather sparse) documentation I've found for IvyDE, it seems to be the way it's supposed to be done in Ivy(DE) too.
>> I've tried a couple of different approaches (adding a sources-conf, adding another artifact to the settings-file for the shared repo, ++), but so far without luck.  Can anyone help me?
>> 
>> 
>> Regards, Haagen Hasle


Re: Attach source in Eclipse

Posted by "Hågen P. Hasle" <hp...@knowit.no>.
Can nobody help me with this?  Am I asking the wrong question, or not 
giving enough information? 

Or maybe I'm giving too much information.  All I want is to attach 
source to a library in Eclipse that IvyDE resolves for me from a local 
filebased Maven repository.  I'm sure there must be a way to do this..?


Regards, Haagen

Hågen P. Hasle skrev:
> Hi!
>
> I have rewritten a rather big project to use Ivy and IvyDE in 
> Eclipse.  It's working good, but I'm not sure how to attach sourcecode 
> to the dependencies in Eclipse.
> We are using a filebased Maven-repo on a network share, and I've built 
> this repo from our old (manual) dependencies.  I've seen some 
> suggestions as to how you can attach sources in Eclipse, but if I 
> understand correctly all of them assume you use an Ivy repo.
>
> This is from the settings-file for the shared repo:
> <ivysettings>
>    <resolvers>
>        <filesystem name="shared" m2compatible="true" 
> local="false">                  <artifact 
> pattern="L:\nsbesb\maven\repository/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" 
> />                  </filesystem>
>    </resolvers>   </ivysettings>
>
> If I for example have a jar-file called X.jar in the repo, then I have 
> tried to add a x-sources.jar.  This seems to be the way it is done in 
> Maven, and from the (rather sparse) documentation I've found for 
> IvyDE, it seems to be the way it's supposed to be done in Ivy(DE) too.
> I've tried a couple of different approaches (adding a sources-conf, 
> adding another artifact to the settings-file for the shared repo, ++), 
> but so far without luck.  Can anyone help me?
>
>
> Regards, Haagen Hasle