Re: How to make karaf-maven-plugin exclude some compile depencies when building a feature?

2019-09-07 Thread Ryan Moquin
I agree about the messy part with blacklisting.  It's a good way to keep
from being blocked from an issue you otherwise can't around, is how I look
at it.

I guess I hope that eventually there will be an awareness by developers
around putting a little more thought into code organization and
dependencies.  I think tools and convenience have caused a lack of
awareness which has only caused nonmodular libraries and unnecessary
dependencies.  Karaf features definitely helps to alleviate that for sure.

Ryan

Ryan

On Sun, Sep 1, 2019, 3:11 AM Steinar Bang  wrote:

> > Ryan Moquin :
>
> > Hi Steinar,
> > There are a couple ways.
>
> > 1. You can use runtime to prevent a jar from being added,
> > but that has other ramifications when building (such as I think unit test
> > code won't see the dependency)
> > 2. You can use provided to only include that dependency
> but
> > not of it's transitive dependencies in the feature.xml
>
> Yup, but I didn't want to touch their dependencies if I could avoid it.
>
> > 3. The karaf maven plugin has an option to excludeArtifactId (look in the
> > docs of the karaf site)
>
> Right.  Something like this is what I looking for, but unable to find
> (it was late at night and my googling skills may not have been at the
> top of their game...:-) )
>
> > 4. If you really have to, you can blacklist a bundle using the karaf
> maven
> > plugin, but that would be a last resort IMHO.
>
> Hm... this sounds like the kind of thing that made OSGi messy before I
> discovered karaf and features in 2016.  So I agree.
>
> > I would use one of the first 2 options primarily.  Also, you can use the
> > maven exclude to prevent certain transitives from being added to the
> > feature xml.
>
> I run with
>false
> by default.
>
> Thanks for your help so far! :-)
>
>


Re: How to make karaf-maven-plugin exclude some compile depencies when building a feature?

2019-09-01 Thread Steinar Bang
> Jean-Baptiste Onofré :

> you can blacklist or you can exclude artifacts.

Right.  I tried using blacklisting in the karaf-maven-plugin
documentation, but that didn't work as I expected it to.

I looked for something like the exclusion of artifacts in the
karaf-maven-plugin documentation, but as I said in the reply to Ryan,
couldn't find it.

(If you're thinking of exclusion in the dependencies, that wasn't easy
to do because of dependency inheritance and use profiles and the
dependencies were used to include the problem packages into the jar
(maybe... it was hard to tell))

> You can also use a different scope than compile,

Yes, but I didn't want to mess with their dependencies (especially since
the maven config was so complicated).

> or use a features.xml "template".

Yep, I already do that.  But all non-transitive compile scope
dependencies are pulled in.

Thanks for your help!

The PR is here if anyone would like to take a look at it:
 https://github.com/pgjdbc/pgjdbc/pull/1554

For now I let the two wrap'ed jar files stay.  I have tested replacing
my own hand-written PostgreSQL karaf feature[1] with he piggy backed
feature, and the feature created by the pull request works fine.

References:
[1] 



Re: How to make karaf-maven-plugin exclude some compile depencies when building a feature?

2019-09-01 Thread Steinar Bang
> Ryan Moquin :

> Hi Steinar,
> There are a couple ways.

> 1. You can use runtime to prevent a jar from being added,
> but that has other ramifications when building (such as I think unit test
> code won't see the dependency)
> 2. You can use provided to only include that dependency but
> not of it's transitive dependencies in the feature.xml

Yup, but I didn't want to touch their dependencies if I could avoid it.

> 3. The karaf maven plugin has an option to excludeArtifactId (look in the
> docs of the karaf site)

Right.  Something like this is what I looking for, but unable to find
(it was late at night and my googling skills may not have been at the
top of their game...:-) )

> 4. If you really have to, you can blacklist a bundle using the karaf maven
> plugin, but that would be a last resort IMHO.

Hm... this sounds like the kind of thing that made OSGi messy before I
discovered karaf and features in 2016.  So I agree.

> I would use one of the first 2 options primarily.  Also, you can use the
> maven exclude to prevent certain transitives from being added to the
> feature xml.

I run with
   false
by default.

Thanks for your help so far! :-)



Re: How to make karaf-maven-plugin exclude some compile depencies when building a feature?

2019-08-31 Thread Jean-Baptiste Onofré
Hi,

you can blacklist or you can exclude artifacts.

You can also use a different scope than compile, or use a features.xml
"template".

Regards
JB

On 31/08/2019 00:52, Steinar Bang wrote:
> Is it possible to make karaf-maven-plugin exclude some dependencies with
> compile?
> 
> I'm trying to create a pull request to fix this issue
>  https://github.com/pgjdbc/pgjdbc/issues/1552
> and the PostgreSQL JDBC driver pulls in and includes two dependencies,
> that I would like to not pull in with the feature.
> 
> Firstly, the aren't needed (since they are embedded into the psql jar).
> Secondly, they aren't OSGi bundles, so karaf wraps them:
> 51 │ Active │  80 │ 0   │ 
> wrap_file__home_sb_.m2_repository_com_github_waffle_waffle-jna_1.9.1_waffle-jna-1.9.1.jar
> 52 │ Active │  80 │ 0   │ 
> wrap_file__home_sb_.m2_repository_com_ongres_scram_client_2.0_client-2.0.jar
> 
> Thanks!
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: How to make karaf-maven-plugin exclude some compile depencies when building a feature?

2019-08-31 Thread Ryan Moquin
Hi Steinar,

There are a couple ways.

1. You can use runtime to prevent a jar from being added,
but that has other ramifications when building (such as I think unit test
code won't see the dependency)
2. You can use provided to only include that dependency but
not of it's transitive dependencies in the feature.xml
3. The karaf maven plugin has an option to excludeArtifactId (look in the
docs of the karaf site)
4. If you really have to, you can blacklist a bundle using the karaf maven
plugin, but that would be a last resort IMHO.

I would use one of the first 2 options primarily.  Also, you can use the
maven exclude to prevent certain transitives from being added to the
feature xml.

Hope that helps,
Ryan

On Fri, Aug 30, 2019 at 6:51 PM Steinar Bang  wrote:

> Is it possible to make karaf-maven-plugin exclude some dependencies with
> compile?
>
> I'm trying to create a pull request to fix this issue
>  https://github.com/pgjdbc/pgjdbc/issues/1552
> and the PostgreSQL JDBC driver pulls in and includes two dependencies,
> that I would like to not pull in with the feature.
>
> Firstly, the aren't needed (since they are embedded into the psql jar).
> Secondly, they aren't OSGi bundles, so karaf wraps them:
> 51 │ Active │  80 │ 0   │
> wrap_file__home_sb_.m2_repository_com_github_waffle_waffle-jna_1.9.1_waffle-jna-1.9.1.jar
> 52 │ Active │  80 │ 0   │
> wrap_file__home_sb_.m2_repository_com_ongres_scram_client_2.0_client-2.0.jar
>
> Thanks!
>
>