Problems adding a default repository

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems adding a default repository

Steinar Bang
I'm working on my karaf debian package:
 https://github.com/steinarb/karaf-debian

I'm trying to replace the following dependency in the system default
repository with a dependency installed from a debian package:
 mvn\:org.fusesource.jansi/jansi/1.16 = 8

To accomplish this I tried adding /usr/share/maven-repo where debian
java packages install their jar files in a maven repository structure,
to the defaultRepositories list, like this:

org.ops4j.pax.url.mvn.defaultRepositories=\
    file:${karaf.home}/${karaf.default.repository}@id=system.repository@snapshots, \
    file:/usr/share/maven-repo@id=debian.repository, \
    file:${karaf.data}/kar@id=kar.repository@multi@snapshots, \
    file:${karaf.base}/${karaf.default.repository}@id=child.system.repository@snapshots

But this didn't work.

Is there something wrong with the syntax of the file URL?
Wouldn't it work to add this repository here?

Thanks!


- Steinar


Reply | Threaded
Open this post in threaded view
|

Re: Problems adding a default repository

jbonofre
Hi Steinar,

It seems you are chaging the etc/startup.properties.

Pax URL is not used here as it's started by the etc/startup.properties (so
startup.properties is read before Pax URL).

The Karaf main bootstrap looks into the system folder for the artifact (it's
done in the installAndStartBundles() of Karaf Main). So you have to replace in
the system folder (or use a link here).

Regards
JB

On 01/30/2018 11:52 PM, Steinar Bang wrote:

> I'm working on my karaf debian package:
>  https://github.com/steinarb/karaf-debian
>
> I'm trying to replace the following dependency in the system default
> repository with a dependency installed from a debian package:
>  mvn\:org.fusesource.jansi/jansi/1.16 = 8
>
> To accomplish this I tried adding /usr/share/maven-repo where debian
> java packages install their jar files in a maven repository structure,
> to the defaultRepositories list, like this:
>
> org.ops4j.pax.url.mvn.defaultRepositories=\
>     file:${karaf.home}/${karaf.default.repository}@id=system.repository@snapshots, \
>     file:/usr/share/maven-repo@id=debian.repository, \
>     file:${karaf.data}/kar@id=kar.repository@multi@snapshots, \
>     file:${karaf.base}/${karaf.default.repository}@id=child.system.repository@snapshots
>
> But this didn't work.
>
> Is there something wrong with the syntax of the file URL?
> Wouldn't it work to add this repository here?
>
> Thanks!
>
>
> - Steinar
>
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Problems adding a default repository

Steinar Bang
>>>>> Jean-Baptiste Onofré <[hidden email]>:

> It seems you are chaging the etc/startup.properties.

Slightly.  Just adjusting the version of jansi to "debian" (which always
point to the current version of a package in the debian repository).

I thought I could make the boot scan the debian repository, if it didn't
find the bundles in system (ie. first try system and then fall back to
the debian repository).

> Pax URL is not used here as it's started by the etc/startup.properties (so
> startup.properties is read before Pax URL).

Ah, ok.  So at the time startup.properties is resolved,
org.ops4j.pax.url.mvn.cfg with my modification, haven't yet been read?

> The Karaf main bootstrap looks into the system folder for the artifact (it's
> done in the installAndStartBundles() of Karaf Main). So you have to replace in
> the system folder (or use a link here).

A symlink would seem like the best idea.  It's what I do for the osgi
framework and JNA libraries in the lib/boot/ directory.

A symlink pointing to the debian version inside the debian repository
should do the trick.

Does it make sense to keep the modification to
org.ops4j.pax.url.mvn.defaultRepositories?  Or should I just remove
that?


Reply | Threaded
Open this post in threaded view
|

Re: Problems adding a default repository

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:
>> The Karaf main bootstrap looks into the system folder for the artifact (it's
>> done in the installAndStartBundles() of Karaf Main). So you have to replace in
>> the system folder (or use a link here).

> A symlink would seem like the best idea.  It's what I do for the osgi
> framework and JNA libraries in the lib/boot/ directory.

> A symlink pointing to the debian version inside the debian repository
> should do the trick.

Done!  Now karaf boots and runs with osgi 6, and jansi from debian
dependencies.

I have stripped out all non-karaf jars that aren't needed for the boot.
They are fetched if needed from maven central (or other repositories in
the list) and added to ~karaf/.m2/repository/

> Does it make sense to keep the modification to
> org.ops4j.pax.url.mvn.defaultRepositories?  Or should I just remove
> that?

It does, if one is to follow the recommendations from the debian java
maintainers, and split karaf into two packages: karaf and libkaraf-java,
with the latter holding the jar files and structuring them in the way
expected of debian java packages.