This repository was archived by the owner on Oct 30, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
it/projects/disabled-for-goal
main/java/com/lesfurets/maven/partial Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ invoker.name = TEST for goal
2+ invoker.goals = -e generate-sources -D partial.disableOnGoal =generate-sources
Original file line number Diff line number Diff line change 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 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5+ <modelVersion >4.0.0</modelVersion >
6+
7+ <modules >
8+ <module >child1</module >
9+ <module >child2</module >
10+ <module >child3</module >
11+ <module >child4</module >
12+ <module >child5</module >
13+ <module >child6</module >
14+ <module >child7</module >
15+ </modules >
16+
17+ <groupId >parent</groupId >
18+ <artifactId >parent</artifactId >
19+ <version >1.0-SNAPSHOT</version >
20+ <packaging >pom</packaging >
21+
22+ <build >
23+ <plugins >
24+ <plugin >
25+ <groupId >com.lesfurets</groupId >
26+ <artifactId >partial-build-plugin</artifactId >
27+ <version >@project.version@</version >
28+ <extensions >true</extensions >
29+ <configuration >
30+ <enabled >true</enabled >
31+ <uncommited >false</uncommited >
32+ <referenceBranch >refs/heads/develop</referenceBranch >
33+ <baseBranch >refs/heads/feature/1</baseBranch >
34+ </configuration >
35+ </plugin >
36+ </plugins >
37+ </build >
38+
39+ </project >
Original file line number Diff line number Diff line change 1+ import com.lesfurets.maven.partial.mocks.ITHelper
2+
3+ def testProjectBasedir = basedir as File
4+ def pbpBaseDir = sourceDir as String
5+ def pbpVersion = projectVersion as String
6+ new ITHelper (testProjectBasedir, pbpBaseDir, pbpVersion). setupTest()
7+
8+ return true
Original file line number Diff line number Diff line change 1+ import org.codehaus.plexus.util.FileUtils
2+
3+ def file = new File (basedir, " build.log" )
4+ String buildLog = FileUtils . fileRead(file)
5+
6+ boolean verified = true
7+ verified &= buildLog. contains(" subchild2" )
8+ verified &= buildLog. contains(" child3" )
9+ verified &= buildLog. contains(" child4" )
10+ verified &= buildLog. contains(" subchild41" )
11+
12+ verified &= buildLog. contains(" child1" )
13+ verified &= buildLog. contains(" child2" )
14+ verified &= buildLog. contains(" child5" )
15+ verified &= buildLog. contains(" child6" )
16+ verified &= buildLog. contains(" child7" )
17+ verified &= buildLog. contains(" subchild1" )
18+ verified &= buildLog. contains(" subchild42" )
19+ verified &= buildLog. contains(" parent" )
20+
21+ verified &= buildLog. contains(" Partial build was disable for goal: [generate-sources]" )
22+
23+ return verified;
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ public class Configuration {
4949 public final boolean ignoreAllReactorProjects ;
5050 public final boolean useNativeGit ;
5151 public final String rootDirectory ;
52+ public final List <String > disabledOnGoals ;
5253
5354 @ Inject
5455 public Configuration (MavenSession session ) throws IOException {
@@ -83,6 +84,7 @@ public Configuration(MavenSession session) throws IOException {
8384 buildAnywaysPattern = Property .buildAnyways .getValue ();
8485 buildAnywaysProjects = getBuildAnywaysProjects (session , buildAnywaysPattern );
8586 useNativeGit = Boolean .valueOf (Property .useNativeGit .getValue ());
87+ disabledOnGoals = separatePattern (Property .disableOnGoal .getValue ());
8688 rootDirectory = session .getExecutionRootDirectory ();
8789 } catch (Exception e ) {
8890 throw new RuntimeException (e );
Original file line number Diff line number Diff line change 33public enum Property {
44
55 enabled ("true" ),
6+ disableOnGoal ("" ),
67 repositorySshKey ("" ),
78 referenceBranch ("refs/remotes/origin/develop" ),
89 baseBranch ("HEAD" ),
Original file line number Diff line number Diff line change @@ -26,7 +26,9 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti
2626 logger .info (configuration .toString ());
2727
2828 try {
29- if (configuration .enabled ) {
29+ if (configuration .disabledOnGoals .stream ().anyMatch (disableForGoal -> session .getRequest ().getGoals ().contains (disableForGoal ))) {
30+ logger .info ("Partial build was disable for goal: " + configuration .disabledOnGoals );
31+ } else if (configuration .enabled ) {
3032 logger .info ("Starting Partial build..." );
3133 injector .getInstance (UnchangedProjectsRemover .class ).act ();
3234 } else {
You can’t perform that action at this time.
0 commit comments