OpenLiberty / open-liberty

Open Liberty is a highly composable, fast to start, dynamic application server runtime environment
https://openliberty.io
Eclipse Public License 2.0
1.16k stars 597 forks source link

Installing custom feature fails #8162

Open ikonkere opened 5 years ago

ikonkere commented 5 years ago

We try to install a custom OL feature that we built and packaged as ESA with OSGI-INF/SUBSYSTEM.MF present, but we get the following error during Maven build:

[ERROR] Failed to execute goal net.wasdev.wlp.maven.plugins:liberty-maven-plugin:2.7:install-feature (install-feature) on project : com.ibm.ws.install.InstallException: CWWKF1299E: The following features could not be obtained: servlet-4.0 test-feature jaxrs-2.1. Ensure that the features are valid for Open Liberty. -> [Help 1]

I've studied lots of manuals on the internet about custom OL features and i'm at a loss with this one, what do i miss in my feature?

SUBSYSTEM.MF of the feature:

Subsystem-ManifestVersion: 1.0
IBM-Feature-Version: 2
IBM-ShortName: test-feature
Subsystem-SymbolicName: com.acme.mycompany.test-feature-1.0.0;visibility:=public
Subsystem-Version: 1.0.0.qualifier
Subsystem-Type: osgi.subsystem.feature
Subsystem-Content: test-feature-osgi;version=1.0.0
Manifest-Version: 1.0
IBM-API-Package: test_feature_osgi;version=1.0.0;type="api"
IBM-SPI-Package: test_feature_osgi;version=1.0.0

pom.xml of the app:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.acme.mycompany</groupId>
    <artifactId>myapp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <parent>
        <groupId>net.wasdev.wlp.maven.parent</groupId>
        <artifactId>liberty-maven-app-parent</artifactId>
        <version>RELEASE</version>
    </parent>

    <properties>
        <app.name>${project.artifactId}</app.name>
        <testServerHttpPort>9080</testServerHttpPort>
        <testServerHttpsPort>9443</testServerHttpsPort>
        <warContext>${app.name}</warContext>
        <package.file>
            ${project.build.directory}/${app.name}.jar
        </package.file>
        <packaging.type>runnable,minify</packaging.type>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.openliberty.features</groupId>
                <artifactId>features-bom</artifactId>
                <version>RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.acme.mycompany</groupId>
            <artifactId>test-feature</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <type>esa</type>
        </dependency>
        <dependency>
            <groupId>io.openliberty.features</groupId>
            <artifactId>servlet-4.0</artifactId>
            <type>esa</type>
        </dependency>
        <dependency>
            <groupId>io.openliberty.features</groupId>
            <artifactId>jaxrs-2.1</artifactId>
            <type>esa</type>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.25</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.2</version>
                <configuration>
                    <packagingExcludes>pom.xml</packagingExcludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.wasdev.wlp.maven.plugins</groupId>
                <artifactId>liberty-maven-plugin</artifactId>
                <configuration>
                    <assemblyArtifact>
                        <groupId>io.openliberty</groupId>
                        <artifactId>openliberty-kernel</artifactId>
                        <version>RELEASE</version>
                        <type>zip</type>
                    </assemblyArtifact>
                    <serverName>${project.artifactId}Server</serverName>
                    <stripVersion>true</stripVersion>
                    <configFile>src/main/liberty/config/server.xml</configFile>
                    <packageFile>${package.file}</packageFile>
                    <include>${packaging.type}</include>
                    <bootstrapProperties>
                        <default.http.port>${testServerHttpPort}</default.http.port>
                        <default.https.port>${testServerHttpsPort}</default.https.port>
                        <app.context.root>${warContext}</app.context.root>
                    </bootstrapProperties>
                </configuration>
                <executions>
                    <execution>
                        <id>package-server</id>
                        <configuration>
                            <outputDirectory>target/wlp-package</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
NottyCode commented 5 years ago

It isn't currently possible to install custom features using the Liberty maven plugin. This is something we want to address, but haven't been able to so far. It might be possible to manually install it by copying the SUBSYSTEM.MF to the usr/extension/lib/features folder (I'd recommend renaming it to be com.acme.mycompany.test-feature-1.0.0.mf) and putting the jar file into usr/extension/lib

bwa commented 3 years ago

I vote for custom feature support in the maven plugin ....

ikonkere commented 3 years ago

There has been no progress for more than a year on this somewhat major enhancement that is also quite trivial to implement. I don't see it done any time soon or most probably not at all due to IBM's paradigm shift. WAS/Liberty is clearly legacy and nobody's been using it for anything for some time now.

MichaelNesterenko commented 3 years ago

Hi,

any updates on this issue?

benjamin-confino commented 12 months ago

Hello. I stumbled on this, and think this blog post has instructions for doing what you want: https://openliberty.io/blog/2022/07/06/user-feature-install.html