Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ logs
# Maven version backups
*/*.xml.versionsBackup

# Generated by maven-shade-plugin for repackaging modules
*/dependency-reduced-pom.xml

# The following files are generated/updated by vaadin-maven-plugin
*/node_modules/
*/frontend/generated/
Expand Down
5 changes: 0 additions & 5 deletions datamanager-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,6 @@
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>life.qbic</groupId>
<artifactId>openbis-api</artifactId>
<classifier>r1700646105</classifier>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions datamanager-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
<artifactId>project-management-infrastructure</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>life.qbic.datamanager</groupId>
<artifactId>openbis-api-clean</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>life.qbic.datamanager</groupId>
<artifactId>subscription-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package life.qbic.domain.concepts;

import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.time.Instant;

Expand All @@ -14,6 +14,7 @@
*/
public abstract class DomainEvent implements Serializable {

@JsonProperty("occurredOn")
protected final Instant occurredOn;

protected DomainEvent() {
Expand All @@ -26,7 +27,6 @@ protected DomainEvent() {
* @return the instant the of event creation.
*/

@JsonGetter("occurredOn")
public Instant occurredOn() {
return occurredOn;
}
Expand Down
13 changes: 6 additions & 7 deletions identity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,10 @@
<artifactId>application-commons</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-2-bom.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jobrunr</groupId>
<artifactId>jobrunr</artifactId>
Expand All @@ -85,6 +79,11 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
</dependency>


</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
package life.qbic.identity.domain.user.event

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.json.JsonMapper
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import life.qbic.identity.domain.event.UserRegistered
import spock.lang.Specification
import tools.jackson.databind.ObjectMapper

class UserRegisteredEventSpec extends Specification {

def "Ensure serialisation and deserialisation"() {
given:
UserRegistered userRegistered = UserRegistered.create("1234", "Sven", "sven.fillinger@test.de")
ObjectMapper objectMapper = new ObjectMapper();

when:
ObjectMapper objectMapper = JsonMapper.builder().addModule(new JavaTimeModule()).build()
String json = objectMapper.writeValueAsString(userRegistered)
UserRegistered deserialised = objectMapper.readValue(json, UserRegistered)

Expand Down
167 changes: 167 additions & 0 deletions openbis-api-clean/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<?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>
<parent>
<groupId>life.qbic.datamanager</groupId>
<artifactId>datamanager</artifactId>
<version>1.15.0</version>
</parent>

<artifactId>openbis-api-clean</artifactId>
<name>OpenBIS API (de-collided)</name>
<description>
Repackaging of the upstream life.qbic:openbis-api shaded uber-jar that relocates bundled
third-party packages into a private namespace.

Rationale: the upstream artifact is a shaded uber-jar that bundles old (2017-era) copies of
third-party libraries under the same fully-qualified names as the real runtime dependencies.
Depending on classpath ordering these collide with the real libraries. Relocating them to
life.qbic.openbis.shaded.* rewrites both the bundled class files and the references inside the
openbis client classes, so openbis keeps behaving exactly as before while the real libraries
remain the single source of those types at compile time and runtime.
</description>

<dependencies>
<!--
Input of the relocation only. It is marked optional and removed from the reduced
published POM, so consumers never see the upstream shaded jar again - they receive just the
relocated openbis classes and rely on the real libraries for third-party types.
-->
<dependency>
<groupId>life.qbic</groupId>
<artifactId>openbis-api</artifactId>
<version>20.10.7.3</version>
<classifier>r1700646105</classifier>
<optional>true</optional>
</dependency>
</dependencies>

<build>
<plugins>
<!--
Only build the (initially empty) jar during the compile phase so maven-shade-plugin can
relocate the openbis dependency into it, then unpack it into target/classes. The default
package-phase 'default-jar' execution is disabled, otherwise it would try to re-create the
already-shaded main artifact at package time and fail with
"You have to use a classifier to attach supplemental artifacts ...".
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>default-jar-early</id>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>

<!--
Relocate the bundled third-party packages into a private namespace. Runs during the compile
phase so 'mvn compile' and other modules in the same reactor see the relocated classes in
target/classes (a package-only shade is invisible to same-reactor consumers).
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<relocations>
<!--
Move the bundled Spring (compiled against javax.servlet, incl. the
org.springframework.web.WebApplicationInitializer that collides with the real Spring
Framework 7 / Jakarta version) into a private namespace.
-->
<relocation>
<pattern>org.springframework</pattern>
<shadedPattern>life.qbic.openbis.shaded.org.springframework</shadedPattern>
</relocation>
<!-- Move the bundled Apache commons/http/etc. into a private namespace so it cannot
shadow the real Apache commons libraries on the classpath. -->
<relocation>
<pattern>org.apache</pattern>
<shadedPattern>life.qbic.openbis.shaded.org.apache</shadedPattern>
</relocation>
<!-- Move the bundled old AspectJ into a private namespace so it cannot collide with the
real aspectjweaver pulled in via Spring AOP. -->
<relocation>
<pattern>org.aspectj</pattern>
<shadedPattern>life.qbic.openbis.shaded.org.aspectj</shadedPattern>
</relocation>
<!-- Move the bundled Eclipse classes (e.g. EclipseLink/ASM helpers) into a private
namespace so they cannot collide with Eclipse/JAXB classes on the classpath. -->
<relocation>
<pattern>org.eclipse</pattern>
<shadedPattern>life.qbic.openbis.shaded.org.eclipse</shadedPattern>
</relocation>
<!-- Move the bundled old slf4j into a private namespace so it cannot shadow the real
slf4j-api that the application logging facade is built against. -->
<relocation>
<pattern>org.slf4j</pattern>
<shadedPattern>life.qbic.openbis.shaded.org.slf4j</shadedPattern>
</relocation>
<!-- Move the bundled AOP Alliance into a private namespace so it cannot collide with the
org.aopalliance provided by Spring AOP. -->
<relocation>
<pattern>org.aopalliance</pattern>
<shadedPattern>life.qbic.openbis.shaded.org.aopalliance</shadedPattern>
</relocation>
<!-- Move the bundled old Jackson into a private namespace so it cannot shadow the real
com.fasterxml.jackson pulled in via Spring Boot / ro-crate. -->
<relocation>
<pattern>com.fasterxml</pattern>
<shadedPattern>life.qbic.openbis.shaded.com.fasterxml</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
<executions>
<execution>
<id>relocate</id>
<phase>compile</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Unpack the relocated jar into target/classes so same-reactor modules find the classes. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>unpack-relocated</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<unzip src="${project.build.directory}/${project.build.finalName}.jar"
dest="${project.build.outputDirectory}"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<module>domain-concept</module>
<module>identity-api</module>
<module>identity-infrastructure</module>
<module>openbis-api-clean</module>
<module>project-management-infrastructure</module>
<module>email-service-provider</module>
<module>finances-infrastructure</module>
Expand Down
16 changes: 13 additions & 3 deletions project-management-infrastructure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
<artifactId>logging</artifactId>
</dependency>
<dependency>
<groupId>life.qbic</groupId>
<artifactId>openbis-api</artifactId>
<classifier>r1700646105</classifier>
<groupId>life.qbic.datamanager</groupId>
<artifactId>openbis-api-clean</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand Down Expand Up @@ -98,6 +97,17 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-jackson</artifactId>
</dependency>
<!--
ro-crate-java brings jackson-databind with runtime scope only; the module's own code calls
into ro-crate-java APIs that expose com.fasterxml.jackson.databind.JsonNode, so jackson-databind
must be available on the compile classpath. (Previously this was satisfied by the bundled
jackson inside the shaded upstream openbis-api jar; after de-colliding openbis that jackson is
no longer on the classpath.)
-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- needed for ror creation-->
<dependency>
<groupId>jakarta.xml.bind</groupId>
Expand Down
Loading