From c8efeefc6bd8e4d0ad1ddfaf85943f68e496c5f4 Mon Sep 17 00:00:00 2001 From: marko-bekhta Date: Mon, 25 Sep 2023 17:19:21 +0200 Subject: [PATCH] HSEARCH-4928 Add relocation artifact --- bom/public/pom.xml | 16 ++++++++ ...agementIncludesAllPublicArtifactsRule.java | 9 ++++- .../build/enforcer/MavenProjectUtils.java | 9 ++++- build/parents/build/pom.xml | 6 +++ build/parents/relocation/pom.xml | 40 +++++++++++++++++++ distribution/pom.xml | 2 +- distribution/src/main/assembly/dist.xml | 4 +- mapper/orm-batch-jsr352/core/pom.xml | 21 +--------- mapper/orm-batch-jsr352/jberet/pom.xml | 21 +--------- .../orm-coordination-outbox-polling/pom.xml | 33 +++++++++++++++ pom.xml | 2 + 11 files changed, 119 insertions(+), 44 deletions(-) create mode 100644 build/parents/relocation/pom.xml create mode 100644 mapper/orm-coordination-outbox-polling/pom.xml diff --git a/bom/public/pom.xml b/bom/public/pom.xml index 2195245d1fc..b5a08dc22ec 100644 --- a/bom/public/pom.xml +++ b/bom/public/pom.xml @@ -87,6 +87,22 @@ hibernate-search-mapper-orm-outbox-polling ${project.version} + + + org.hibernate.search + hibernate-search-mapper-orm-coordination-outbox-polling + ${project.version} + + + org.hibernate.search + hibernate-search-mapper-orm-batch-jsr352-core + ${project.version} + + + org.hibernate.search + hibernate-search-mapper-orm-batch-jsr352-jberet + ${project.version} + diff --git a/build/enforcer/src/main/java/org/hibernate/search/build/enforcer/DependencyManagementIncludesAllPublicArtifactsRule.java b/build/enforcer/src/main/java/org/hibernate/search/build/enforcer/DependencyManagementIncludesAllPublicArtifactsRule.java index 62935be66a3..0748dbd5d49 100644 --- a/build/enforcer/src/main/java/org/hibernate/search/build/enforcer/DependencyManagementIncludesAllPublicArtifactsRule.java +++ b/build/enforcer/src/main/java/org/hibernate/search/build/enforcer/DependencyManagementIncludesAllPublicArtifactsRule.java @@ -8,6 +8,7 @@ import static org.hibernate.search.build.enforcer.MavenProjectUtils.DEPLOY_SKIP; import static org.hibernate.search.build.enforcer.MavenProjectUtils.isAnyParentPublicParent; +import static org.hibernate.search.build.enforcer.MavenProjectUtils.isAnyParentRelocationParent; import static org.hibernate.search.build.enforcer.MavenProjectUtils.isProjectDeploySkipped; import java.util.ArrayList; @@ -43,11 +44,13 @@ public void execute() throws EnforcerRuleException { for ( MavenProject project : session.getAllProjects() ) { boolean publicParent = isAnyParentPublicParent( project ); + boolean relocationParent = isAnyParentRelocationParent( project ); + boolean shouldBePublished = publicParent || relocationParent; boolean deploySkipped = isProjectDeploySkipped( project ); if ( dependencies.remove( project.getArtifactId() ) == null ) { // The project is NOT in the dependencies - if ( publicParent && !deploySkipped ) { + if ( shouldBePublished && !deploySkipped ) { problems.add( "`" + project.getGroupId() + ":" + project.getArtifactId() + "` is missing from the dependency management section." ); } @@ -55,11 +58,13 @@ public void execute() throws EnforcerRuleException { else { // The project IS in the dependencies - if ( !publicParent || deploySkipped ) { + if ( !shouldBePublished || deploySkipped ) { problems.add( "`" + project.getGroupId() + ":" + project.getArtifactId() + "` either is misconfigured, or it is not published so it should not be in the dependency management section:" + " [parents include '" + MavenProjectUtils.HIBERNATE_SEARCH_PARENT_PUBLIC + "' = " + publicParent + + " [parents include '" + MavenProjectUtils.HIBERNATE_SEARCH_PARENT_RELOCATION + + "' = " + relocationParent + ", Maven property '" + DEPLOY_SKIP + "' = " + deploySkipped + "]" ); } diff --git a/build/enforcer/src/main/java/org/hibernate/search/build/enforcer/MavenProjectUtils.java b/build/enforcer/src/main/java/org/hibernate/search/build/enforcer/MavenProjectUtils.java index 49773322650..49cc8c72b41 100644 --- a/build/enforcer/src/main/java/org/hibernate/search/build/enforcer/MavenProjectUtils.java +++ b/build/enforcer/src/main/java/org/hibernate/search/build/enforcer/MavenProjectUtils.java @@ -12,6 +12,7 @@ public class MavenProjectUtils { public static final String HIBERNATE_SEARCH_PARENT_PUBLIC = "hibernate-search-parent-public"; public static final String HIBERNATE_SEARCH_PARENT_INTEGRATION_TEST = "hibernate-search-parent-integrationtest"; + public static final String HIBERNATE_SEARCH_PARENT_RELOCATION = "hibernate-search-parent-relocation"; public static final String DEPLOY_SKIP = "deploy.skip"; private MavenProjectUtils() { @@ -20,7 +21,13 @@ private MavenProjectUtils() { public static boolean isAnyParentPublicParent(MavenProject project) { return project.hasParent() && ( HIBERNATE_SEARCH_PARENT_PUBLIC.equals( project.getParent().getArtifactId() ) - || isAnyParentPublicParent( project.getParent() ) ); + || isAnyParentPublicParent( project.getParent() ) ); + } + + public static boolean isAnyParentRelocationParent(MavenProject project) { + return project.hasParent() + && ( HIBERNATE_SEARCH_PARENT_RELOCATION.equals( project.getParent().getArtifactId() ) + || isAnyParentRelocationParent( project.getParent() ) ); } public static boolean isAnyParentIntegrationTestParent(MavenProject project) { diff --git a/build/parents/build/pom.xml b/build/parents/build/pom.xml index 534a458c82d..6062c558a30 100644 --- a/build/parents/build/pom.xml +++ b/build/parents/build/pom.xml @@ -326,6 +326,12 @@ hibernate-search-mapper-orm-outbox-polling ${project.version} + + org.hibernate.search + hibernate-search-mapper-orm-coordination-outbox-polling + pom + ${project.version} + org.hibernate.search hibernate-search-mapper-orm-batch-jsr352-core diff --git a/build/parents/relocation/pom.xml b/build/parents/relocation/pom.xml new file mode 100644 index 00000000000..51c829a26a9 --- /dev/null +++ b/build/parents/relocation/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + org.hibernate.search + hibernate-search-parent + 7.0.0-SNAPSHOT + ../../.. + + hibernate-search-parent-relocation + pom + + Hibernate Search Parent POM for Relocation Artifacts + Common build configuration for all relocation artifacts + + + + + org.codehaus.mojo + flatten-maven-plugin + + + bom + + + remove + keep + + + + + + diff --git a/distribution/pom.xml b/distribution/pom.xml index 8881a67e54e..106db9fd498 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -171,7 +171,7 @@ ${basedir}/../backend/elasticsearch-aws/src/main/java; ${basedir}/../backend/lucene/src/main/java; ${basedir}/../mapper/lucene/src/main/java; - ${basedir}/../mapper/orm-coordination-outbox-polling/src/main/java; + ${basedir}/../mapper/orm-outbox-polling/src/main/java; ${basedir}/../mapper/orm-jakarta-batch/core/src/main/java; true diff --git a/distribution/src/main/assembly/dist.xml b/distribution/src/main/assembly/dist.xml index 109faad9de6..383e46632ab 100644 --- a/distribution/src/main/assembly/dist.xml +++ b/distribution/src/main/assembly/dist.xml @@ -107,14 +107,14 @@ - dist/mapper/orm/coordination-outbox-polling + dist/mapper/orm/outbox-polling runtime false true true true - org.hibernate.search:hibernate-search-mapper-orm-coordination-outbox-polling + org.hibernate.search:hibernate-search-mapper-orm-outbox-polling diff --git a/mapper/orm-batch-jsr352/core/pom.xml b/mapper/orm-batch-jsr352/core/pom.xml index 66241ea79e7..b349b3f44c0 100644 --- a/mapper/orm-batch-jsr352/core/pom.xml +++ b/mapper/orm-batch-jsr352/core/pom.xml @@ -10,9 +10,9 @@ 4.0.0 org.hibernate.search - hibernate-search-parent + hibernate-search-parent-relocation 7.0.0-SNAPSHOT - ../../.. + ../../../build/parents/relocation pom hibernate-search-mapper-orm-batch-jsr352-core @@ -30,21 +30,4 @@ hibernate-search-mapper-orm-jakarta-batch-core - - - - org.codehaus.mojo - flatten-maven-plugin - - - bom - - - remove - keep - - - - - diff --git a/mapper/orm-batch-jsr352/jberet/pom.xml b/mapper/orm-batch-jsr352/jberet/pom.xml index 152286478e5..1807d9a72de 100644 --- a/mapper/orm-batch-jsr352/jberet/pom.xml +++ b/mapper/orm-batch-jsr352/jberet/pom.xml @@ -10,9 +10,9 @@ 4.0.0 org.hibernate.search - hibernate-search-parent + hibernate-search-parent-relocation 7.0.0-SNAPSHOT - ../../.. + ../../../build/parents/relocation pom hibernate-search-mapper-orm-batch-jsr352-jberet @@ -30,21 +30,4 @@ hibernate-search-mapper-orm-jakarta-batch-jberet - - - - org.codehaus.mojo - flatten-maven-plugin - - - bom - - - remove - keep - - - - - diff --git a/mapper/orm-coordination-outbox-polling/pom.xml b/mapper/orm-coordination-outbox-polling/pom.xml new file mode 100644 index 00000000000..02db56d6c6b --- /dev/null +++ b/mapper/orm-coordination-outbox-polling/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + org.hibernate.search + hibernate-search-parent-relocation + 7.0.0-SNAPSHOT + ../../build/parents/relocation + + pom + hibernate-search-mapper-orm-coordination-outbox-polling + + Hibernate Search ORM Integration - Coordination - Outbox Polling (Relocation) + Hibernate ORM integration using outbox polling as coordination strategy + + + + false + + + + + hibernate-search-mapper-orm-outbox-polling + + + diff --git a/pom.xml b/pom.xml index db96f30d94d..555ccd553e4 100644 --- a/pom.xml +++ b/pom.xml @@ -159,6 +159,7 @@ bom/public + build/parents/relocation build/parents/build build/enforcer build/config @@ -175,6 +176,7 @@ mapper/pojo-standalone mapper/orm mapper/orm-outbox-polling + mapper/orm-coordination-outbox-polling mapper/orm-batch-jsr352/core mapper/orm-batch-jsr352/jberet mapper/orm-jakarta-batch/core