Skip to content

Commit

Permalink
Update liberty:dev and docs for Podman (#1727)
Browse files Browse the repository at this point in the history
* Update DevMojo parameters and aliases

* Add dev-container-it and skip-container-its profile

* Add Podman info to docs

* Skip dev-container-it

* Update dev goal aliases and docs
  • Loading branch information
mattbsox authored Sep 21, 2023
1 parent e00a074 commit 92e5fb6
Show file tree
Hide file tree
Showing 14 changed files with 919 additions and 44 deletions.
80 changes: 48 additions & 32 deletions docs/dev.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions liberty-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
<configuration>
<pomExcludes>
<pomExclude>binary-scanner-it/pom.xml</pomExclude>
<pomExclude>dev-container-it/pom.xml</pomExclude>
</pomExcludes>
</configuration>
</plugin>
Expand Down Expand Up @@ -262,6 +263,7 @@
<pomExclude>server-param-configdir-not-override-it/pom.xml</pomExclude>
<pomExclude>install-features-it/pom.xml</pomExclude>
<pomExclude>binary-scanner-it/pom.xml</pomExclude>
<pomExclude>dev-container-it/pom.xml</pomExclude>
</pomExcludes>
</configuration>
</plugin>
Expand Down Expand Up @@ -298,6 +300,7 @@
<configuration>
<pomExcludes>
<pomExclude>dev-it/pom.xml</pomExclude>
<pomExclude>dev-container-it/pom.xml</pomExclude>
<pomExclude>generate-features-it/pom.xml</pomExclude>
<pomExclude>binary-scanner-it/pom.xml</pomExclude>
</pomExcludes>
Expand Down Expand Up @@ -334,6 +337,7 @@
<configuration>
<pomExcludes>
<pomExclude>dev-it/pom.xml</pomExclude>
<pomExclude>dev-container-it/pom.xml</pomExclude>
<pomExclude>basic-it/pom.xml</pomExclude>
<pomExclude>assembly-it/pom.xml</pomExclude>
<pomExclude>assembly-with-code-it/pom.xml</pomExclude>
Expand Down
121 changes: 121 additions & 0 deletions liberty-maven-plugin/src/it/dev-container-it/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>io.openliberty.tools.it</groupId>
<artifactId>dev-container-it</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<dependency>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>@pom.version@</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.4.2</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>@pom.version@</version>
<configuration>
<assemblyArtifact>
<groupId>${runtimeGroupId}</groupId>
<artifactId>${runtimeArtifactId}</artifactId>
<version>${runtimeVersion}</version>
<type>zip</type>
</assemblyArtifact>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<forkedProcessTimeoutInSeconds>2400</forkedProcessTimeoutInSeconds>
<argLine>-enableassertions</argLine>
<workingDirectory>${project.build.directory}</workingDirectory>
<includes>
<include>**/*Test.java</include>
</includes>
<systemPropertyVariables>
<mavenPluginVersion>@pom.version@</mavenPluginVersion>
<runtimeVersion>${runtimeVersion}</runtimeVersion>
</systemPropertyVariables>
<trimStackTrace>false</trimStackTrace>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Start with OL runtime.
# tag::from[]
FROM icr.io/appcafe/open-liberty:full-java11-openj9-ubi
# end::from[]

ARG VERSION=1.0
ARG REVISION=SNAPSHOT
# tag::label[]

LABEL \
org.opencontainers.image.authors="Your Name" \
org.opencontainers.image.vendor="IBM" \
org.opencontainers.image.url="local" \
org.opencontainers.image.source="https://github.com/OpenLiberty/guide-docker" \
org.opencontainers.image.version="$VERSION" \
org.opencontainers.image.revision="$REVISION" \
vendor="Open Liberty" \
name="system" \
version="$VERSION-$REVISION" \
summary="The system microservice from the Docker Guide" \
# tag::description[]
description="This image contains the system microservice running with the Open Liberty runtime."
# end::description[]
# end::label[]


USER root

COPY --chown=1001:0 src/main/liberty/config/server.xml /config/

COPY --chown=1001:0 target/*.war /config/apps/

USER 1001
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?xml version='1.0' encoding='utf-8'?>
<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>io.openliberty.tools</groupId>
<artifactId>dev-containers-it</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- Liberty configuration -->
<liberty.var.default.http.port>9080</liberty.var.default.http.port>
<liberty.var.default.https.port>9443</liberty.var.default.https.port>
</properties>

<pluginRepositories>
<!-- Configure Sonatype OSS Maven snapshots repository -->
<pluginRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>

<dependencies>

<!-- Provided dependencies -->
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>9.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>5.0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>

<!-- For tests -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>6.0.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-json-binding-provider</artifactId>
<version>6.0.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.json</artifactId>
<version>2.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<finalName>rest</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>

<!-- Enable liberty-maven plugin -->
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>SUB_VERSION</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>

<!-- Plugin to run functional tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<systemPropertyVariables>
<liberty.test.port>
${liberty.var.default.http.port}
</liberty.test.port>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2017, 2022 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - Initial implementation
*******************************************************************************/
// end::copyright[]
package io.openliberty.guides.rest;

import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Produces;

import jakarta.json.JsonObject;
import jakarta.json.JsonObjectBuilder;
import jakarta.json.Json;

// tag::Path[]
@Path("properties")
// end::Path[]
public class PropertiesResource {

@GET
@Produces(MediaType.APPLICATION_JSON)
public JsonObject getProperties() {

JsonObjectBuilder builder = Json.createObjectBuilder();

System.getProperties()
.entrySet()
.stream()
.forEach(entry -> builder.add((String) entry.getKey(),
(String) entry.getValue()));

return builder.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2017, 2022 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - Initial implementation
*******************************************************************************/
// end::copyright[]
package io.openliberty.guides.rest;

import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.ApplicationPath;

@ApplicationPath("system")
public class SystemApplication extends Application {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<server description="Sample Liberty server">

<featureManager>
<feature>restfulWS-3.0</feature>
<feature>jsonb-2.0</feature>
<feature>jsonp-2.0</feature>
</featureManager>

<variable name="default.http.port" defaultValue="9080"/>
<variable name="default.https.port" defaultValue="9443"/>

<httpEndpoint httpPort="${default.http.port}" httpsPort="${default.https.port}"
id="defaultHttpEndpoint" host="*" />

<webApplication location="rest.war" contextRoot="/"/>
</server>
Loading

0 comments on commit 92e5fb6

Please sign in to comment.