Skip to content

Commit

Permalink
Add ability to skip the extension from running with autojdk.skip prop…
Browse files Browse the repository at this point in the history
…erty.
  • Loading branch information
causalnet committed May 17, 2024
1 parent da61ac5 commit 4f5eea4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public abstract class AbstractAutoJdkMojo extends AbstractMojo
static final String PROPERTY_JDK_VERSION = "autojdk.jdk.version";
static final String PROPERTY_JDK_RELEASE_TYPE = "autojdk.jdk.releaseType";
static final String PROPERTY_AUTOJDK_CONFIGURATION_FILE = "autojdk.config.file";
static final String PROPERTY_AUTOJDK_SKIP = "autojdk.skip";

@Component
private RepositorySystem repositorySystem;
Expand Down Expand Up @@ -86,7 +87,7 @@ public abstract class AbstractAutoJdkMojo extends AbstractMojo
/**
* If true, skip execution of autojdk plugin.
*/
@Parameter(property="autojdk.skip", defaultValue = "false")
@Parameter(property=PROPERTY_AUTOJDK_SKIP, defaultValue = "false")
protected boolean skip;

private AutoJdk autoJdk;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ public class AutoJdkExtensionProperties
private final String jdkVendor;
private final String jdkVersion;
private final Path autoJdkConfigFile;
private final Boolean skip;

public AutoJdkExtensionProperties(String jdkVendor, String jdkVersion, Path autoJdkConfigFile)
public AutoJdkExtensionProperties(String jdkVendor, String jdkVersion, Path autoJdkConfigFile, Boolean skip)
{
this.jdkVendor = jdkVendor;
this.jdkVersion = jdkVersion;
this.autoJdkConfigFile = autoJdkConfigFile;
this.skip = skip;
}

/**
Expand All @@ -37,8 +39,9 @@ public static AutoJdkExtensionProperties fromMavenSession(MavenSession session)
{
String vendor = (String) evaluator.evaluate("${" + PrepareMojo.PROPERTY_JDK_VENDOR + "}", String.class);
String version = (String) evaluator.evaluate("${" + PrepareMojo.PROPERTY_JDK_VERSION + "}", String.class);
String autoJdkConfigFile = (String) evaluator.evaluate("${" + PrepareMojo.PROPERTY_AUTOJDK_CONFIGURATION_FILE + "}", File.class);
return new AutoJdkExtensionProperties(vendor, version, autoJdkConfigFile == null ? null : Paths.get(autoJdkConfigFile));
String autoJdkConfigFile = (String) evaluator.evaluate("${" + PrepareMojo.PROPERTY_AUTOJDK_CONFIGURATION_FILE + "}", File.class); //TODO check this
boolean skip = Boolean.parseBoolean((String) evaluator.evaluate("${" + PrepareMojo.PROPERTY_AUTOJDK_SKIP + "}", Boolean.class));
return new AutoJdkExtensionProperties(vendor, version, autoJdkConfigFile == null ? null : Paths.get(autoJdkConfigFile), skip);
}
catch (ExpressionEvaluationException e)
{
Expand Down

0 comments on commit 4f5eea4

Please sign in to comment.