Skip to content

Commit

Permalink
fix for multiple server restart and re deployment in maven
Browse files Browse the repository at this point in the history
Signed-off-by: Arun Venmany <[email protected]>
  • Loading branch information
arunvenmany-ibm committed Dec 19, 2024
1 parent de7429a commit 315e5c6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ private enum FileTrackMode {
private File modifiedSrcBuildFile;

protected boolean skipInstallFeature;
boolean compileMojoError;

public DevUtil(File buildDirectory, File serverDirectory, File sourceDirectory, File testSourceDirectory,
File configDirectory, File projectDirectory, File multiModuleProjectDirectory, List<File> resourceDirs, boolean changeOnDemandTestsAction,
Expand All @@ -451,7 +452,8 @@ public DevUtil(File buildDirectory, File serverDirectory, File sourceDirectory,
boolean skipDefaultPorts, JavaCompilerOptions compilerOptions, boolean keepTempContainerfile,
String mavenCacheLocation, List<ProjectModule> upstreamProjects, boolean recompileDependencies,
String packagingType, File buildFile, Map<String, List<String>> parentBuildFiles, boolean generateFeatures,
Set<String> compileArtifactPaths, Set<String> testArtifactPaths, List<Path> monitoredWebResourceDirs) {
Set<String> compileArtifactPaths, Set<String> testArtifactPaths, List<Path> monitoredWebResourceDirs,
boolean compileMojoError) {
this.buildDirectory = buildDirectory;
this.serverDirectory = serverDirectory;
this.sourceDirectory = sourceDirectory;
Expand Down Expand Up @@ -491,6 +493,7 @@ public DevUtil(File buildDirectory, File serverDirectory, File sourceDirectory,
this.containerfile = containerfile;
this.containerBuildContext = containerBuildContext;
this.containerRunOpts = containerRunOpts;
this.compileMojoError=compileMojoError;
if (projectDirectory != null) {
//Use Containerfile if it exists, but default to Dockerfile if both present or neither exist
File defaultDockerFile = new File(projectDirectory, "Dockerfile");
Expand Down Expand Up @@ -4021,15 +4024,25 @@ private void initWatchLoop() throws IOException {
// initial source and test compile of upstream projects
if (isMultiModuleProject()) {
for (ProjectModule project : upstreamProjects) {
triggerUpstreamModuleCompile(project, false);
if (compileMojoError) {
info("Recompile "+project.getProjectName()+ " due to an earlier compilation error");
triggerUpstreamModuleCompile(project, false);
} else {
info("Recompile skipped for "+project.getProjectName()+ " since earlier compilation is successful");
}
// build file tracking of upstream projects
lastBuildFileChange.put(project.getBuildFile(), System.currentTimeMillis());
}
}

// initial source and test compile
triggerMainModuleCompile(false);
// build file tracking of main project
if (compileMojoError) {
info("Recompile "+getProjectName()+ " due to an earlier compilation error");
triggerMainModuleCompile(false);
// build file tracking of main project
} else {
info("Recompile skipped for "+getProjectName()+ " since earlier compilation is successful");
}
lastBuildFileChange.put(buildFile, System.currentTimeMillis());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public DevTestUtil(File serverDirectory, File sourceDirectory, File testSourceDi
List<File> resourceDirs, List<Path> webResourceDirs, boolean hotTests, boolean skipTests) throws IOException {
super(temp.newFolder(), serverDirectory, sourceDirectory, testSourceDirectory, configDirectory, null, null,
resourceDirs, false, hotTests, skipTests, false, false, false, null, 30, 30, 5, 500, true, false, false, false,
false, null, null, null, 0, false, null, false, null, null, false, null, null, null, false, null, null, webResourceDirs);
false, null, null, null, 0, false, null, false, null, null, false, null, null, null, false, null, null, webResourceDirs,true);
}

public DevTestUtil(File serverDirectory, File buildDir) {
super(buildDir, serverDirectory, null, null, null, null, null,
null, false, false, false, false, false, false, null, 30, 30, 5, 500, true, false, false, false,
false, null, null, null, 0, false, null, false, null, null, false, null, null, null, false, null, null, null);
false, null, null, null, 0, false, null, false, null, null, false, null, null, null, false, null, null, null,true);
}

@Override
Expand Down

0 comments on commit 315e5c6

Please sign in to comment.