|
10 | 10 |
|
11 | 11 | import java.io.File; |
12 | 12 | import java.io.IOException; |
| 13 | +import java.io.OutputStream; |
13 | 14 | import java.util.ArrayList; |
14 | 15 | import java.util.Arrays; |
15 | 16 | import java.util.Collection; |
16 | 17 | import java.util.List; |
17 | | -import java.util.Map; |
18 | 18 | import java.util.Set; |
19 | 19 | import java.util.regex.Matcher; |
20 | 20 | import java.util.regex.Pattern; |
|
33 | 33 | import org.eclipse.core.runtime.Path; |
34 | 34 | import org.eclipse.m2e.core.MavenPlugin; |
35 | 35 | import org.eclipse.m2e.core.embedder.IMaven; |
36 | | -import org.eclipse.m2e.core.internal.builder.MavenBuilderImpl; |
37 | | -import org.eclipse.m2e.core.internal.builder.plexusbuildapi.EclipseBuildContext; |
38 | 36 | import org.eclipse.m2e.core.project.IMavenProjectFacade; |
39 | 37 | import org.eclipse.m2e.core.project.MavenProjectUtils; |
40 | 38 | import org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant; |
@@ -93,8 +91,7 @@ public Set<IProject> build(int kind, IProgressMonitor monitor) |
93 | 91 | if (isPomModified() || interestingFileChangeDetected(includedFiles, WRO4J_FILES_PATTERN)) { |
94 | 92 | //treat as new full build as wro4j only checks for classic resources changes during incremental builds |
95 | 93 | IProject project = getMavenProjectFacade().getProject(); |
96 | | - Map<String, Object> contextMap = (Map<String, Object>) project.getSessionProperty(MavenBuilderImpl.BUILD_CONTEXT_KEY); |
97 | | - currentBuildContext = new EclipseBuildContext(project, contextMap); |
| 94 | + currentBuildContext = new CleanBuildContext(originalBuildContext); |
98 | 95 | } else if (!interestingFileChangeDetected(includedFiles, WEB_RESOURCES_PATTERN)) { |
99 | 96 | return null; |
100 | 97 | } |
@@ -330,4 +327,81 @@ private boolean notCleanFullBuild(int kind) { |
330 | 327 | && IncrementalProjectBuilder.CLEAN_BUILD != kind; |
331 | 328 | } |
332 | 329 |
|
| 330 | + private static class CleanBuildContext implements BuildContext { |
| 331 | + |
| 332 | + private BuildContext originalContext; |
| 333 | + |
| 334 | + CleanBuildContext(BuildContext originalContext) { |
| 335 | + this.originalContext = originalContext; |
| 336 | + } |
| 337 | + |
| 338 | + public boolean hasDelta(String relpath) { |
| 339 | + return true; |
| 340 | + } |
| 341 | + |
| 342 | + public boolean hasDelta(File file) { |
| 343 | + return true; |
| 344 | + } |
| 345 | + |
| 346 | + public boolean hasDelta(List relpaths) { |
| 347 | + return true; |
| 348 | + } |
| 349 | + |
| 350 | + public void refresh(File file) { |
| 351 | + originalContext.refresh(file); |
| 352 | + } |
| 353 | + |
| 354 | + public OutputStream newFileOutputStream(File file) throws IOException { |
| 355 | + return originalContext.newFileOutputStream(file); |
| 356 | + } |
| 357 | + |
| 358 | + public Scanner newScanner(File basedir) { |
| 359 | + return originalContext.newScanner(basedir); |
| 360 | + } |
| 361 | + |
| 362 | + public Scanner newDeleteScanner(File basedir) { |
| 363 | + return originalContext.newDeleteScanner(basedir); |
| 364 | + } |
| 365 | + |
| 366 | + public Scanner newScanner(File basedir, boolean ignoreDelta) { |
| 367 | + return originalContext.newScanner(basedir, ignoreDelta); |
| 368 | + } |
| 369 | + |
| 370 | + public boolean isIncremental() { |
| 371 | + return false; |
| 372 | + } |
| 373 | + |
| 374 | + public void setValue(String key, Object value) { |
| 375 | + originalContext.setValue(key, value); |
| 376 | + } |
| 377 | + |
| 378 | + public Object getValue(String key) { |
| 379 | + return originalContext.getValue(key); |
| 380 | + } |
| 381 | + |
| 382 | + public void addWarning(File file, int line, int column, String message, |
| 383 | + Throwable cause) { |
| 384 | + originalContext.addWarning(file, line, column, message, cause); |
| 385 | + } |
| 386 | + |
| 387 | + public void addError(File file, int line, int column, String message, |
| 388 | + Throwable cause) { |
| 389 | + originalContext.addError(file, line, column, message, cause); |
| 390 | + } |
| 391 | + |
| 392 | + public void addMessage(File file, int line, int column, String message, |
| 393 | + int severity, Throwable cause) { |
| 394 | + originalContext.addMessage(file, line, column, message, severity, cause); |
| 395 | + } |
| 396 | + |
| 397 | + public void removeMessages(File file) { |
| 398 | + originalContext.removeMessages(file); |
| 399 | + } |
| 400 | + |
| 401 | + public boolean isUptodate(File target, File source) { |
| 402 | + return false; |
| 403 | + } |
| 404 | + |
| 405 | + } |
| 406 | + |
333 | 407 | } |
0 commit comments