Hi Robert and Ruben!
Thank you for the prompt answers!
Maybe it's not 100% clear what I'm trying to do. I'd like to create a very low
bar of entry for our Composum application: there should be a single starter JAR
that contains the whole of Sling and a basic version of our application, that
can be run on any machine with a JDK - and should not even require an internet
connection to download more artefacts, and of course should not require a maven
installation as it is not only meant for developers. Basically similar to what
a Sling Starter version <= 11 would do with added provisioning for our own
application.
Currently I didn't find it easy to use the sling feature launcher or kickstart
that way for two reasons.
1. Even when I supply a feature archive, it seems that the feature launcher
accesses the network (that is, the central maven repo.maven.apache.org!) for
each of the hundreds of artifacts, even if they are contained in the feature
archive. If I start this
java -jar org.apache.sling.feature.launcher.jar -f
org.apache.sling.starter-12-SNAPSHOT-oak_tar_far.far -v
without network access, lots of java.net.UnknownHostException, though these
seem to be ignored. Isn't that a bug of the feature launcher?
2. The framework (felix-framework-6.0.3 or felix-framework-7.0.0 and
dependencies) is not present in the FAR (and it probably shouldn't be there,
right?), so the feature launcher tries to retrieve that from
$HOME/.m2/repository or, failing that, from the central repository. (That
applies to both to the separate call fo the feature launcher, and to the call
of the feature launcher within kickstart-0.0.12.) If the framework cannot be
retrieved, it aborts.
As a workaround, I embedded the felix-framework with the assembly plugin in
repository style in the starter JAR
called the feature launcher from a main class in our application with the
arguments
-f
jar:file:.../composum-launcher-feature-composumstarter-1.2.1-SNAPSHOT-oak_tar-starter.jar!/far/embedded.far
-u
jar:file:.../composum-launcher-feature-composumstarter-1.2.1-SNAPSHOT-oak_tar-starter.jar!/repository/
You could do something like that into the kickstarter.jar, too - at least as an
additional repository URL that would make it independent of the network. (That
wouldn't, solve problem 1, though).
BTW:
Since there is the content-packages extension for features, I'm trying to add
our application to the FAR with a feature like
{
"content-packages:ARTIFACTS|required": [
"com.composum.platform:composum-platform-package:zip:${composum.platform.version}",
"com.composum.pages:composum-pages-package:zip:${composum.pages.version}", ...]
}
That leads to problems, though, since the packages aren't installed in the
proper order and the included bundles are given a start level 1 instead of the
usual 20. Is there something I can do to set the start level and to control the
ordering of the packages? I tried converting them with the
sling-feature-converter-maven-plugin, too, but didn't succeed so far and am
hoping for a simpler solution. :-)
On 4/14/2021, Robert Munteanu wrote:
> Have you tried copying over the felix framework jar to
> $HOME/.m2/repository in the container image, or wherever the feature
> launcher looks for it?
That'd work for our docker images, but not for a single starter JAR containing
everything. I gave the docker command line mostly as an easy way to verify what
happens when you don't have a maven repository and have no internet connection.
> I do however not understand why the feature launcher would copy files
> from the far file into the local .m2 repository
That was a misunderstanding - it doesn't copy anything there, it just tries to
get the artifacts from there and the central repository.
Thank you very much,
Hans-Peter