Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 213 additions & 0 deletions cf-java-logging-support-servlet-jakarta/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
<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>

<artifactId>cf-java-logging-support-servlet-jakarta</artifactId>
<packaging>jar</packaging>

<name>cf-java-logging-support-servlet-jakarta</name>
<parent>
<groupId>com.sap.hcp.cf.logging</groupId>
<artifactId>cf-java-logging-support-parent</artifactId>
<version>3.6.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

<properties>
<servlet.api.version>5.0.0</servlet.api.version>
<maven-dependency-plugin.version>3.5.0</maven-dependency-plugin.version>
<build-helper-maven-plugin.version>3.3.0</build-helper-maven-plugin.version>
<jetty.version>11.0.13</jetty.version>
</properties>

<dependencies>
<!-- servlet api -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${servlet.api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sap.hcp.cf.logging</groupId>
<artifactId>cf-java-logging-support-core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- we need our logback implementation for testing! -->
<dependency>
<groupId>com.sap.hcp.cf.logging</groupId>
<artifactId>cf-java-logging-support-logback</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<scope>test</scope>
</dependency>
<!-- Library for token signing/verification -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>${java-jwt.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>

<!-- testing -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<id>unpack</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>cf-java-logging-support-servlet</artifactId>
<version>${project.version}</version>
<type>jar</type>
Comment on lines +99 to +102
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the benefit of building and using a jar compared to accessing the folder directly? The code will always be built together, won't it?

Copy link
Contributor Author

@mofterdinger mofterdinger Feb 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The benefit is from my point of view, that the maven-dependency-plugin does the job to provide and extract the source code. We don't have to care about the project structure to find the sources and copy them into this module. I assume this can be also done, but I don't know how to do this with maven.

<classifier>sources</classifier>
<overWrite>false</overWrite>
<outputDirectory>target/generated-sources/java</outputDirectory>
<includes>**/*.java</includes>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>cf-java-logging-support-servlet</artifactId>
<version>${project.version}</version>
<type>jar</type>
<classifier>test-sources</classifier>
<overWrite>false</overWrite>
<outputDirectory>target/generated-test-sources/java</outputDirectory>
<includes>**/*.java</includes>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>cf-java-logging-support-servlet</artifactId>
<version>${project.version}</version>
<type>jar</type>
<classifier>test-sources</classifier>
<overWrite>false</overWrite>
<outputDirectory>target/generated-test-sources/resources</outputDirectory>
<includes>**/logback-test.xml</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build-helper-maven-plugin.version}</version>
<executions>
<execution>
<id>add-generated-sources</id>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-generated-test-sources</id>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-test-sources/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-generated-test-resources</id>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>target/generated-test-sources/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-sources</phase>
<configuration>
<tasks>
<!-- replace javax.servlet with jakarta.servlet in generated-sources -->
<replace dir="target/generated-sources/java"
token="javax.servlet" value="jakarta.servlet">
<include name="**/*.java" />
</replace>
<!-- replace javax.servlet with jakarta.servlet in generated-test-sources -->
<replace dir="target/generated-test-sources/java"
token="javax.servlet" value="jakarta.servlet">
<include name="**/*.java" />
</replace>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>

</plugins>
</build>
</project>
29 changes: 23 additions & 6 deletions cf-java-logging-support-servlet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<properties>
<servlet.api.version>3.1.0</servlet.api.version>
<jetty.version>9.4.49.v20220914</jetty.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -47,33 +48,49 @@
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.18.2</version>
<version>${java-jwt.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.4.1</version>
<version>${jackson-databind.version}</version>
</dependency>

<!-- testing -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.4.49.v20220914</version>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>9.4.49.v20220914</version>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
<version>${httpclient.version}</version>
<scope>test</scope>
</dependency>

</dependencies>
</project>

<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
Comment on lines +88 to +89
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this created more artefacts, that will be uploaded to Maven Central. Note, that in the parent pom.xml, there is the "ossrh" profile, that creates, signs and uploads the artefacts. This already contains a maven-source-plugin. Do you have an idea, how these two configurations interact?

Copy link
Contributor Author

@mofterdinger mofterdinger Feb 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could be right, that could really a problem. If you have look into the target folder of this module, it contains 2 additional jars. Can somehow control which artifacts are uploaded to Maven central? Do you have something like an artifact or module list? To be honest I'm not familiar with this upload.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the publishing. It almost looks fine, but for the jar, that contains the sources. It does not exists, since its execution phase is so early in the Maven lifecycle, that all the actions for providing the correct code come afterwards. I will add the required configuration, once this PR is merged. Without a sources jar, Maven Central would reject this project.

</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,17 @@
<javadoc.plugin.version>3.1.1</javadoc.plugin.version>
<gpg.plugin.version>1.6</gpg.plugin.version>
<maven.compiler.release>8</maven.compiler.release>
<java-jwt.version>3.18.2</java-jwt.version>
<jackson-databind.version>2.13.4.1</jackson-databind.version>
<httpclient.version>4.5.13</httpclient.version>
</properties>

<modules>
<module>cf-java-logging-support-core</module>
<module>cf-java-logging-support-logback</module>
<module>cf-java-logging-support-log4j2</module>
<module>cf-java-logging-support-servlet</module>
<module>cf-java-logging-support-servlet-jakarta</module>
<module>cf-java-logging-support-jersey</module>
<module>cf-java-monitoring-custom-metrics-clients</module>
<module>sample</module>
Expand Down