You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Steinar Bang <sb...@dod.no> on 2019/09/03 20:50:38 UTC

PostgreSQL JDBC driver now has a karaf feature attached (Was: How to make karaf-maven-plugin exclude some compile depencies when building a feature?)

>>>>> Steinar Bang <sb...@dod.no>:

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

The PR was merged to pgjdbc master, so when the next release of pgjdbc is done, it should be possible to use the attached feature:

1. From a maven dependency in a maven module building and attaching its own feature file:
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>42.2.7</version>
        <type>xml</type>
        <classifier>features</classifier>
    </dependency>

2. Alternatively, using a template feature.xml file:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="authservice.bundle">
        <repository>mvn:org.postgresql/postgresql/42.2.7/xml/features</repository>
            <feature name="${karaf-feature-name}">
            <feature>postgresql</feature>
        </feature>
    </features>

(I'm guessing at the version name for the next pgjdbc release, it's the current SNAPSHOT without -SNAPSHOT)


Re: PostgreSQL JDBC driver karaf feature repository file has problems building on RH EL7

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:

> My PR adding the creation of a karaf feature repository file and
> attaching the feature repository to the JDBC driver, has problems in
> the JDBC driver team's RH EL7 build:
>  https://github.com/pgjdbc/pgjdbc/pull/1554#issuecomment-535722657
>  https://github.com/pgjdbc/pgjdbc/pull/1554#issuecomment-536174617

Note: The RH EL7 build has been fixed, so there is no need to look
further into this:
 https://github.com/pgjdbc/pgjdbc/pull/1554#issuecomment-537079192


PostgreSQL JDBC driver karaf feature repository file has problems building on RH EL7

Posted by Steinar Bang <sb...@dod.no>.
My PR adding the creation of a karaf feature repository file and
attaching the feature repository to the JDBC driver, has problems in
the JDBC driver team's RH EL7 build:
 https://github.com/pgjdbc/pgjdbc/pull/1554#issuecomment-535722657
 https://github.com/pgjdbc/pgjdbc/pull/1554#issuecomment-536174617

Does anyone see what the problem is?

(I have googled NoSuchElementException and karaf but haven't found
anything obvious).

Here are version numbers of maven and java (kind of old maven, but an as
recent as possible java 8) from the build machine and a stack trace from
the maven build failure:

mvn --version
Apache Maven 3.0.5 (Red Hat 3.0.5-17)
Maven home: /usr/share/maven
Java version: 1.8.0_222, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-1.el7_7.x86_64/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-693.21.1.el7.x86_64", arch: "amd64", family: "unix"

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.2.5:features-generate-descriptor (generate-features-file) on project postgresql: Unable to create features.xml file: org.apache.maven.plugin.MojoExecutionException: java.util.NoSuchElementException
role: org.eclipse.aether.RepositorySystem
roleHint:
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to create features.xml file: org.apache.maven.plugin.MojoExecutionException: java.util.NoSuchElementException
role: org.eclipse.aether.RepositorySystem
roleHint:
at org.apache.karaf.tooling.features.GenerateDescriptorMojo.execute(GenerateDescriptorMojo.java:364)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.apache.maven.plugin.MojoExecutionException: java.util.NoSuchElementException
role: org.eclipse.aether.RepositorySystem
roleHint:
at org.apache.karaf.tooling.utils.DependencyHelperFactory.createDependencyHelper(DependencyHelperFactory.java:63)
at org.apache.karaf.tooling.features.GenerateDescriptorMojo.execute(GenerateDescriptorMojo.java:346)
... 21 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
role: org.eclipse.aether.RepositorySystem
roleHint:
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:257)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:245)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:239)
at org.apache.karaf.tooling.utils.DependencyHelperFactory.createDependencyHelper(DependencyHelperFactory.java:58)
... 22 more
Caused by: java.util.NoSuchElementException
at org.sonatype.guice.plexus.locators.RealmFilter$FilteredItr.next(RealmFilter.java:96)
at org.sonatype.guice.plexus.locators.RealmFilter$FilteredItr.next(RealmFilter.java:54)
at org.sonatype.guice.plexus.locators.DefaultPlexusBeans$Itr.next(DefaultPlexusBeans.java:60)
at org.sonatype.guice.plexus.locators.DefaultPlexusBeans$Itr.next(DefaultPlexusBeans.java:48)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:253)
... 25 more


Re: ANN: PostgreSQL JDBC driver 4.2.8 has a karaf feature attached

Posted by Francois Papon <fr...@openobject.fr>.
Thanks Steinar!

regards,

François
fpapon@apache.org

Le 26/09/2019 à 23:11, Steinar Bang a écrit :
> (Not really my news to announce, but I'm doing it anyway...:-) )
>
> The current version of the PostgreSQL JDBC driver, ie. 4.2.8, comes with
> a karaf feature repository file attached.  The karaf feature repository
> file has been present since version 4.2.7 of the driver:
>  https://jdbc.postgresql.org/documentation/changelog.html#version_42.2.7
>
> Copy/pastable code for usage with template feature file:
>  1. In pom.xml:
>     <properties>
>         <postgresql.version>42.2.8</postgresql.version>
>     </properties>
>
>  2. In src/main/feature/feature.xml (ie. the template feature file):
>      <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="authservice.bundle">
>          <repository>mvn:org.postgresql/postgresql/${postgresql.version}/xml/features</repository>
>          <feature name="${karaf-feature-name}">
>              <feature>postgresql</feature>
>              <feature>scr</feature>
>          </feature>
>      </features>
>
> Copy/pastable code for usage with a feature file dependency:
>  1. In pom.xml:
>     <properties>
>         <postgresql.version>42.2.8</postgresql.version>
>     </properties>
>
>     <dependencies>
>         <dependency>
>             <groupId>org.postgresql</groupId>
>             <artifactId>postgresql</artifactId>
>             <version>${postgresql.version}</version>
>             <scope>provided</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.postgresql</groupId>
>             <artifactId>postgresql</artifactId>
>             <version>${postgresql.version}</version>
>             <type>xml</type>
>             <classifier>features</classifier>
>         </dependency>
>     </dependencies>
>

ANN: PostgreSQL JDBC driver 4.2.8 has a karaf feature attached

Posted by Steinar Bang <sb...@dod.no>.
(Not really my news to announce, but I'm doing it anyway...:-) )

The current version of the PostgreSQL JDBC driver, ie. 4.2.8, comes with
a karaf feature repository file attached.  The karaf feature repository
file has been present since version 4.2.7 of the driver:
 https://jdbc.postgresql.org/documentation/changelog.html#version_42.2.7

Copy/pastable code for usage with template feature file:
 1. In pom.xml:
    <properties>
        <postgresql.version>42.2.8</postgresql.version>
    </properties>

 2. In src/main/feature/feature.xml (ie. the template feature file):
     <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="authservice.bundle">
         <repository>mvn:org.postgresql/postgresql/${postgresql.version}/xml/features</repository>
         <feature name="${karaf-feature-name}">
             <feature>postgresql</feature>
             <feature>scr</feature>
         </feature>
     </features>

Copy/pastable code for usage with a feature file dependency:
 1. In pom.xml:
    <properties>
        <postgresql.version>42.2.8</postgresql.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgresql.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgresql.version}</version>
            <type>xml</type>
            <classifier>features</classifier>
        </dependency>
    </dependencies>