Skip to content

Commit 0c3d2ae

Browse files
committed
Merge branch 'version1.1' into version2.0
2 parents 5a7b651 + ecf2ac2 commit 0c3d2ae

File tree

4 files changed

+54
-1
lines changed

4 files changed

+54
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
# Api Versioning
22
Showcase to demonstrate the implementation of backward-compatible APIs and versioning
33

4+
## Run via Docker
45
Run
56
```
7+
docker build -t customer-service customer-service/
8+
docker run -p8080:8080 customer-service
9+
```
10+
to build and run the sample.
11+
12+
## Run without Docker
13+
You need Apache Maven installed to run the sample without Docker. Run
14+
```
615
cd customer-service
716
mvn package meecrowave:run
817
```
9-
to run the sample.
18+
19+
## Accessing the UI
1020
After the server is running, you can access the Swagger UI at
1121
http://localhost:8080/index.html
1222

customer-service/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM maven:3.6.3-jdk-11-openj9 AS mvn
2+
3+
WORKDIR /usr/src/customer-service
4+
COPY pom.xml ./
5+
RUN mvn package dependency:go-offline # cache dependencies
6+
COPY src ./src
7+
RUN mvn clean package
8+
9+
FROM openjdk:11
10+
11+
EXPOSE 8080
12+
COPY --from=mvn /usr/src/customer-service/target/runner/meecrowave-core-runner.jar /opt/meecrowave-runner.jar
13+
COPY --from=mvn /usr/src/customer-service/target/customer-service.war /opt/customer-service.war
14+
15+
ENTRYPOINT ["java", "--illegal-access=permit", "-Djava.net.preferIPv4Stack=true", "-jar", "/opt/meecrowave-runner.jar", "--webapp", "/opt/customer-service.war"]

customer-service/pom.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
</properties>
2020

2121
<build>
22+
<finalName>customer-service</finalName>
2223
<plugins>
2324
<plugin>
2425
<groupId>org.apache.maven.plugins</groupId>
@@ -30,6 +31,31 @@
3031
<artifactId>meecrowave-maven-plugin</artifactId>
3132
<version>${meecrowave.version}</version>
3233
</plugin>
34+
<plugin>
35+
<groupId>org.apache.maven.plugins</groupId>
36+
<artifactId>maven-dependency-plugin</artifactId>
37+
<executions>
38+
<execution>
39+
<id>copy-runner</id>
40+
<phase>package</phase>
41+
<goals>
42+
<goal>copy</goal>
43+
</goals>
44+
<configuration>
45+
<artifactItems>
46+
<artifactItem>
47+
<groupId>org.apache.meecrowave</groupId>
48+
<artifactId>meecrowave-core</artifactId>
49+
<version>${meecrowave.version}</version>
50+
<classifier>runner</classifier>
51+
</artifactItem>
52+
</artifactItems>
53+
<outputDirectory>${project.build.directory}/runner</outputDirectory>
54+
<stripVersion>true</stripVersion>
55+
</configuration>
56+
</execution>
57+
</executions>
58+
</plugin>
3359
</plugins>
3460
</build>
3561

customer-service/src/main/java/de/openknowledge/sample/customer/application/JaxRsActivator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.eclipse.microprofile.openapi.annotations.media.Content;
2828
import org.eclipse.microprofile.openapi.annotations.media.Schema;
2929
import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody;
30+
import org.eclipse.microprofile.openapi.annotations.servers.Server;
3031

3132
/**
3233
* JAX-RS Activator
@@ -44,6 +45,7 @@
4445
url = "http://www.apache.org/licenses/LICENSE-2.0"),
4546
version = "2",
4647
description = "A customer service"),
48+
servers = @Server(url = "http://localhost:8080/api"),
4749
components = @Components(requestBodies = @RequestBody(name = "Customer", content = @Content(schema = @Schema(implementation = CustomerResourceType.class)))))
4850
public class JaxRsActivator extends Application {
4951

0 commit comments

Comments
 (0)