Skip to content

Commit

Permalink
HSEARCH-4928 Add relocation artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
marko-bekhta authored and yrodiere committed Sep 29, 2023
1 parent 29758bc commit c8efeef
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 44 deletions.
16 changes: 16 additions & 0 deletions bom/public/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@
<artifactId>hibernate-search-mapper-orm-outbox-polling</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Relocation artifacts: -->
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm-coordination-outbox-polling</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm-batch-jsr352-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm-batch-jsr352-jberet</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -43,23 +44,27 @@ 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." );
}
}
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 + "]" );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions build/parents/build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@
<artifactId>hibernate-search-mapper-orm-outbox-polling</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm-coordination-outbox-polling</artifactId>
<type>pom</type>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm-batch-jsr352-core</artifactId>
Expand Down
40 changes: 40 additions & 0 deletions build/parents/relocation/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate Search, full-text search for your domain model
~
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
-->
<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>org.hibernate.search</groupId>
<artifactId>hibernate-search-parent</artifactId>
<version>7.0.0-SNAPSHOT</version>
<relativePath>../../..</relativePath>
</parent>
<artifactId>hibernate-search-parent-relocation</artifactId>
<packaging>pom</packaging>

<name>Hibernate Search Parent POM for Relocation Artifacts</name>
<description>Common build configuration for all relocation artifacts</description>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<configuration>
<!-- Keep dependency management -->
<flattenMode>bom</flattenMode>
<pomElements>
<!-- But not properties, they are not useful in a bom -->
<properties>remove</properties>
<distributionManagement>keep</distributionManagement>
</pomElements>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
</sourcepath>
<docfilessubdirs>true</docfilessubdirs>
Expand Down
4 changes: 2 additions & 2 deletions distribution/src/main/assembly/dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>dist/mapper/orm/coordination-outbox-polling</outputDirectory>
<outputDirectory>dist/mapper/orm/outbox-polling</outputDirectory>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<useTransitiveDependencies>true</useTransitiveDependencies>
<useTransitiveFiltering>true</useTransitiveFiltering>
<useStrictFiltering>true</useStrictFiltering>
<includes>
<include>org.hibernate.search:hibernate-search-mapper-orm-coordination-outbox-polling</include>
<include>org.hibernate.search:hibernate-search-mapper-orm-outbox-polling</include>
</includes>
</dependencySet>
<dependencySet>
Expand Down
21 changes: 2 additions & 19 deletions mapper/orm-batch-jsr352/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-parent</artifactId>
<artifactId>hibernate-search-parent-relocation</artifactId>
<version>7.0.0-SNAPSHOT</version>
<relativePath>../../..</relativePath>
<relativePath>../../../build/parents/relocation</relativePath>
</parent>
<packaging>pom</packaging>
<artifactId>hibernate-search-mapper-orm-batch-jsr352-core</artifactId>
Expand All @@ -30,21 +30,4 @@
<artifactId>hibernate-search-mapper-orm-jakarta-batch-core</artifactId>
</relocation>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<configuration>
<!-- Keep dependency management -->
<flattenMode>bom</flattenMode>
<pomElements>
<!-- But not properties, they are not useful in a bom -->
<properties>remove</properties>
<distributionManagement>keep</distributionManagement>
</pomElements>
</configuration>
</plugin>
</plugins>
</build>
</project>
21 changes: 2 additions & 19 deletions mapper/orm-batch-jsr352/jberet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-parent</artifactId>
<artifactId>hibernate-search-parent-relocation</artifactId>
<version>7.0.0-SNAPSHOT</version>
<relativePath>../../..</relativePath>
<relativePath>../../../build/parents/relocation</relativePath>
</parent>
<packaging>pom</packaging>
<artifactId>hibernate-search-mapper-orm-batch-jsr352-jberet</artifactId>
Expand All @@ -30,21 +30,4 @@
<artifactId>hibernate-search-mapper-orm-jakarta-batch-jberet</artifactId>
</relocation>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<configuration>
<!-- Keep dependency management -->
<flattenMode>bom</flattenMode>
<pomElements>
<!-- But not properties, they are not useful in a bom -->
<properties>remove</properties>
<distributionManagement>keep</distributionManagement>
</pomElements>
</configuration>
</plugin>
</plugins>
</build>
</project>
33 changes: 33 additions & 0 deletions mapper/orm-coordination-outbox-polling/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate Search, full-text search for your domain model
~
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
-->
<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>org.hibernate.search</groupId>
<artifactId>hibernate-search-parent-relocation</artifactId>
<version>7.0.0-SNAPSHOT</version>
<relativePath>../../build/parents/relocation</relativePath>
</parent>
<packaging>pom</packaging>
<artifactId>hibernate-search-mapper-orm-coordination-outbox-polling</artifactId>

<name>Hibernate Search ORM Integration - Coordination - Outbox Polling (Relocation)</name>
<description>Hibernate ORM integration using outbox polling as coordination strategy</description>

<properties>
<!-- This is a publicly distributed module that should be published: -->
<deploy.skip>false</deploy.skip>
</properties>

<distributionManagement>
<relocation>
<artifactId>hibernate-search-mapper-orm-outbox-polling</artifactId>
</relocation>
</distributionManagement>
</project>
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@

<modules>
<module>bom/public</module>
<module>build/parents/relocation</module>
<module>build/parents/build</module>
<module>build/enforcer</module>
<module>build/config</module>
Expand All @@ -175,6 +176,7 @@
<module>mapper/pojo-standalone</module>
<module>mapper/orm</module>
<module>mapper/orm-outbox-polling</module>
<module>mapper/orm-coordination-outbox-polling</module>
<module>mapper/orm-batch-jsr352/core</module>
<module>mapper/orm-batch-jsr352/jberet</module>
<module>mapper/orm-jakarta-batch/core</module>
Expand Down

0 comments on commit c8efeef

Please sign in to comment.