Skip to content

Commit ccdbb79

Browse files
Restructures multi-module project
1 parent 9695236 commit ccdbb79

27 files changed

Lines changed: 265 additions & 128 deletions

File tree

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# maven-test-impact-plugin
2-
3-
**Run only the tests that matter.**
1+
![Selective Test Runner](docs/images/logo.png)
42

53
A Maven plugin that tracks which production classes each test touches at the bytecode level, then uses Git to detect what changed and runs only the affected tests. Zero annotations. Zero config changes to your tests. Just add the plugin and watch your feedback loop shrink.
64

@@ -169,9 +167,10 @@ cd maven-test-impact-plugin
169167
mvn clean verify
170168
```
171169

172-
This produces two artifacts:
170+
This produces three artifacts:
171+
- `selective-test-runner-core-1.0.0-SNAPSHOT.jar`: build-tool-agnostic core (agent, change detection, impact resolution, coverage persistence)
172+
- `selective-test-runner-core-1.0.0-SNAPSHOT-agent.jar`: the shaded agent JAR (ASM relocated) used as `-javaagent` in the forked Surefire JVM
173173
- `maven-test-impact-plugin-1.0.0-SNAPSHOT.jar`: the Maven plugin
174-
- `maven-test-impact-plugin-1.0.0-SNAPSHOT-agent.jar`: the shaded agent JAR (ASM relocated) used as `-javaagent` in the forked Surefire JVM
175174

176175
## Contributing
177176

@@ -186,14 +185,17 @@ Contributions are welcome! Here's how to get started:
186185
### Project structure
187186

188187
```
189-
src/main/java/io/github/testimpact/
188+
selective-test-runner-core/ # Build-tool-agnostic core
190189
agent/ # Java agent: instrumentation, coverage recording
191190
change/ # Git change detection, source-to-class resolution
192191
store/ # Coverage map persistence (JSON)
193192
resolve/ # Impact analysis, test selection logic
194-
mojo/ # Maven plugin goals (collect, select, report, invalidate)
195193
report/ # JSON + console report generation
196-
common/ # Shared utilities (reactor scope, paths, dump reader)
194+
common/ # Shared utilities (paths, dump reader)
195+
196+
maven-test-impact-plugin/ # Maven plugin (thin wrapper over core)
197+
mojo/ # Maven plugin goals (collect, select, report, invalidate)
198+
common/ # Maven-specific utilities (reactor scope)
197199
```
198200

199201
### Areas where help is appreciated

docs/images/logo.png

115 KB
Loading

maven-test-impact-plugin/pom.xml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
5+
http://maven.apache.org/xsd/maven-4.0.0.xsd">
6+
<modelVersion>4.0.0</modelVersion>
7+
8+
<parent>
9+
<groupId>io.github.testimpact</groupId>
10+
<artifactId>selective-test-runner</artifactId>
11+
<version>1.0.0-SNAPSHOT</version>
12+
</parent>
13+
14+
<artifactId>maven-test-impact-plugin</artifactId>
15+
<packaging>maven-plugin</packaging>
16+
17+
<name>Selective Test Runner :: Maven Plugin</name>
18+
<description>Maven plugin for selective test execution based on bytecode-level impact analysis.</description>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>io.github.testimpact</groupId>
23+
<artifactId>selective-test-runner-core</artifactId>
24+
</dependency>
25+
<dependency>
26+
<groupId>io.github.testimpact</groupId>
27+
<artifactId>selective-test-runner-core</artifactId>
28+
<classifier>agent</classifier>
29+
</dependency>
30+
31+
<dependency>
32+
<groupId>org.apache.maven</groupId>
33+
<artifactId>maven-plugin-api</artifactId>
34+
<scope>provided</scope>
35+
</dependency>
36+
<dependency>
37+
<groupId>org.apache.maven</groupId>
38+
<artifactId>maven-core</artifactId>
39+
<scope>provided</scope>
40+
</dependency>
41+
<dependency>
42+
<groupId>org.apache.maven.plugin-tools</groupId>
43+
<artifactId>maven-plugin-annotations</artifactId>
44+
<scope>provided</scope>
45+
</dependency>
46+
47+
<dependency>
48+
<groupId>org.junit.jupiter</groupId>
49+
<artifactId>junit-jupiter</artifactId>
50+
<scope>test</scope>
51+
</dependency>
52+
</dependencies>
53+
54+
<build>
55+
<plugins>
56+
<plugin>
57+
<groupId>org.apache.maven.plugins</groupId>
58+
<artifactId>maven-plugin-plugin</artifactId>
59+
<version>${maven.plugin.tools.version}</version>
60+
<configuration>
61+
<goalPrefix>test-impact</goalPrefix>
62+
</configuration>
63+
</plugin>
64+
</plugins>
65+
</build>
66+
</project>

src/main/java/io/github/testimpact/common/ReactorScope.java renamed to maven-test-impact-plugin/src/main/java/io/github/testimpact/common/ReactorScope.java

File renamed without changes.

src/main/java/io/github/testimpact/mojo/CollectMojo.java renamed to maven-test-impact-plugin/src/main/java/io/github/testimpact/mojo/CollectMojo.java

File renamed without changes.

src/main/java/io/github/testimpact/mojo/InvalidateMojo.java renamed to maven-test-impact-plugin/src/main/java/io/github/testimpact/mojo/InvalidateMojo.java

File renamed without changes.

src/main/java/io/github/testimpact/mojo/ReportMojo.java renamed to maven-test-impact-plugin/src/main/java/io/github/testimpact/mojo/ReportMojo.java

File renamed without changes.

src/main/java/io/github/testimpact/mojo/SelectMojo.java renamed to maven-test-impact-plugin/src/main/java/io/github/testimpact/mojo/SelectMojo.java

File renamed without changes.

src/test/java/io/github/testimpact/common/ReactorScopeTest.java renamed to maven-test-impact-plugin/src/test/java/io/github/testimpact/common/ReactorScopeTest.java

File renamed without changes.

pom.xml

Lines changed: 85 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@
66
<modelVersion>4.0.0</modelVersion>
77

88
<groupId>io.github.testimpact</groupId>
9-
<artifactId>maven-test-impact-plugin</artifactId>
9+
<artifactId>selective-test-runner</artifactId>
1010
<version>1.0.0-SNAPSHOT</version>
11-
<packaging>maven-plugin</packaging>
11+
<packaging>pom</packaging>
1212

13-
<name>maven-test-impact-plugin</name>
14-
<description>Run only the tests that matter: bytecode-level test impact analysis for Maven.</description>
13+
<name>Selective Test Runner</name>
14+
<description>Run only the tests that matter: bytecode-level test impact analysis.</description>
15+
16+
<modules>
17+
<module>selective-test-runner-core</module>
18+
<module>maven-test-impact-plugin</module>
19+
</modules>
1520

1621
<properties>
1722
<maven.compiler.source>11</maven.compiler.source>
@@ -24,143 +29,103 @@
2429
<asm.version>9.6</asm.version>
2530
<jgit.version>6.10.1.202505221210-r</jgit.version>
2631
<jackson.version>2.21.3</jackson.version>
32+
<junit.version>5.10.2</junit.version>
2733
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
2834
<maven-shade-plugin.version>3.5.1</maven-shade-plugin.version>
2935
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
3036
<spotless-maven-plugin.version>3.4.0</spotless-maven-plugin.version>
3137
</properties>
3238

33-
<dependencies>
34-
<dependency>
35-
<groupId>org.apache.maven</groupId>
36-
<artifactId>maven-plugin-api</artifactId>
37-
<version>${maven.plugin.api.version}</version>
38-
<scope>provided</scope>
39-
</dependency>
40-
<dependency>
41-
<groupId>org.apache.maven</groupId>
42-
<artifactId>maven-core</artifactId>
43-
<version>${maven.api.version}</version>
44-
<scope>provided</scope>
45-
</dependency>
46-
<dependency>
47-
<groupId>org.apache.maven.plugin-tools</groupId>
48-
<artifactId>maven-plugin-annotations</artifactId>
49-
<version>${maven.plugin.tools.version}</version>
50-
<scope>provided</scope>
51-
</dependency>
52-
53-
<dependency>
54-
<groupId>org.ow2.asm</groupId>
55-
<artifactId>asm</artifactId>
56-
<version>${asm.version}</version>
57-
</dependency>
58-
<dependency>
59-
<groupId>org.ow2.asm</groupId>
60-
<artifactId>asm-commons</artifactId>
61-
<version>${asm.version}</version>
62-
</dependency>
39+
<dependencyManagement>
40+
<dependencies>
41+
<dependency>
42+
<groupId>io.github.testimpact</groupId>
43+
<artifactId>selective-test-runner-core</artifactId>
44+
<version>${project.version}</version>
45+
</dependency>
46+
<dependency>
47+
<groupId>io.github.testimpact</groupId>
48+
<artifactId>selective-test-runner-core</artifactId>
49+
<version>${project.version}</version>
50+
<classifier>agent</classifier>
51+
</dependency>
6352

64-
<dependency>
65-
<groupId>org.eclipse.jgit</groupId>
66-
<artifactId>org.eclipse.jgit</artifactId>
67-
<version>${jgit.version}</version>
68-
</dependency>
53+
<dependency>
54+
<groupId>org.ow2.asm</groupId>
55+
<artifactId>asm</artifactId>
56+
<version>${asm.version}</version>
57+
</dependency>
58+
<dependency>
59+
<groupId>org.ow2.asm</groupId>
60+
<artifactId>asm-commons</artifactId>
61+
<version>${asm.version}</version>
62+
</dependency>
6963

70-
<dependency>
71-
<groupId>com.fasterxml.jackson.core</groupId>
72-
<artifactId>jackson-databind</artifactId>
73-
<version>${jackson.version}</version>
74-
</dependency>
64+
<dependency>
65+
<groupId>org.eclipse.jgit</groupId>
66+
<artifactId>org.eclipse.jgit</artifactId>
67+
<version>${jgit.version}</version>
68+
</dependency>
7569

76-
<dependency>
77-
<groupId>org.junit.jupiter</groupId>
78-
<artifactId>junit-jupiter</artifactId>
79-
<version>5.10.2</version>
80-
<scope>test</scope>
81-
</dependency>
82-
</dependencies>
70+
<dependency>
71+
<groupId>com.fasterxml.jackson.core</groupId>
72+
<artifactId>jackson-databind</artifactId>
73+
<version>${jackson.version}</version>
74+
</dependency>
8375

84-
<build>
85-
<plugins>
86-
<plugin>
87-
<groupId>org.apache.maven.plugins</groupId>
88-
<artifactId>maven-plugin-plugin</artifactId>
76+
<dependency>
77+
<groupId>org.apache.maven</groupId>
78+
<artifactId>maven-plugin-api</artifactId>
79+
<version>${maven.plugin.api.version}</version>
80+
</dependency>
81+
<dependency>
82+
<groupId>org.apache.maven</groupId>
83+
<artifactId>maven-core</artifactId>
84+
<version>${maven.api.version}</version>
85+
</dependency>
86+
<dependency>
87+
<groupId>org.apache.maven.plugin-tools</groupId>
88+
<artifactId>maven-plugin-annotations</artifactId>
8989
<version>${maven.plugin.tools.version}</version>
90-
<configuration>
91-
<goalPrefix>test-impact</goalPrefix>
92-
</configuration>
93-
</plugin>
90+
</dependency>
9491

95-
<plugin>
96-
<groupId>org.apache.maven.plugins</groupId>
97-
<artifactId>maven-jar-plugin</artifactId>
98-
<version>${maven-jar-plugin.version}</version>
99-
<configuration>
100-
<archive>
101-
<manifestEntries>
102-
<Premain-Class>io.github.testimpact.agent.CoverageAgent</Premain-Class>
103-
<Agent-Class>io.github.testimpact.agent.CoverageAgent</Agent-Class>
104-
<Can-Retransform-Classes>true</Can-Retransform-Classes>
105-
<Can-Redefine-Classes>true</Can-Redefine-Classes>
106-
</manifestEntries>
107-
</archive>
108-
</configuration>
109-
</plugin>
92+
<dependency>
93+
<groupId>org.junit.jupiter</groupId>
94+
<artifactId>junit-jupiter</artifactId>
95+
<version>${junit.version}</version>
96+
</dependency>
97+
</dependencies>
98+
</dependencyManagement>
11099

111-
<plugin>
112-
<groupId>org.apache.maven.plugins</groupId>
113-
<artifactId>maven-shade-plugin</artifactId>
114-
<version>${maven-shade-plugin.version}</version>
115-
<executions>
116-
<execution>
117-
<phase>package</phase>
118-
<goals><goal>shade</goal></goals>
119-
<configuration>
120-
<createDependencyReducedPom>false</createDependencyReducedPom>
121-
<shadedArtifactAttached>true</shadedArtifactAttached>
122-
<shadedClassifierName>agent</shadedClassifierName>
123-
<artifactSet>
124-
<includes>
125-
<include>org.ow2.asm:*</include>
126-
</includes>
127-
</artifactSet>
128-
<relocations>
129-
<relocation>
130-
<pattern>org.objectweb.asm</pattern>
131-
<shadedPattern>io.github.testimpact.shaded.asm</shadedPattern>
132-
</relocation>
133-
</relocations>
134-
<transformers>
135-
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
136-
<manifestEntries>
137-
<Premain-Class>io.github.testimpact.agent.CoverageAgent</Premain-Class>
138-
<Agent-Class>io.github.testimpact.agent.CoverageAgent</Agent-Class>
139-
<Can-Retransform-Classes>true</Can-Retransform-Classes>
140-
<Can-Redefine-Classes>true</Can-Redefine-Classes>
141-
</manifestEntries>
142-
</transformer>
143-
</transformers>
144-
</configuration>
145-
</execution>
146-
</executions>
147-
</plugin>
100+
<build>
101+
<pluginManagement>
102+
<plugins>
103+
<plugin>
104+
<groupId>org.apache.maven.plugins</groupId>
105+
<artifactId>maven-surefire-plugin</artifactId>
106+
<version>${maven-surefire-plugin.version}</version>
107+
</plugin>
108+
<plugin>
109+
<groupId>com.diffplug.spotless</groupId>
110+
<artifactId>spotless-maven-plugin</artifactId>
111+
<version>${spotless-maven-plugin.version}</version>
112+
<configuration>
113+
<java>
114+
<googleJavaFormat/>
115+
</java>
116+
</configuration>
117+
</plugin>
118+
</plugins>
119+
</pluginManagement>
148120

121+
<plugins>
149122
<plugin>
150123
<groupId>org.apache.maven.plugins</groupId>
151124
<artifactId>maven-surefire-plugin</artifactId>
152-
<version>${maven-surefire-plugin.version}</version>
153125
</plugin>
154-
155126
<plugin>
156127
<groupId>com.diffplug.spotless</groupId>
157128
<artifactId>spotless-maven-plugin</artifactId>
158-
<version>${spotless-maven-plugin.version}</version>
159-
<configuration>
160-
<java>
161-
<googleJavaFormat/>
162-
</java>
163-
</configuration>
164129
</plugin>
165130
</plugins>
166131
</build>

0 commit comments

Comments
 (0)