Ok, this is going to be quite the ramble… I hope you understand what I am trying to do, bear with me
I am trying to fiddle around with the different parts of Enonic XP, trying to get to grips with how everything is connected together / learn. As part of this I have been trying to make a js lib in one .jar. I have another separate .jar that contains an app with a controller, from which I want to use the first js lib.
I was hoping that I could require() the lib into my app, much like you do with lib-thymeleaf for rendering content, but I am having some trouble figuring out what path to use for referring to a file in a “different jar” (if this is at all possible).
The app is installed on the site I created. Should libs appear in the install list for a site? Mine doesn’t, but I don’t know if this is intended or not.
Lets say the app has package name
and the lib har package name
First I tried
var testlib = require('/lib/test/testlib.js'); but naturally this made it look for the testlib.js in the app .jar instead of inside the lib jar.
Next I tried:
var testlib = require('no.tine.xp.testlib:/lib/test/test.js');
This gives me a a:
Resource [no.tine.xp.testapp:/lib/no.tine.xp.testlib:/lib/test/testlib.js] was not found (com.enonic.xp.resource.ResourceProblemException)
so I guess that’s not the correct way to do it either.
I read that you can include libs in your app using gradle dependencies over at http://xp.readthedocs.io/en/stable/reference/libraries/index.html but I was hoping to just reference a separately installed package without including it as a specific dependency in the gradle file (since it’s not available on maven etc).
Is it possible to access a lib (that is not necessarily referenced in the deps of build.gradle in the app) or do I have to make the lib available to the app at build time by including it in the the gradle dependencies or something?
If I am barking up the wrong tree, let me know