Skip to content

Commit 564255f

Browse files
ejsmithclaude
andcommitted
Share test helpers as source instead of a published tests jar
FakeServer and TestClients move to exceptionless-core/src/testFixtures/java. Modules that need them add that directory as a test source through build-helper-maven-plugin, so exceptionless-core no longer attaches a tests jar that would be deployed to Maven Central. Spotless now formats every src/*/java directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 83ad220 commit 564255f

10 files changed

Lines changed: 67 additions & 62 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ unless you ask for them:
2121

2222
Test the Spring Boot starter against Spring Boot 4 with `-Pspring-boot-4`.
2323

24+
Test helpers shared between modules (`FakeServer`, `TestClients`) live in
25+
`exceptionless-core/src/testFixtures/java`. A module compiles them into its tests by declaring
26+
`build-helper-maven-plugin` in its `pom.xml`; they are not published.
27+
2428
## Guidelines
2529

2630
- `exceptionless-core` has **no runtime dependencies**. Keep it that way: use the JDK (`java.net.http`,

‎exceptionless-core/pom.xml‎

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -57,30 +57,8 @@
5757
</executions>
5858
</plugin>
5959
<plugin>
60-
<!-- Publishes the shared test helpers as exceptionless-core-tests.jar for the integration
61-
modules' tests. Only the helpers: the core tests and their resources (such as
62-
exceptionless.properties) must not leak onto other modules' test class paths. -->
63-
<groupId>org.apache.maven.plugins</groupId>
64-
<artifactId>maven-jar-plugin</artifactId>
65-
<executions>
66-
<execution>
67-
<id>test-jar</id>
68-
<goals>
69-
<goal>test-jar</goal>
70-
</goals>
71-
<configuration>
72-
<includes>
73-
<include>com/exceptionless/FakeServer*.class</include>
74-
<include>com/exceptionless/TestClients*.class</include>
75-
</includes>
76-
<archive>
77-
<manifestEntries>
78-
<Automatic-Module-Name>com.exceptionless.core.testing</Automatic-Module-Name>
79-
</manifestEntries>
80-
</archive>
81-
</configuration>
82-
</execution>
83-
</executions>
60+
<groupId>org.codehaus.mojo</groupId>
61+
<artifactId>build-helper-maven-plugin</artifactId>
8462
</plugin>
8563
<plugin>
8664
<groupId>org.apache.maven.plugins</groupId>

exceptionless-core/src/test/java/com/exceptionless/FakeServer.java renamed to exceptionless-core/src/testFixtures/java/com/exceptionless/FakeServer.java

File renamed without changes.

exceptionless-core/src/test/java/com/exceptionless/TestClients.java renamed to exceptionless-core/src/testFixtures/java/com/exceptionless/TestClients.java

File renamed without changes.

‎exceptionless-jul/pom.xml‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323
<artifactId>exceptionless-core</artifactId>
2424
</dependency>
2525

26-
<dependency>
27-
<groupId>com.exceptionless</groupId>
28-
<artifactId>exceptionless-core</artifactId>
29-
<type>test-jar</type>
30-
<scope>test</scope>
31-
</dependency>
3226
<dependency>
3327
<groupId>org.awaitility</groupId>
3428
<artifactId>awaitility</artifactId>
@@ -45,4 +39,13 @@
4539
<scope>test</scope>
4640
</dependency>
4741
</dependencies>
42+
43+
<build>
44+
<plugins>
45+
<plugin>
46+
<groupId>org.codehaus.mojo</groupId>
47+
<artifactId>build-helper-maven-plugin</artifactId>
48+
</plugin>
49+
</plugins>
50+
</build>
4851
</project>

‎exceptionless-log4j2/pom.xml‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@
3636
<scope>provided</scope>
3737
</dependency>
3838

39-
<dependency>
40-
<groupId>com.exceptionless</groupId>
41-
<artifactId>exceptionless-core</artifactId>
42-
<type>test-jar</type>
43-
<scope>test</scope>
44-
</dependency>
4539
<dependency>
4640
<groupId>org.awaitility</groupId>
4741
<artifactId>awaitility</artifactId>
@@ -80,6 +74,10 @@
8074
</compilerArgs>
8175
</configuration>
8276
</plugin>
77+
<plugin>
78+
<groupId>org.codehaus.mojo</groupId>
79+
<artifactId>build-helper-maven-plugin</artifactId>
80+
</plugin>
8381
</plugins>
8482
</build>
8583
</project>

‎exceptionless-logback/pom.xml‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@
3131
<scope>provided</scope>
3232
</dependency>
3333

34-
<dependency>
35-
<groupId>com.exceptionless</groupId>
36-
<artifactId>exceptionless-core</artifactId>
37-
<type>test-jar</type>
38-
<scope>test</scope>
39-
</dependency>
4034
<dependency>
4135
<groupId>org.awaitility</groupId>
4236
<artifactId>awaitility</artifactId>
@@ -53,4 +47,13 @@
5347
<scope>test</scope>
5448
</dependency>
5549
</dependencies>
50+
51+
<build>
52+
<plugins>
53+
<plugin>
54+
<groupId>org.codehaus.mojo</groupId>
55+
<artifactId>build-helper-maven-plugin</artifactId>
56+
</plugin>
57+
</plugins>
58+
</build>
5659
</project>

‎exceptionless-servlet/pom.xml‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@
3434
<scope>provided</scope>
3535
</dependency>
3636

37-
<dependency>
38-
<groupId>com.exceptionless</groupId>
39-
<artifactId>exceptionless-core</artifactId>
40-
<type>test-jar</type>
41-
<scope>test</scope>
42-
</dependency>
4337
<dependency>
4438
<groupId>org.awaitility</groupId>
4539
<artifactId>awaitility</artifactId>
@@ -62,4 +56,13 @@
6256
<scope>test</scope>
6357
</dependency>
6458
</dependencies>
59+
60+
<build>
61+
<plugins>
62+
<plugin>
63+
<groupId>org.codehaus.mojo</groupId>
64+
<artifactId>build-helper-maven-plugin</artifactId>
65+
</plugin>
66+
</plugins>
67+
</build>
6568
</project>

‎exceptionless-spring-boot-starter/pom.xml‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@
8484
<optional>true</optional>
8585
</dependency>
8686

87-
<dependency>
88-
<groupId>com.exceptionless</groupId>
89-
<artifactId>exceptionless-core</artifactId>
90-
<type>test-jar</type>
91-
<scope>test</scope>
92-
</dependency>
9387
<dependency>
9488
<groupId>org.springframework.boot</groupId>
9589
<artifactId>spring-boot-starter-test</artifactId>
@@ -142,6 +136,10 @@
142136
</annotationProcessorPaths>
143137
</configuration>
144138
</plugin>
139+
<plugin>
140+
<groupId>org.codehaus.mojo</groupId>
141+
<artifactId>build-helper-maven-plugin</artifactId>
142+
</plugin>
145143
</plugins>
146144
</build>
147145

‎pom.xml‎

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
<spotless-maven-plugin.version>3.10.4</spotless-maven-plugin.version>
101101
<google-java-format.version>1.35.0</google-java-format.version>
102102
<central-publishing-maven-plugin.version>0.9.0</central-publishing-maven-plugin.version>
103+
<build-helper-maven-plugin.version>3.6.2</build-helper-maven-plugin.version>
103104
</properties>
104105

105106
<dependencyManagement>
@@ -109,14 +110,6 @@
109110
<artifactId>exceptionless-core</artifactId>
110111
<version>${project.version}</version>
111112
</dependency>
112-
<dependency>
113-
<!-- Shared test helpers (FakeServer, TestClients); see exceptionless-core/pom.xml. -->
114-
<groupId>com.exceptionless</groupId>
115-
<artifactId>exceptionless-core</artifactId>
116-
<version>${project.version}</version>
117-
<type>test-jar</type>
118-
<scope>test</scope>
119-
</dependency>
120113
<dependency>
121114
<groupId>com.exceptionless</groupId>
122115
<artifactId>exceptionless-jul</artifactId>
@@ -257,6 +250,28 @@
257250
<artifactId>jacoco-maven-plugin</artifactId>
258251
<version>${jacoco-maven-plugin.version}</version>
259252
</plugin>
253+
<plugin>
254+
<!-- Compiles the shared test helpers (FakeServer, TestClients) into a module's tests.
255+
Modules opt in by declaring the plugin. Sharing the source instead of a test-jar
256+
keeps the helpers out of the published artifacts. -->
257+
<groupId>org.codehaus.mojo</groupId>
258+
<artifactId>build-helper-maven-plugin</artifactId>
259+
<version>${build-helper-maven-plugin.version}</version>
260+
<executions>
261+
<execution>
262+
<id>add-test-fixtures</id>
263+
<phase>generate-test-sources</phase>
264+
<goals>
265+
<goal>add-test-source</goal>
266+
</goals>
267+
<configuration>
268+
<sources>
269+
<source>${project.basedir}/../exceptionless-core/src/testFixtures/java</source>
270+
</sources>
271+
</configuration>
272+
</execution>
273+
</executions>
274+
</plugin>
260275
<plugin>
261276
<groupId>org.springframework.boot</groupId>
262277
<artifactId>spring-boot-maven-plugin</artifactId>
@@ -353,6 +368,9 @@
353368
<version>${spotless-maven-plugin.version}</version>
354369
<configuration>
355370
<java>
371+
<includes>
372+
<include>src/*/java/**/*.java</include>
373+
</includes>
356374
<googleJavaFormat>
357375
<version>${google-java-format.version}</version>
358376
</googleJavaFormat>

0 commit comments

Comments
 (0)