0

I'm trying to build a runnable jar for a MicroProfile 2.1 application using Open Liberty 18.0.0.4. I copied most code from the guide-getting-started and updated the version number from 18.0.03 to 18.0.0.4. However, the runnable Jar is not build and I get the following output during the package-server step:

[INFO] --- liberty-maven-plugin:2.6.1:package-server (package-server) @ cloud.service.repository ---
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:18.0.0.4:zip.
[INFO] CWWKM2102I: Using installDirectory : /home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : RepositoryService.
[INFO] CWWKM2102I: Using serverDirectory : /home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/liberty/wlp/usr/servers/RepositoryService.
[INFO] CWWKM2112I: Re-using previously installed assembly.
[INFO] CWWKM2134I: Packaging server RepositoryService.
[INFO] Copying 1 file to /home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/liberty/wlp/usr/servers/RepositoryService
[INFO] CWWKM2144I: Update server configuration file server.xml from /home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/src/main/liberty/config/server.xml.
[INFO] CWWKM2144I: Update server configuration file bootstrap.properties from inlined configuration.
[INFO] CWWKM2136I: Package file location is /home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/cloud.service.repository.zip.
[INFO] CWWKM2001I: server.config.dir is /home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/liberty/wlp/usr/servers/RepositoryService.
[INFO] CWWKM2001I: server.output.dir is /home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/liberty-alt-output-dir/RepositoryService.
[INFO] CWWKM2001I: Invoke command is [/home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/liberty/wlp/bin/server, package, RepositoryService, --archive=/home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/cloud.service.repository.zip, --include=minify,runnable].
[INFO] 
[INFO] Packaging server RepositoryService.
[INFO] Querying server RepositoryService for content.
[INFO] Launching RepositoryService (Open Liberty 18.0.0.4/wlp-1.0.23.cl180420181121-0300) on Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_192-b12 (en_US)
[INFO] [AUDIT   ] CWWKE0001I: The server RepositoryService has been launched.
[INFO] [WARNING ] CWWKF0024W: The feature com.ibm.websphere.appserver.kernel-1.0 referenced a resource com.ibm.ws.config.utility/[1.0.0,1.0.100) that was unable to be located during a packaging query. 
[INFO] [AUDIT   ] CWWKF0012I: The server installed the following features: [jsonb-1.0, servlet-4.0, jsonp-1.1, jaxrsClient-2.1, jaxrs-2.1].
[INFO] [AUDIT   ] CWWKF0026I: The server RepositoryService is ready to build a smaller package.
[INFO] [AUDIT   ] CWWKE1100I: Waiting for up to 30 seconds for the server to quiesce.
[INFO] [AUDIT   ] CWWKE0036I: The server RepositoryService stopped after 1.386 seconds.
[INFO] Building archive for server RepositoryService.
[INFO] CWWKE0070W: The loose file /home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/liberty/wlp/usr/servers/RepositoryService/apps/cloud.service.repository.war.xml is invalid.
[INFO] Server RepositoryService package complete in /home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/cloud.service.repository.zip.

The crucial part is the message The loose file /home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/liberty/wlp/usr/servers/RepositoryService/apps/cloud.service.repository.war.xml is invalid. It seems to break everything because the result of the build step is a zip file instead of a runnable Jar. Here are the contents of the file that it claims is invalid:

<?xml version="1.0" encoding="UTF-8"?>
<archive>
    <dir sourceOnDisk="/home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/src/main/webapp" targetInArchive="/"/>
    <dir sourceOnDisk="/home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/classes" targetInArchive="/WEB-INF/classes"/>
    <file sourceOnDisk="/home/thor/.m2/repository/com/knime/enterprise/cloud.service.repository.api/0.0.1-SNAPSHOT/cloud.service.repository.api-0.0.1-SNAPSHOT.jar" targetInArchive="/WEB-INF/lib/cloud.service.repository.api-0.0.1-SNAPSHOT.jar"/>
    <file sourceOnDisk="/home/thor/.m2/repository/javax/ws/rs/javax.ws.rs-api/2.1/javax.ws.rs-api-2.1.jar" targetInArchive="/WEB-INF/lib/javax.ws.rs-api-2.1.jar"/>
    <file sourceOnDisk="/home/thor/workspace/KNIME-trunk/git/knime-repository-service/com.knime.enterprise.cloud.service.repository/target/liberty-maven/resources/META-INF/MANIFEST.MF" targetInArchive="/META-INF/MANIFEST.MF"/>
</archive>

I cannot see anything invalid here. Also if I use 18.0.0.3 as the version of the assemblyArtifact in the pom.xml the very same process works perfectly fine.

Here's the full liberty-maven-plugin configuration that I'm using:

<plugin>
    <groupId>net.wasdev.wlp.maven.plugins</groupId>
    <artifactId>liberty-maven-plugin</artifactId>
    <version>2.6.1</version>
    <configuration>
        <assemblyArtifact>
            <groupId>io.openliberty</groupId>
            <artifactId>openliberty-runtime</artifactId>
            <version>${version.openliberty-runtime}</version>
            <type>zip</type>
        </assemblyArtifact>
        <serverName>${serverName}</serverName>
        <stripVersion>true</stripVersion>
        <looseApplication>true</looseApplication>
        <installAppPackages>project</installAppPackages>
        <configFile>src/main/liberty/config/server.xml</configFile>
        <packageFile>${package.file}</packageFile>
        <include>${packaging.type}</include>
        <bootstrapProperties>
            <default.http.port>${http.port}</default.http.port>
            <default.https.port>${https.port}</default.https.port>
            <app.context.root>${warContext}</app.context.root>
        </bootstrapProperties>
        </configuration>
                <executions>
                    <execution>
                        <id>stop-server-before-clean</id>
                        <phase>pre-clean</phase>
                        <goals>
                            <goal>stop-server</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>create-server</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>install-server</goal>
                            <goal>create-server</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>install-feature</id>
                        <phase>prepare-package</phase>
                        <goals>
                          <goal>install-feature</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/liberty-alt-output-dir</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-apps</id>
                        <phase>package</phase>
                        <goals>
                            <goal>install-apps</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>package-server</id>
                        <phase>package</phase>
                        <goals>
                            <goal>package-server</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/liberty-alt-output-dir</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-start-server</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>test-start-server</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-stop-server</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>test-stop-server</goal>
                        </goals>
                    </execution>
/executions>
</plugin>
sithmein
  • 437
  • 3
  • 11
  • There is a bug in 18.0.0.4 around runnable jar files and loose app configuration. That should be fixed in the next release, but I thought it would produce the jar file, but the application would be missing but you are saying the jar doesn't even get created. It might help if you could show the liberty-maven-plugin configuration from the pom. – Alasdair Jan 24 '19 at 21:02
  • here is the link to the relevant github issue: https://github.com/OpenLiberty/open-liberty/issues/6073 – Andy Guibert Jan 24 '19 at 21:08
  • Instead of ` cloud.service.repository.jar` I get ` cloud.service.repository.zip` as a result. It has similar size as the Jar but is by no means an executable Jar. – sithmein Jan 25 '19 at 08:59
  • Quick question: is it possible to get a SNAPSHOT build from somewhere that includes the bug fix for verification? – sithmein Jan 25 '19 at 09:02

0 Answers0