Skip to content

Commit

Permalink
Fixes #52 - Update dependencies and plugin versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem committed Aug 26, 2023
1 parent 3e0d6c6 commit dfb66dc
Show file tree
Hide file tree
Showing 13 changed files with 248 additions and 29 deletions.
17 changes: 10 additions & 7 deletions coreprofile/arquillian/pom.xml
Expand Up @@ -9,17 +9,20 @@
<artifactId>arquillian</artifactId>
<version>1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Piranha Core Profile - Testing with JUnit 5 and Arquillian</name>
<name>Testing with JUnit 5 and Arquillian</name>
<properties>
<arquillian.version>1.7.0.Final</arquillian.version>
<!-- dependencies -->
<arquillian.version>1.7.1.Final</arquillian.version>
<jakartaee.version>10.0.0</jakartaee.version>
<junit.version>5.10.0</junit.version>
<!-- other -->
<java.version>17</java.version>
<junit.version>5.10.0-M1</junit.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-failsafe-plugin.version>3.0.0</maven-failsafe-plugin.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
<piranha.version>23.6.0</piranha.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- plugins -->
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-failsafe-plugin.version>3.1.2</maven-failsafe-plugin.version>
<maven-war-plugin.version>3.4.0</maven-war-plugin.version>
<piranha.version>23.8.0</piranha.version>
</properties>
<dependencies>
<dependency>
Expand Down
15 changes: 9 additions & 6 deletions coreprofile/json/pom.xml
Expand Up @@ -9,16 +9,19 @@
<artifactId>json</artifactId>
<version>1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Piranha Core Profile - Temperature JSON service</name>
<name>Create a JSON service</name>
<properties>
<!-- dependencies -->
<jakartaee.version>10.0.0</jakartaee.version>
<java.version>17</java.version>
<junit.version>5.10.0-M1</junit.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-failsafe-plugin.version>3.0.0</maven-failsafe-plugin.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
<piranha.version>23.6.0</piranha.version>
<junit.version>5.10.0</junit.version>
<piranha.version>23.8.0</piranha.version>
<!-- other -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- plugins -->
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-failsafe-plugin.version>3.1.2</maven-failsafe-plugin.version>
<maven-war-plugin.version>3.4.0</maven-war-plugin.version>
</properties>
<dependencies>
<dependency>
Expand Down
15 changes: 9 additions & 6 deletions coreprofile/netbeans-debug/pom.xml
Expand Up @@ -9,16 +9,19 @@
<artifactId>netbeans-debug</artifactId>
<version>1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Piranha Core Profile - Debugging a REST service with NetBeans</name>
<name>Debugging a REST service with NetBeans</name>
<properties>
<!-- dependencies -->
<jakartaee.version>10.0.0</jakartaee.version>
<junit.version>5.10.0</junit.version>
<piranha.version>23.8.0</piranha.version>
<!-- other -->
<java.version>17</java.version>
<junit.version>5.10.0-M1</junit.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-failsafe-plugin.version>3.0.0</maven-failsafe-plugin.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
<piranha.version>23.6.0</piranha.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- plugins -->
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-failsafe-plugin.version>3.1.2</maven-failsafe-plugin.version>
<maven-war-plugin.version>3.4.0</maven-war-plugin.version>
</properties>
<dependencies>
<dependency>
Expand Down
10 changes: 6 additions & 4 deletions coreprofile/rest/pom.xml
Expand Up @@ -9,16 +9,18 @@
<artifactId>rest</artifactId>
<version>1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Piranha Core Profile - REST service</name>
<name>Create a REST service</name>
<properties>
<!-- dependencies -->
<jakartaee.version>10.0.0</jakartaee.version>
<junit.version>5.10.0</junit.version>
<piranha.version>23.8.0</piranha.version>
<!-- other -->
<java.version>17</java.version>
<junit.version>5.10.0-M1</junit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-failsafe-plugin.version>3.0.0</maven-failsafe-plugin.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
<piranha.version>23.6.0</piranha.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
Expand Down
15 changes: 9 additions & 6 deletions coreprofile/vscode-debug/pom.xml
Expand Up @@ -9,16 +9,19 @@
<artifactId>vscode-debug</artifactId>
<version>1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Piranha Core Profile - Debugging a REST service with VSCode</name>
<name>Debugging a REST service with VSCode</name>
<properties>
<!-- dependencies -->
<jakartaee.version>10.0.0</jakartaee.version>
<junit.version>5.10.0</junit.version>
<piranha.version>23.8.0</piranha.version>
<!-- other -->
<java.version>17</java.version>
<junit.version>5.10.0-M1</junit.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-failsafe-plugin.version>3.0.0</maven-failsafe-plugin.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
<piranha.version>23.6.0</piranha.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- plugins -->
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-failsafe-plugin.version>3.1.2</maven-failsafe-plugin.version>
<maven-war-plugin.version>3.4.0</maven-war-plugin.version>
</properties>
<dependencies>
<dependency>
Expand Down
20 changes: 20 additions & 0 deletions micro/helloworld/Dockerfile
@@ -0,0 +1,20 @@
#
# Build the WAR file
#
FROM eclipse-temurin:17 AS builder
RUN cd /usr/local && \
curl -O https://archive.apache.org/dist/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz && \
tar xfvz apache-maven-3.8.4-bin.tar.gz && \
rm apache-maven-3.8.4-bin.tar.gz
COPY . /root
RUN export PATH=$PATH:/usr/local/apache-maven-3.8.4/bin && \
cd /root && \
mvn --no-transfer-progress clean install

#
# Deploy the WAR file.
#
FROM piranhacloud/micro:v22.2.0
COPY --from=builder /root/target/piranha-micro-helloworld.war /usr/local/piranha/ROOT.war
EXPOSE 8080
CMD ["java", "-jar", "piranha-micro.jar", "--war-file", "ROOT.war"]
23 changes: 23 additions & 0 deletions micro/helloworld/README.md
@@ -0,0 +1,23 @@

# Piranha Micro HelloWorld template

This project delivers you with a template to get started with Piranha Micro.

## Building locally

To build the project locally use the following Maven command line:

```shell
mvn clean install
```

## To run the application use

After building the application locally you can run the application using:

```shell
mvn piranha-micro:run
```

And the open your browser to http://localhost:8080/piranha-micro-helloworld/
to see it in action.
90 changes: 90 additions & 0 deletions micro/helloworld/pom.xml
@@ -0,0 +1,90 @@
<?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>cloud.piranha.guides.micro</groupId>
<artifactId>helloworld</artifactId>
<version>1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Piranha Micro - Create a Hello World application</name>
<properties>
<piranha.distribution>micro</piranha.distribution>
<piranha.version>23.6.0</piranha.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<finalName>piranha-micro-helloworld</finalName>
<plugins>
<plugin>
<groupId>cloud.piranha.maven.plugins</groupId>
<artifactId>piranha-maven-plugin</artifactId>
<version>${piranha.version}</version>
<executions>
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<distribution>${piranha.distribution}</distribution>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M7</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
21 changes: 21 additions & 0 deletions micro/helloworld/src/main/java/helloworld/HelloWorldServlet.java
@@ -0,0 +1,21 @@
package helloworld;

import java.io.IOException;
import java.io.PrintWriter;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

public class HelloWorldServlet extends HttpServlet {

@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
try (PrintWriter writer = response.getWriter()) {
response.setContentType("text/plain");
writer.println("Hello World!");
writer.flush();
}
}
}
15 changes: 15 additions & 0 deletions micro/helloworld/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>

<web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
<servlet>
<servlet-name>HelloWorldServlet</servlet-name>
<servlet-class>helloworld.HelloWorldServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/index.html</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
22 changes: 22 additions & 0 deletions micro/helloworld/src/test/java/helloworld/HelloWorldServletIT.java
@@ -0,0 +1,22 @@
package helloworld;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;

class HelloWorldServletIT {

@Test
void testHelloWorld() throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest
.newBuilder(new URI("http://localhost:8080/piranha-micro-helloworld/index.html"))
.build();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
assertTrue(response.body().contains("Hello World!"));
}
}
13 changes: 13 additions & 0 deletions micro/pom.xml
@@ -0,0 +1,13 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cloud.piranha.guides.micro</groupId>
<artifactId>project</artifactId>
<version>1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Piranha Guides - Micro - Project</name>
<modules>
<module>helloworld</module>
</modules>
</project>
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -11,6 +11,7 @@
<modules>
<module>coreprofile</module>
<module>embedded</module>
<module>micro</module>
<module>server</module>
<module>servlet</module>
<module>webprofile</module>
Expand Down

0 comments on commit dfb66dc

Please sign in to comment.