OpenLiberty Maven Plugin

1.3k Views Asked by At

I am trying to create a runnale openliberty server as part of my release process. I have a a multi module maven project with a submodule dedicated to packaging the server as a runnable. When I do a mvn clean package a lovely executable jar is produced which bundles one of the other submodules (war). The problem I am facing is when I do a maven deploy to our asset repo the packaged server is being uploaded as a zip file rather than a jar file. Does anyone know how to get the deploy plugin to upload the jar?

Here is a sample pom file

<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>
    <parent>
        <groupId>au.com.xxxx.xxxx</groupId>
        <artifactId>xxx-backend-parent</artifactId>
        <version>0.0.16-SNAPSHOT</version>
    </parent>
    <artifactId>xxxx-openliberty-server</artifactId>
    <packaging>liberty-assembly</packaging>
    <name>fusion-openliberty-server</name>
    <description>Runnable Jar containing xxxxand the OpenLiberty applictaion server</description>


    <dependencies>
        <!-- Package xxxx-application.war with server assembly -->
        <dependency>
            <groupId>au.com.xxx.xxx</groupId>
            <artifactId>xxxx-application</artifactId>
            <version>${project.version}</version>
            <type>war</type>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Enable liberty-maven-plugin -->
            <plugin>
                <groupId>net.wasdev.wlp.maven.plugins</groupId>
                <artifactId>liberty-maven-plugin</artifactId>
                <version>2.6.1</version>
                <extensions>true</extensions>
                <configuration>
                    <assemblyArtifact>
                        <groupId>io.openliberty</groupId>
                        <artifactId>openliberty-javaee8</artifactId>
                        <version>18.0.0.3</version>
                        <type>zip</type>
                    </assemblyArtifact>
                    <include>runnable</include>
                    <serverName>xxx</serverName>
                    <appsDirectory>apps</appsDirectory>
                    <serverEnv>${basedir}/src/main/resources/server.env</serverEnv>
                    <configFile>${basedir}/src/main/resources/server.xml</configFile>
                    <jvmOptionsFile>${basedir}/src/main/resources/jvm.options</jvmOptionsFile>
                    <bootstrapProperties>
                        <app.context.root>xxx-app</app.context.root>
                        <default.http.port>5000</default.http.port>
                        <default.https.port>5443</default.https.port>
                    </bootstrapProperties>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
1

There are 1 best solutions below

0
On

I don't have an answer to your question but an explanation why this happens. Every packaging type (jar, war, liberty-assembly) defines a fixed extension for the artifact(s) it creates. The liberty-assembly types defines zip as it extension. This extension is used by the maven-install-plugin and maven-deploy-plugin regardless how the local file is names. I did quite some code digging but couldn't find a way to change this. It's probably sth. that only liberty-maven-plugin can change/fix.