|
75 | 75 | import org.jvnet.jaxb.maven.util.LocaleUtils;
|
76 | 76 | import org.jvnet.jaxb.maven.util.CollectionUtils.Function;
|
77 | 77 | import org.sonatype.plexus.build.incremental.BuildContext;
|
| 78 | +import org.sonatype.plexus.build.incremental.ThreadBuildContext; |
78 | 79 | import org.xml.sax.EntityResolver;
|
79 | 80 | import org.xml.sax.InputSource;
|
80 | 81 | import org.xml.sax.SAXException;
|
@@ -465,30 +466,37 @@ protected void doExecute() throws MojoExecutionException {
|
465 | 466 | if (getGrammars().isEmpty()) {
|
466 | 467 | getLog().warn("No schemas to compile. Skipping XJC execution. ");
|
467 | 468 | } else {
|
468 |
| - |
| 469 | + final boolean configurationPhase = this.getBuildContext() instanceof ThreadBuildContext |
| 470 | + && ThreadBuildContext.getContext().getClass().getName().endsWith("EclipseEmptyBuildContext"); |
469 | 471 | final O options = getOptionsFactory().createOptions(optionsConfiguration);
|
470 | 472 |
|
471 |
| - if (getForceRegenerate()) { |
472 |
| - getLog().warn("You are using forceRegenerate=true in your configuration.\n" |
473 |
| - + "This configuration setting is deprecated and not recommended " |
474 |
| - + "as it causes problems with incremental builds in IDEs.\n" |
475 |
| - + "Please refer to the following link for more information:\n" |
476 |
| - + "https://github.com/highsource/jaxb-tools/wiki/Do-Not-Use-forceRegenerate\n" |
477 |
| - + "Consider removing this setting from your plugin configuration.\n"); |
478 |
| - getLog().info("The [forceRegenerate] switch is turned on, XJC will be executed."); |
479 |
| - } else { |
480 |
| - final boolean isUpToDate = isUpToDate(); |
481 |
| - if (!isUpToDate) { |
482 |
| - getLog().info("Sources are not up-to-date, XJC (version " + getVersion().getRaw() + ") will be executed."); |
483 |
| - } else { |
484 |
| - getLog().info("Sources are up-to-date, XJC (version " + getVersion().getRaw() + ") will be skipped."); |
485 |
| - return; |
486 |
| - } |
487 |
| - } |
| 473 | + if (!configurationPhase) { |
| 474 | + if (getForceRegenerate()) { |
| 475 | + getLog().warn("You are using forceRegenerate=true in your configuration.\n" |
| 476 | + + "This configuration setting is deprecated and not recommended " |
| 477 | + + "as it causes problems with incremental builds in IDEs.\n" |
| 478 | + + "Please refer to the following link for more information:\n" |
| 479 | + + "https://github.com/highsource/jaxb-tools/wiki/Do-Not-Use-forceRegenerate\n" |
| 480 | + + "Consider removing this setting from your plugin configuration.\n"); |
| 481 | + getLog().info("The [forceRegenerate] switch is turned on, XJC will be executed."); |
| 482 | + } else { |
| 483 | + final boolean isUpToDate = isUpToDate(); |
| 484 | + if (!isUpToDate) { |
| 485 | + getLog().info("Sources are not up-to-date, XJC (version " + getVersion().getRaw() + ") will be executed."); |
| 486 | + } else { |
| 487 | + getLog().info("Sources are up-to-date, XJC (version " + getVersion().getRaw() + ") will be skipped."); |
| 488 | + return; |
| 489 | + } |
| 490 | + } |
| 491 | + } |
488 | 492 |
|
489 | 493 | setupDirectories();
|
490 |
| - doExecute(options); |
491 |
| - addIfExistsToEpisodeSchemaBindings(); |
| 494 | + if (!configurationPhase) { |
| 495 | + doExecute(options); |
| 496 | + addIfExistsToEpisodeSchemaBindings(); |
| 497 | + } else { |
| 498 | + getLog().info("Sources will not be generated since running in EclipseEmptyBuildContext, XJC will be skipped."); |
| 499 | + } |
492 | 500 | final BuildContext buildContext = getBuildContext();
|
493 | 501 | getLog().debug(MessageFormat.format("Refreshing the generated directory [{0}].",
|
494 | 502 | getGenerateDirectory().getAbsolutePath()));
|
|
0 commit comments