Skip to content

Commit 95f4d8a

Browse files
committed
HV-2142 Fix issue wit missing root project dir
Signed-off-by: marko-bekhta <marko.prykladna@gmail.com>
1 parent 4b4067f commit 95f4d8a

File tree

2 files changed

+39
-28
lines changed

2 files changed

+39
-28
lines changed

performance/pom.xml

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
<enforcer.skip>true</enforcer.skip>
2626
<deploy.skip>true</deploy.skip>
2727
<maven.javadoc.skip>true</maven.javadoc.skip>
28+
<!--
29+
The build-helper-maven-plugin is used to add Bean Validation 2.0 source folder to the BV implementations
30+
that are 2.0+. Since we are also using this plugin to parse versions in the root pom we want to control
31+
when the sources are added with this property:
32+
-->
33+
<add.bv2.sources.skip>true</add.bv2.sources.skip>
2834

2935
<!--
3036
Need to specify something, since the plugin cannot handle empty options. Using something which does not have
@@ -81,6 +87,7 @@
8187
<goal>add-source</goal>
8288
</goals>
8389
<configuration>
90+
<skipAddSource>${add.bv2.sources.skip}</skipAddSource>
8491
<sources>
8592
<source>${project.basedir}/src/main/java-bv2</source>
8693
</sources>
@@ -163,6 +170,7 @@
163170
<properties>
164171
<beanvalidation-impl.name>Hibernate Validator</beanvalidation-impl.name>
165172
<beanvalidation-impl.version>${project.version}</beanvalidation-impl.version>
173+
<add.bv2.sources.skip>false</add.bv2.sources.skip>
166174
</properties>
167175
<dependencies>
168176
<dependency>
@@ -183,15 +191,6 @@
183191
<artifactId>log4j</artifactId>
184192
</dependency>
185193
</dependencies>
186-
<!-- adding sources for BV 2.0 tests -->
187-
<build>
188-
<plugins>
189-
<plugin>
190-
<groupId>org.codehaus.mojo</groupId>
191-
<artifactId>build-helper-maven-plugin</artifactId>
192-
</plugin>
193-
</plugins>
194-
</build>
195194
</profile>
196195
<profile>
197196
<id>hv-6.1</id>
@@ -205,6 +204,7 @@
205204
<validation-api.version>2.0.1.Final</validation-api.version>
206205
<beanvalidation-impl.name>Hibernate Validator</beanvalidation-impl.name>
207206
<beanvalidation-impl.version>6.1.2.Final</beanvalidation-impl.version>
207+
<add.bv2.sources.skip>false</add.bv2.sources.skip>
208208
</properties>
209209
<dependencies>
210210
<dependency>
@@ -227,15 +227,6 @@
227227
<artifactId>log4j</artifactId>
228228
</dependency>
229229
</dependencies>
230-
<!-- adding sources for BV 2.0 tests -->
231-
<build>
232-
<plugins>
233-
<plugin>
234-
<groupId>org.codehaus.mojo</groupId>
235-
<artifactId>build-helper-maven-plugin</artifactId>
236-
</plugin>
237-
</plugins>
238-
</build>
239230
</profile>
240231
<profile>
241232
<id>hv-6.0</id>
@@ -249,6 +240,7 @@
249240
<validation-api.version>2.0.1.Final</validation-api.version>
250241
<beanvalidation-impl.name>Hibernate Validator</beanvalidation-impl.name>
251242
<beanvalidation-impl.version>6.0.19.Final</beanvalidation-impl.version>
243+
<add.bv2.sources.skip>false</add.bv2.sources.skip>
252244
</properties>
253245
<dependencies>
254246
<dependency>
@@ -271,15 +263,6 @@
271263
<artifactId>log4j</artifactId>
272264
</dependency>
273265
</dependencies>
274-
<!-- adding sources for BV 2.0 tests -->
275-
<build>
276-
<plugins>
277-
<plugin>
278-
<groupId>org.codehaus.mojo</groupId>
279-
<artifactId>build-helper-maven-plugin</artifactId>
280-
</plugin>
281-
</plugins>
282-
</build>
283266
</profile>
284267
<profile>
285268
<id>hv-5.4</id>

pom.xml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215

216216
<version.antrun.plugin>1.8</version.antrun.plugin>
217217
<version.assembly.plugin>3.4.2</version.assembly.plugin>
218-
<version.buildhelper.plugin>3.0.0</version.buildhelper.plugin>
218+
<version.buildhelper.plugin>3.6.1</version.buildhelper.plugin>
219219
<version.bundle.plugin>5.1.4</version.bundle.plugin>
220220
<version.checkstyle.plugin>3.1.1</version.checkstyle.plugin>
221221
<version.clean.plugin>3.0.0</version.clean.plugin>
@@ -312,6 +312,19 @@
312312
<maven.compiler.release>${java-version.main.release}</maven.compiler.release>
313313
<maven.compiler.testRelease>${java-version.test.release}</maven.compiler.testRelease>
314314

315+
<!--
316+
The absolute path to the root project directory.
317+
This property is set by the build-helper plugin.
318+
We initialize it to some crude, potentially wrong value,
319+
because the Sonar Maven plugin uses this property indirectly,
320+
but ignores any change made by other plugins.
321+
This default value is the best we can do without the help of a Maven plugin.
322+
323+
Useful resources:
324+
- https://www.mojohaus.org/build-helper-maven-plugin/rootlocation-mojo.html
325+
-->
326+
<rootProject.directory>${user.dir}</rootProject.directory>
327+
315328
<!-- Set empty default values to avoid Maven leaving property references (${...}) when it doesn't find a value -->
316329
<!-- Argument passed from the command line -->
317330
<surefire.jvm.args.commandline></surefire.jvm.args.commandline>
@@ -675,6 +688,21 @@
675688
<groupId>org.codehaus.mojo</groupId>
676689
<artifactId>flatten-maven-plugin</artifactId>
677690
</plugin>
691+
<plugin>
692+
<groupId>org.codehaus.mojo</groupId>
693+
<artifactId>build-helper-maven-plugin</artifactId>
694+
<executions>
695+
<execution>
696+
<id>set-root-location-property</id>
697+
<goals>
698+
<goal>rootlocation</goal>
699+
</goals>
700+
<configuration>
701+
<rootLocationProperty>rootProject.directory</rootLocationProperty>
702+
</configuration>
703+
</execution>
704+
</executions>
705+
</plugin>
678706
</plugins>
679707
<pluginManagement>
680708
<plugins>

0 commit comments

Comments
 (0)