Forum Discussion

mttran's avatar
mttran
New Contributor
14 years ago

[Resolved] Loading external dependencies/custom libraries

Hi -

I'm trying to import a custom library into one of the groovy scripts with absolutely no luck. I tried using the m2repo header attribute which pointed to my maven nexus repository but when i tried to load my project the app says my component has an error. I even tried loading my custom library within the lib/ext folder of my JVM and that didn't seem to register.

I noticed that a number of the "dependencies" used in the existing components are located under my ~/.ivy2/cache folder but I don't know how to get my library in there as i'm new to ivy.

Thanks in advance for any help.

6 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    What does the error message say? Are you sure that this is related to the importing of the library, as opposed to some syntax error in the Groovy script? This morning I added this text to the Custom Components documentation:
    Running loadUItest.bat instead of loadUI.bat will give you more (and more useful) error messages when your code for example doesn't parse correctly. Running loadUItest.bat currently requires you to have the JavaFX SDK installed, but we hope to be able to remove this requirement in the future.

    Does this produce a more helpful error message?

    Please get back to us

    /Henrik
    loadUI developer
  • mttran's avatar
    mttran
    New Contributor
    This is the line of code I'm trying to add to the header:
     * @m2repo http://localhost:8080/nexus-webapp-1.7.2/content/groups/public/


    The only message I get is the one provided by the GUI, "Some of the components could not be loaded. Either the component is missing, or they contain errors. They will be removed from the project.

    The moment I take this line out the project loads just fine. Is there some other way to load a custom library?

    Btw, i'm working on a MAC so I can't use the loadUITest.bat. Where to logs typically go to? I haven't seen those anywhere.

    Thanks..
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi! Really sorry about this, but the @dependency header unfortunately does not work very well on Mac currently. We use the Grape API which is included in Groovy to automatically download dependencies from maven repositories, but this part for some reason doesn't work under Mac (and thus, the @m2repo header also does not work). What does work, however, is loading already downloaded libraries. We bundle all the dependencies we use for our own components with the loadUI installer, so those components work fine. You should be able to manually add your library to the grape cache, which should be located in:
    ~/.loadui/.groovy/grapes/
    I think you have to place your library in:
    ~/.loadui/.groovy/grapes/{groupID}/{artifactID}/jars/{artifactID}-{version}.jar


    There should already be some libraries in there, so you should be able to look at the existing directory structure for some hints. Good luck!

    Regards,
    Dain
    eviware.com
  • mttran's avatar
    mttran
    New Contributor
    Thanks for the response Dain. I'll try using this on a windows and also try to load the dependencies manually. I'll let you know how it goes...
  • mttran's avatar
    mttran
    New Contributor
    It worked! I just manually placed the dependency under the grape cache to get it going. Thanks again for the quick help.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Auto fetching of dependencies now works for MacOS in our internal builds. It will be in loadUI 1.5.

    Regards!

    /Henrik
    loadUI team