All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sealights.agents.plugin.BldScanrMojo Maven / Gradle / Ivy

There is a newer version: 4.0.1125
Show newest version
package io.sealights.agents.plugin;

import java.util.Map;

import org.apache.maven.plugins.annotations.Mojo;

import io.sealights.onpremise.agents.java.agent.infra.constants.SLProperties;
import io.sealights.onpremise.agents.java.agent.plugins.engine.api.PluginParameters;

/**
 * Runs the Build Scanner.
 *
 * @phase process-classes
 * @goal build-scanner
 * @threadSafe
 * @since 1.0.0
 */
@Mojo(name = "scanner")
public class BldScanrMojo extends SeaLightsMojo {


    /**
     * Flag to enable exit with non zero error code in case of scanning failure.
     *
     * @parameter property="enableNoneZeroErrorCode" default-value="false"
     */
    private boolean enableNoneZeroErrorCode;

    /**
     * If set, run over the packagesincluded property.
     *
     * @parameter property="buildScannerPackagesincluded"
     */
    private String buildScannerPackagesincluded;

    /**
     * If set, run over the packagesexcluded property.
     *
     * @parameter property="buildScannerPackagesexcluded"
     */
    private String buildScannerPackagesexcluded;

    /**
     * Jvm params for buildScanner.
     *
     * @parameter property="buildScannerParams"
     *
     * */
    private Map buildScannerParams;

    /**
     * Send contributor details for advanced committer reports and features.
     *
     * @parameter property="sendContributors"
     */
    private Boolean sendContributors;
    
	/**
	 * Flag to disable build scanner logs in spite of common logEnabled=true
	 *
	 * @parameter property="buildScannerIgnoreLogEnabled" default-value="false"
	 */
    private boolean buildScannerIgnoreLogEnabled;
    
 	@Override
	public PluginParameters getParams() {
		PluginParameters params = getGenParams();
		params.getBldScanrParams().setEnableNoneZeroErrorCode(enableNoneZeroErrorCode);
		params.getBldScanrParams().setBuildScannerPackagesincluded(buildScannerPackagesincluded);
		params.getBldScanrParams().setBuildScannerPackagesexcluded(buildScannerPackagesexcluded);
		params.getBldScanrParams().setBuildScannerParams(buildScannerParams);
		params.getBldScanrParams().setSendContributors(sendContributors);
		params.getBldScanrParams().setBuildScannerIgnoreLogEnabled(buildScannerIgnoreLogEnabled);
		return params;
	}
 	
 	@Override
	public boolean initGoalInternals() {
		return super.initGoalInternals();
	}

	@Override
 	protected boolean executePluginGoal() {
		MavenEventsListener.INSTANCE.notifyBuildScannerMojoInvoked();
 		setBldScanrPathSysProperty();
 		return getPluginEngine().executeBldScanrGoal(this).isOk();
 	}
 	
 	@Override
 	public String getName() {
 		return "build scanner";
 	}

    private void setBldScanrPathSysProperty(){
        if(getProject() !=null && getProject().getProperties() != null) {
            getProject().getProperties().setProperty(SLProperties.PATH_TO_BUILD_SCANNER, getExecData().getBldScanrLocation());
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy