Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#502] fix for m2e runOnConfiguration will only setupDirectories and no more execute actual XJC #505

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import org.jvnet.jaxb.maven.util.LocaleUtils;
import org.jvnet.jaxb.maven.util.CollectionUtils.Function;
import org.sonatype.plexus.build.incremental.BuildContext;
import org.sonatype.plexus.build.incremental.ThreadBuildContext;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
Expand Down Expand Up @@ -465,30 +466,37 @@ protected void doExecute() throws MojoExecutionException {
if (getGrammars().isEmpty()) {
getLog().warn("No schemas to compile. Skipping XJC execution. ");
} else {

final boolean configurationPhase = this.getBuildContext() instanceof ThreadBuildContext
&& ThreadBuildContext.getContext().getClass().getName().endsWith("EclipseEmptyBuildContext");
final O options = getOptionsFactory().createOptions(optionsConfiguration);

if (getForceRegenerate()) {
getLog().warn("You are using forceRegenerate=true in your configuration.\n"
+ "This configuration setting is deprecated and not recommended "
+ "as it causes problems with incremental builds in IDEs.\n"
+ "Please refer to the following link for more information:\n"
+ "https://github.com/highsource/jaxb-tools/wiki/Do-Not-Use-forceRegenerate\n"
+ "Consider removing this setting from your plugin configuration.\n");
getLog().info("The [forceRegenerate] switch is turned on, XJC will be executed.");
} else {
final boolean isUpToDate = isUpToDate();
if (!isUpToDate) {
getLog().info("Sources are not up-to-date, XJC (version " + getVersion().getRaw() + ") will be executed.");
} else {
getLog().info("Sources are up-to-date, XJC (version " + getVersion().getRaw() + ") will be skipped.");
return;
}
}
if (!configurationPhase) {
if (getForceRegenerate()) {
getLog().warn("You are using forceRegenerate=true in your configuration.\n"
+ "This configuration setting is deprecated and not recommended "
+ "as it causes problems with incremental builds in IDEs.\n"
+ "Please refer to the following link for more information:\n"
+ "https://github.com/highsource/jaxb-tools/wiki/Do-Not-Use-forceRegenerate\n"
+ "Consider removing this setting from your plugin configuration.\n");
getLog().info("The [forceRegenerate] switch is turned on, XJC will be executed.");
} else {
final boolean isUpToDate = isUpToDate();
if (!isUpToDate) {
getLog().info("Sources are not up-to-date, XJC (version " + getVersion().getRaw() + ") will be executed.");
} else {
getLog().info("Sources are up-to-date, XJC (version " + getVersion().getRaw() + ") will be skipped.");
return;
}
}
}

setupDirectories();
doExecute(options);
addIfExistsToEpisodeSchemaBindings();
if (!configurationPhase) {
doExecute(options);
addIfExistsToEpisodeSchemaBindings();
} else {
getLog().info("Sources will not be generated since running in EclipseEmptyBuildContext, XJC will be skipped.");
}
final BuildContext buildContext = getBuildContext();
getLog().debug(MessageFormat.format("Refreshing the generated directory [{0}].",
getGenerateDirectory().getAbsolutePath()));
Expand Down
Loading