You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Nuwan Jayawardene <ns...@gmail.com> on 2022/01/30 15:33:36 UTC

Re: Importing new libraries into Synapse

Hi All,

> Hi all,
> I'm having a bit of trouble downloading new libraries by adding them to
> the root pom.xml using the mvn install.
> After a successful build when I tried to import the libraries into the
> classes, they don't seem to be identified.
>


...the .jar files do not get imported.

I was working on a resolution to this and found that adding the dependency
in the respective module-level pom.xml (in this case Synapse core) resulted
in the .jars being downloaded successfully. The relevant commit is linked
here:
https://github.com/n-jay/synapse/commit/684ed55a54be8ef2341f68d583bc2f19171eaa1c
I've removed all the new dependencies that I added to the root pom
previously.

The issue now is that when I try to import the library (existing in the
com/github/... location in .m2) it doesn't seem to be detected.
[image: image.png]

The jar is, however, present.
[image: image.png]

Would appreciate some thoughts on whether this is the proper way to go
about it.
Thanks and regards

On Sun, Oct 17, 2021 at 11:28 PM Nuwan Jayawardene <ns...@gmail.com>
wrote:

> [image: image.gif]Hi Senaka and Andreas,
>
>> Your point "I also noticed that the repositories included in the pom.xml
>> is only the WSO2 public maven repo and Maven central is not included" might
>> have something to do here
>>
> Rebuilt with the inclusion of Maven central, unfortunately didn't work out:
>
> https://github.com/n-jay/synapse/commit/3688230dc367d44bb9b187fa6505be3159f9630d
>
> Do you have a link showing the changes in the root POM?
>>
> The commit with all changes made to the pom is attached herewith:
>
> https://github.com/n-jay/synapse/commit/502ecd0c06f1beb7dbae48f690270f59f390a6ab
>
> Kind regards
>
>
>
>
>
> On Sun, Oct 17, 2021 at 8:54 PM Senaka Fernando <se...@apache.org> wrote:
>
>> Your point "I also noticed that the repositories included in the pom.xml
>> is only the WSO2 public maven repo and Maven central is not included" might
>> have something to do here. It would be best if you can provide a link to
>> the root pom you are using to validate this as well. Mevan Central has the
>> library
>> <https://search.maven.org/artifact/com.github.stefanbirkner/system-lambda/1.2.0/jar>
>> you are after.
>>
>> Thanks,
>> Senaka.
>>
>> On Sun, Oct 17, 2021 at 3:13 PM Andreas Veithen-Knowles <
>> andreas.veithen@gmail.com> wrote:
>>
>>> Do you have a link showing the changes in the root POM?
>>>
>>> Andreas
>>>
>>> On Fri, Oct 8, 2021 at 6:22 AM Nuwan Jayawardene <ns...@gmail.com>
>>> wrote:
>>>
>>>> [image: image.gif]Hi all,
>>>> I'm having a bit of trouble downloading new libraries by adding them to
>>>> the root pom.xml using the mvn install.
>>>> After a successful build when I tried to import the libraries into the
>>>> classes, they don't seem to be identified.
>>>>
>>>> Upon inspection of the .m2 folder it seems that even though the
>>>> libraries do get imported as seen in the screenshot below from the build
>>>> logs,
>>>> [image: image.png]
>>>>
>>>> ...the .jar files do not get imported.
>>>> [image: image.png]
>>>>
>>>> Would appreciate some thoughts on how this can be resolved.
>>>> Kind regards
>>>>
>>>>
>>>> On Tue, Sep 21, 2021 at 8:46 PM Nuwan Jayawardene <ns...@gmail.com>
>>>> wrote:
>>>>
>>>>> [image: image.gif]Hi Isuru,
>>>>> thanks for the clarification.
>>>>>
>>>>> This version of the library might be already in your local m2 repo
>>>>>> (.m2 directory).
>>>>>>
>>>>> Noted.
>>>>> Therefore is it good practice to delete (or rename) the .m2 directory
>>>>> and do a fresh build?
>>>>>
>>>>> If you already have the particular version of the library in your
>>>>>> local m2 repo (.m2 directory) it won't download again until you delete it
>>>>>> from the .m2 directory.
>>>>>>
>>>>> I tried to perform an import for that particular library from within
>>>>> Synapse but it doesn't seem to show up. Hence why I thought that it
>>>>> wouldn't have been downloaded.
>>>>> Further, I couldn't locate the library under the "External Libraries"
>>>>> in the project explorer.
>>>>> [image: image.png]
>>>>> Notably the group ID of the library *com.github... *is missing.
>>>>>
>>>>> In any case, I'll delete the .m2 directory and do a clean install and
>>>>> update this thread.
>>>>>
>>>>> Kind regards
>>>>>
>>>>> On Tue, Sep 21, 2021 at 9:33 AM Isuru Udana <is...@gmail.com> wrote:
>>>>>
>>>>>> Hi Nuwan,
>>>>>>
>>>>>> Please find answers inline below.
>>>>>>
>>>>>> On Tue, Sep 21, 2021 at 12:45 AM Nuwan Jayawardene <ns...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> [image: image.gif]Hi All,
>>>>>>>
>>>>>>>    1. I did some further work on this and tried importing the new
>>>>>>>    version of JUnit (version 5) using the following snippet in the pom.xml;[image:
>>>>>>>    image.png]
>>>>>>>    however, this did not prompt the newly added dependency to be
>>>>>>>    downloaded after a mvn clean install.
>>>>>>>    Would greatly appreciate some thoughts on how to rectify this.
>>>>>>>
>>>>>>> This version of the library might be already in your local m2 repo
>>>>>> (.m2 directory).
>>>>>>
>>>>>>>
>>>>>>>    1. I also noticed that the repositories included in the pom.xml
>>>>>>>    is only the WSO2 public maven repo and Maven central is not included.
>>>>>>>    Is it allowed to include Maven central as well so there's access
>>>>>>>    to a wider no. of external libraries?
>>>>>>>
>>>>>>> Yes. We can get libraries from Maven central.
>>>>>>
>>>>>>
>>>>>>> Kind regards
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Sep 17, 2021 at 1:49 AM Nuwan Jayawardene <ns...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi All,
>>>>>>>> I've a couple of doubts to clarify on importing external libraries
>>>>>>>> into Synapse.
>>>>>>>>
>>>>>>>>    1. Is there a vouching process to see if a particular
>>>>>>>>    library is suitable to be used (other than the license).
>>>>>>>>
>>>>>>>> The license is the most important factor. If you are introducing a
>>>>>> new dependency, please initiate a mail and discuss it with the community
>>>>>> before proceeding.
>>>>>>
>>>>>>>
>>>>>>>>    1. When adding a new dependency after including it in the
>>>>>>>>    pom.xml as follows...
>>>>>>>>    [image: image.png]
>>>>>>>>    is running a mvn clean install or mvn install
>>>>>>>>    -Dmaven.test.skip=true sufficient or do we need to delete the
>>>>>>>>    .m2 directory as well and redownload all the dependencies?
>>>>>>>>
>>>>>>>> If you already have the particular version of the library in your
>>>>>> local m2 repo (.m2 directory) it won't download again until you delete it
>>>>>> from the .m2 directory.
>>>>>>
>>>>>>>
>>>>>>>>    1.
>>>>>>>>    I tried the 2 former commands however it doesn't seem to
>>>>>>>>    have downloaded the library from maven central.
>>>>>>>>
>>>>>>>> Would appreciate your thoughts on this.
>>>>>>>> Regards
>>>>>>>> --
>>>>>>>> *Nuwan Jayawardene*
>>>>>>>> Assistant Lecturer, Informatics Institute of Technology (IIT).
>>>>>>>> Research Assistant, University of Moratuwa
>>>>>>>>
>>>>>>>> https://www.linkedin.com/m/in/nuwanjaya
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> *Nuwan Jayawardene*
>>>>>>> Assistant Lecturer, Informatics Institute of Technology (IIT).
>>>>>>> Research Assistant, University of Moratuwa
>>>>>>>
>>>>>>> https://www.linkedin.com/m/in/nuwanjaya
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Isuru Udana*
>>>>>> Associate Director/Architect
>>>>>>
>>>>>>
>>>>>>
>>>>>> *; WSO2 Inc.; http://wso2.com <http://wso2.com>email:
>>>>>> isudana@gmail.com <is...@gmail.com> *
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> *Nuwan Jayawardene*
>>>>> Assistant Lecturer, Informatics Institute of Technology (IIT).
>>>>> Research Assistant, University of Moratuwa
>>>>>
>>>>> https://www.linkedin.com/m/in/nuwanjaya
>>>>>
>>>>>
>>>>
>>>> --
>>>> *Nuwan Jayawardene*
>>>> Assistant Lecturer, Informatics Institute of Technology (IIT).
>>>> Research Assistant, University of Moratuwa
>>>>
>>>> https://www.linkedin.com/m/in/nuwanjaya
>>>>
>>>>
>
> --
> *Nuwan Jayawardene*
> Assistant Lecturer, Informatics Institute of Technology (IIT).
> Research Assistant, University of Moratuwa
>
> https://www.linkedin.com/m/in/nuwanjaya
>
>
>

-- 
*Nuwan Jayawardene*
Assistant Lecturer, Informatics Institute of Technology (IIT).
Research Assistant, University of Moratuwa

https://www.linkedin.com/m/in/nuwanjaya

Re: Importing new libraries into Synapse

Posted by Andreas Veithen-Knowles <an...@gmail.com>.
Note that the root POM doesn't define any dependencies as such. It only has
a dependencyManagement section that defines the dependency versions to be
used in child modules.

Andreas

On Sun, Jan 30, 2022 at 3:34 PM Nuwan Jayawardene <ns...@gmail.com> wrote:

> Hi All,
>
>> Hi all,
>> I'm having a bit of trouble downloading new libraries by adding them to
>> the root pom.xml using the mvn install.
>> After a successful build when I tried to import the libraries into the
>> classes, they don't seem to be identified.
>>
>
>
> ...the .jar files do not get imported.
>
> I was working on a resolution to this and found that adding the dependency
> in the respective module-level pom.xml (in this case Synapse core) resulted
> in the .jars being downloaded successfully. The relevant commit is linked
> here:
> https://github.com/n-jay/synapse/commit/684ed55a54be8ef2341f68d583bc2f19171eaa1c
> I've removed all the new dependencies that I added to the root pom
> previously.
>
> The issue now is that when I try to import the library (existing in the
> com/github/... location in .m2) it doesn't seem to be detected.
> [image: image.png]
>
> The jar is, however, present.
> [image: image.png]
>
> Would appreciate some thoughts on whether this is the proper way to go
> about it.
> Thanks and regards
>
> On Sun, Oct 17, 2021 at 11:28 PM Nuwan Jayawardene <ns...@gmail.com>
> wrote:
>
>> [image: image.gif]Hi Senaka and Andreas,
>>
>>> Your point "I also noticed that the repositories included in the pom.xml
>>> is only the WSO2 public maven repo and Maven central is not included" might
>>> have something to do here
>>>
>> Rebuilt with the inclusion of Maven central, unfortunately didn't work
>> out:
>>
>> https://github.com/n-jay/synapse/commit/3688230dc367d44bb9b187fa6505be3159f9630d
>>
>> Do you have a link showing the changes in the root POM?
>>>
>> The commit with all changes made to the pom is attached herewith:
>>
>> https://github.com/n-jay/synapse/commit/502ecd0c06f1beb7dbae48f690270f59f390a6ab
>>
>> Kind regards
>>
>>
>>
>>
>>
>> On Sun, Oct 17, 2021 at 8:54 PM Senaka Fernando <se...@apache.org>
>> wrote:
>>
>>> Your point "I also noticed that the repositories included in the pom.xml
>>> is only the WSO2 public maven repo and Maven central is not included" might
>>> have something to do here. It would be best if you can provide a link to
>>> the root pom you are using to validate this as well. Mevan Central has the
>>> library
>>> <https://search.maven.org/artifact/com.github.stefanbirkner/system-lambda/1.2.0/jar>
>>> you are after.
>>>
>>> Thanks,
>>> Senaka.
>>>
>>> On Sun, Oct 17, 2021 at 3:13 PM Andreas Veithen-Knowles <
>>> andreas.veithen@gmail.com> wrote:
>>>
>>>> Do you have a link showing the changes in the root POM?
>>>>
>>>> Andreas
>>>>
>>>> On Fri, Oct 8, 2021 at 6:22 AM Nuwan Jayawardene <ns...@gmail.com>
>>>> wrote:
>>>>
>>>>> [image: image.gif]Hi all,
>>>>> I'm having a bit of trouble downloading new libraries by adding them
>>>>> to the root pom.xml using the mvn install.
>>>>> After a successful build when I tried to import the libraries into the
>>>>> classes, they don't seem to be identified.
>>>>>
>>>>> Upon inspection of the .m2 folder it seems that even though the
>>>>> libraries do get imported as seen in the screenshot below from the build
>>>>> logs,
>>>>> [image: image.png]
>>>>>
>>>>> ...the .jar files do not get imported.
>>>>> [image: image.png]
>>>>>
>>>>> Would appreciate some thoughts on how this can be resolved.
>>>>> Kind regards
>>>>>
>>>>>
>>>>> On Tue, Sep 21, 2021 at 8:46 PM Nuwan Jayawardene <ns...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> [image: image.gif]Hi Isuru,
>>>>>> thanks for the clarification.
>>>>>>
>>>>>> This version of the library might be already in your local m2 repo
>>>>>>> (.m2 directory).
>>>>>>>
>>>>>> Noted.
>>>>>> Therefore is it good practice to delete (or rename) the .m2 directory
>>>>>> and do a fresh build?
>>>>>>
>>>>>> If you already have the particular version of the library in your
>>>>>>> local m2 repo (.m2 directory) it won't download again until you delete it
>>>>>>> from the .m2 directory.
>>>>>>>
>>>>>> I tried to perform an import for that particular library from within
>>>>>> Synapse but it doesn't seem to show up. Hence why I thought that it
>>>>>> wouldn't have been downloaded.
>>>>>> Further, I couldn't locate the library under the "External Libraries"
>>>>>> in the project explorer.
>>>>>> [image: image.png]
>>>>>> Notably the group ID of the library *com.github... *is missing.
>>>>>>
>>>>>> In any case, I'll delete the .m2 directory and do a clean install and
>>>>>> update this thread.
>>>>>>
>>>>>> Kind regards
>>>>>>
>>>>>> On Tue, Sep 21, 2021 at 9:33 AM Isuru Udana <is...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi Nuwan,
>>>>>>>
>>>>>>> Please find answers inline below.
>>>>>>>
>>>>>>> On Tue, Sep 21, 2021 at 12:45 AM Nuwan Jayawardene <
>>>>>>> nsgaj12@gmail.com> wrote:
>>>>>>>
>>>>>>>> [image: image.gif]Hi All,
>>>>>>>>
>>>>>>>>    1. I did some further work on this and tried importing the new
>>>>>>>>    version of JUnit (version 5) using the following snippet in the pom.xml;[image:
>>>>>>>>    image.png]
>>>>>>>>    however, this did not prompt the newly added dependency to be
>>>>>>>>    downloaded after a mvn clean install.
>>>>>>>>    Would greatly appreciate some thoughts on how to rectify this.
>>>>>>>>
>>>>>>>> This version of the library might be already in your local m2 repo
>>>>>>> (.m2 directory).
>>>>>>>
>>>>>>>>
>>>>>>>>    1. I also noticed that the repositories included in the pom.xml
>>>>>>>>    is only the WSO2 public maven repo and Maven central is not included.
>>>>>>>>    Is it allowed to include Maven central as well so there's
>>>>>>>>    access to a wider no. of external libraries?
>>>>>>>>
>>>>>>>> Yes. We can get libraries from Maven central.
>>>>>>>
>>>>>>>
>>>>>>>> Kind regards
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, Sep 17, 2021 at 1:49 AM Nuwan Jayawardene <
>>>>>>>> nsgaj12@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi All,
>>>>>>>>> I've a couple of doubts to clarify on importing external libraries
>>>>>>>>> into Synapse.
>>>>>>>>>
>>>>>>>>>    1. Is there a vouching process to see if a particular
>>>>>>>>>    library is suitable to be used (other than the license).
>>>>>>>>>
>>>>>>>>> The license is the most important factor. If you are introducing a
>>>>>>> new dependency, please initiate a mail and discuss it with the community
>>>>>>> before proceeding.
>>>>>>>
>>>>>>>>
>>>>>>>>>    1. When adding a new dependency after including it in the
>>>>>>>>>    pom.xml as follows...
>>>>>>>>>    [image: image.png]
>>>>>>>>>    is running a mvn clean install or mvn install
>>>>>>>>>    -Dmaven.test.skip=true sufficient or do we need to delete the
>>>>>>>>>    .m2 directory as well and redownload all the dependencies?
>>>>>>>>>
>>>>>>>>> If you already have the particular version of the library in your
>>>>>>> local m2 repo (.m2 directory) it won't download again until you delete it
>>>>>>> from the .m2 directory.
>>>>>>>
>>>>>>>>
>>>>>>>>>    1.
>>>>>>>>>    I tried the 2 former commands however it doesn't seem to
>>>>>>>>>    have downloaded the library from maven central.
>>>>>>>>>
>>>>>>>>> Would appreciate your thoughts on this.
>>>>>>>>> Regards
>>>>>>>>> --
>>>>>>>>> *Nuwan Jayawardene*
>>>>>>>>> Assistant Lecturer, Informatics Institute of Technology (IIT).
>>>>>>>>> Research Assistant, University of Moratuwa
>>>>>>>>>
>>>>>>>>> https://www.linkedin.com/m/in/nuwanjaya
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> *Nuwan Jayawardene*
>>>>>>>> Assistant Lecturer, Informatics Institute of Technology (IIT).
>>>>>>>> Research Assistant, University of Moratuwa
>>>>>>>>
>>>>>>>> https://www.linkedin.com/m/in/nuwanjaya
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> *Isuru Udana*
>>>>>>> Associate Director/Architect
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> *; WSO2 Inc.; http://wso2.com <http://wso2.com>email:
>>>>>>> isudana@gmail.com <is...@gmail.com> *
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Nuwan Jayawardene*
>>>>>> Assistant Lecturer, Informatics Institute of Technology (IIT).
>>>>>> Research Assistant, University of Moratuwa
>>>>>>
>>>>>> https://www.linkedin.com/m/in/nuwanjaya
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> *Nuwan Jayawardene*
>>>>> Assistant Lecturer, Informatics Institute of Technology (IIT).
>>>>> Research Assistant, University of Moratuwa
>>>>>
>>>>> https://www.linkedin.com/m/in/nuwanjaya
>>>>>
>>>>>
>>
>> --
>> *Nuwan Jayawardene*
>> Assistant Lecturer, Informatics Institute of Technology (IIT).
>> Research Assistant, University of Moratuwa
>>
>> https://www.linkedin.com/m/in/nuwanjaya
>>
>>
>>
>
> --
> *Nuwan Jayawardene*
> Assistant Lecturer, Informatics Institute of Technology (IIT).
> Research Assistant, University of Moratuwa
>
> https://www.linkedin.com/m/in/nuwanjaya
>
>