Execute

@exception MojoExecutionException Thrown if the plugin cant be executed
@exception MojoFailureException Thrown if there is an error
180049
@Override
   public void execute()  throws MojoExecutionException, MojoFailureException
   {
      ClassLoader oldCL = SecurityActions.getThreadContextClassLoader();
      try 
      {
         SecurityActions.setThreadContextClassLoader(SecurityActions.getClassLoader(ValidatorMojo.class));

         Validation.validate(getRarFile().toURI().toURL(), 
            getOutputDir(), getClasspath());
      }
      catch (Throwable t) 
      {
         t.printStackTrace();
      }
      finally
      {
         SecurityActions.setThreadContextClassLoader(oldCL);
      }
   }
1288056
public void execute() throws MojoExecutionException, MojoFailureException {
    try {
      Set<File> thriftFiles = findThriftFiles();

      final File outputDirectory = getOutputDirectory();
      ImmutableSet<File> outputFiles = findGeneratedFilesInDirectory(getOutputDirectory());

      Set<String> compileRoots = new HashSet<String>();
      compileRoots.add("scrooge");

      if (thriftFiles.isEmpty()) {
        getLog().info("No thrift files to compile.");
      } else if (checkStaleness && ((lastModified(thriftFiles) + staleMillis) < lastModified(outputFiles))) {
        getLog().info("Generated thrift files up to date, skipping compile.");
        attachFiles(compileRoots);
      } else {
        outputDirectory.mkdirs();

        // Quick fix to fix issues with two mvn installs in a row (ie no clean)
        cleanDirectory(outputDirectory);

        getLog().info(format("compiling thrift files %s with Scrooge", thriftFiles));
        synchronized(lock) {
          ScroogeRunner runner = new ScroogeRunner();
          Map<String, String> thriftNamespaceMap = new HashMap<String, String>();
          for (ThriftNamespaceMapping mapping : thriftNamespaceMappings) {
            thriftNamespaceMap.put(mapping.getFrom(), mapping.getTo());
          }

          // Include thrifts from resource as well.
          Set<File> includes = thriftIncludes;
          includes.add(getResourcesOutputDirectory());

          // Include thrift root
          final File thriftSourceRoot = getThriftSourceRoot();
          if (thriftSourceRoot != null && thriftSourceRoot.exists()) {
            includes.add(thriftSourceRoot);
          }

          runner.compile(
                  getLog(),
                  includeOutputDirectoryNamespace ? new File(outputDirectory, "scrooge") : outputDirectory,
                  thriftFiles,
                  includes,
                  thriftNamespaceMap,
                  language,
                  thriftOpts);
        }
        attachFiles(compileRoots);
      }
    } catch (IOException e) {
      throw new MojoExecutionException("An IO error occurred", e);
    }
  }
984873
public void execute()
        throws MojoExecutionException, MojoFailureException
    {
        if ( isSkipping() )
        {
            getLog().debug( "Skipping execution, as demanded by user." );
            return;
        }

        final ValidationErrorHandler errorHandler = new ValidationErrorHandler();
        if ( validationSets == null || validationSets.length == 0 )
        {
            throw new MojoFailureException( "No ValidationSets configured." );
        }
        checkCatalogHandling();

        Object oldProxySettings = activateProxy();
        try
        {
            Resolver resolver = getResolver();
            for ( int i = 0; i < validationSets.length; i++ )
            {
                ValidationSet validationSet = validationSets[i];
                resolver.setXincludeAware(validationSet.isValidating() );
                resolver.setValidating( validationSet.isValidating() );
                validate( resolver, validationSet ,errorHandler);
            }
            List<ValidationErrorHandler.ErrorRecord> errorRecords=errorHandler.getErrors();
            if (!errorRecords.isEmpty()){
                final StringBuffer message=new StringBuffer();
                for(ValidationErrorHandler.ErrorRecord error:errorRecords){
                    appendMessage(message,error);
                }
                if (errorHandler.getErrorCount()+errorHandler.getFatalCount()>0){
                    throw new MojoExecutionException( message.toString());
                }
                else{
                    getLog().warn(message.toString());
                }
            }
        }
        finally
        {
            passivateProxy( oldProxySettings );
        }
    }
877103
public void execute()
        throws MojoExecutionException, MojoFailureException
    {
        if ( isSkipping() )
        {
            getLog().debug( "Skipping execution, as demanded by user." );
            return;
        }

        if ( useDefaultFormatFileSet )
        {
            formatFileSets.add( FormatFileSet.getDefault( getBasedir(), encoding, indentSize ) );
        }
        if ( formatFileSets == null || formatFileSets.isEmpty() )
        {
            /* nothing to do */
            return;
        }

        ViolationCollector violationCollector = new ViolationCollector();

        int processedFileCount = 0;

        for ( FormatFileSet formatFileSet : formatFileSets )
        {
            String effectiveEncoding = formatFileSet.getEncoding();
            if ( effectiveEncoding == null )
            {
                effectiveEncoding = this.encoding;
            }
            String[] includedFiles = scan( formatFileSet );
            for ( String includedPath : includedFiles )
            {
                processedFileCount++;
                File file = new File( formatFileSet.getDirectory(), includedPath );
                check( file, effectiveEncoding, violationCollector );
                if ( getLog().isDebugEnabled() && !violationCollector.hasViolations( file ) )
                {
                    getLog().debug( "No XML formatting violations found in file " + file.getAbsolutePath() );
                }
            }
        }
        getLog().debug( "Checked the formatting of " + processedFileCount + " files" );

        if ( failOnFormatViolation && violationCollector.hasViolations() )
        {
            throw new MojoFailureException( "There are XML formatting violations. Check the above log for details." );
        }

    }
1194748
private void validate() throws MojoExecutionException {
		if ((file == null && libId == null) || (file != null && libId != null)) {
			getLog()
					.warn(
							"You specified <file> and <libId>.  The <libId> always wins.");
		}

		// check that COM target exists
		if (file != null && !file.exists()) {
			getLog().warn("Can't find file: " + file);
			throw new MojoExecutionException(
					"The native COM target file couldn't be found: " + file);
		}
	}
475579
public void execute() throws MojoExecutionException {
		synchronized (lock) {
			injectDependencyDefaults();
			resolveArtifacts();

			// Install project dependencies into classloader's class path
			// and execute xjc2.
			final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
			final ClassLoader classLoader = createClassLoader(currentClassLoader);
			Thread.currentThread().setContextClassLoader(classLoader);
			final Locale currentDefaultLocale = Locale.getDefault();
			try {
				final Locale locale = LocaleUtils.valueOf(getLocale());
				Locale.setDefault(locale);
				//
				doExecute();

			} finally {
				Locale.setDefault(currentDefaultLocale);
				// Set back the old classloader
				Thread.currentThread().setContextClassLoader(currentClassLoader);
			}
		}
	}
122289
@Override
    protected void doExecute() throws Exception {
        createOrUpdateFunctionApp();

        final FunctionApp app = getFunctionApp();
        if (app == null) {
            throw new MojoExecutionException(
                String.format("Failed to get the function app with name: %s", getAppName()));
        }

        final DeployTarget deployTarget = new DeployTarget(app, DeployTargetType.FUNCTION);

        info(DEPLOY_START);

        getArtifactHandler().publish(deployTarget);

        info(String.format(DEPLOY_FINISH, getAppName()));
    }
354058
public void execute ()
        throws MojoExecutionException
    {
        if (mapFile == null) mapFile = new File(base, "compmap.txt");
        if (actionDef == null) actionDef = new File(base, "actions.xml");

        ComponentBundler bundler = new ComponentBundler(mapFile, actionDef) {
            @Override protected boolean keepRawPngs () { return keepRawPngs; }
            @Override protected boolean uncompressed () { return false; }
            @Override protected void logInfo (String message) { getLog().info(message); }
            @Override protected void logWarn (String message) { getLog().warn(message); }
        };

        if (bundleDirectories == null) {
            bundleDirectories = findBundleDirs();
        }
        for (BundleDirectory bdir : bundleDirectories) {
            getLog().info("Processing " + bdir);
            File root = new File(base, bdir.root);

            // create the scanner
            DirectoryScanner scanner = new DirectoryScanner();
            scanner.setBasedir(new File(root, bdir.path));
            scanner.setIncludes(includes.toArray(new String[0]));
            scanner.setExcludes(excludes.toArray(new String[0]));
            scanner.scan();

            File targetDir = new File(targetBase, bdir.root);
            File target = new File(new File(targetDir, bdir.path), "components.jar");
            List<Tuple<File,List<String>>> sourceDirs = Lists.newArrayList();
            sourceDirs.add(Tuple.newTuple(scanner.getBasedir(),
                                          Arrays.asList(scanner.getIncludedFiles())));
            bundler.execute(root.getPath(), target, sourceDirs);
        }
    }
1374130
@Override
    public void execute()
            throws MojoExecutionException
    {
        if ( skip )
        {
            getLog().info( "Skipping JAR unsigning for file: " + jarPath.getAbsolutePath() );
            return;
        }
        if ( jarPath.isDirectory() )
        {
            for ( File jar : jarPath.listFiles() )
            {
                if ( JarSignerUtil.isZipFile( jar ) )
                {
                    signTool.unsign( jar, verbose );
                }
                else
                {
                    getLog().info( "Skipping JAR unsigning for file: " + jar.getAbsolutePath() );
                }
            }
        }
        else
        {
            signTool.unsign( this.jarPath, verbose );
        }
    }
711418
@Override
    public final void execute() throws MojoExecutionException, MojoFailureException {
        if (skipTests) {
            if (session.getGoals().contains("jmeter:gui")) {
                if (!"default-cli".equals(mojoExecution.getExecutionId()) && !"compile".equals(mojoExecution.getLifecyclePhase())) {
                    getLog().info("Performance tests are skipped.");

                    return;
                }
            } else {
                getLog().info("Performance tests are skipped.");

                return;
            }
        }

        if (useMavenProxy && proxyConfig == null) {
            loadMavenProxy();
        }

        doExecute();
    }
1051907
protected void runCheck() throws MojoExecutionException, MojoFailureException {
        try (Engine engine = initializeEngine()) {
            ExceptionCollection exCol = scanDependencies(engine);
            try {
                engine.analyzeDependencies();
            } catch (ExceptionCollection ex) {
                exCol = handleAnalysisExceptions(exCol, ex);
            }
            if (exCol == null || !exCol.isFatal()) {

                File outputDir = getCorrectOutputDirectory(this.getProject());
                if (outputDir == null) {
                    //in some regards we shouldn't be writing this, but we are anyway.
                    //we shouldn't write this because nothing is configured to generate this report.
                    outputDir = new File(this.getProject().getBuild().getDirectory());
                }
                try {
                    final MavenProject p = this.getProject();
                    engine.writeReports(p.getName(), p.getGroupId(), p.getArtifactId(), p.getVersion(), outputDir, getFormat());
                } catch (ReportException ex) {
                    if (exCol == null) {
                        exCol = new ExceptionCollection(ex);
                    } else {
                        exCol.addException(ex);
                    }
                    if (this.isFailOnError()) {
                        throw new MojoExecutionException("One or more exceptions occurred during dependency-check analysis", exCol);
                    } else {
                        getLog().debug("Error writing the report", ex);
                    }
                }
                showSummary(this.getProject(), engine.getDependencies());
                checkForFailure(engine.getDependencies());
                if (exCol != null && this.isFailOnError()) {
                    throw new MojoExecutionException("One or more exceptions occurred during dependency-check analysis", exCol);
                }
            }
        } catch (DatabaseException ex) {
            if (getLog().isDebugEnabled()) {
                getLog().debug("Database connection error", ex);
            }
            final String msg = "An exception occurred connecting to the local database. Please see the log file for more details.";
            if (this.isFailOnError()) {
                throw new MojoExecutionException(msg, ex);
            }
            getLog().error(msg, ex);
        } finally {
            getSettings().cleanup();
        }
    }
638390
public void execute() throws MojoExecutionException, MojoFailureException {
        try {
            final List<String> command = createCommand();
            checkWorkingDirectory();
            final int status = execute(command);
            if (failOnAnsibleError && status != 0){
                throw new MojoFailureException("Non-zero exit status returned");
            }
        } catch (IOException e) {
            throw new MojoExecutionException("Unable to run playbook", e);
        } catch (InterruptedException e) {
            throw new MojoExecutionException("Run interrupted", e);
        }
    }
22385
public void execute() throws MojoExecutionException, MojoFailureException {
        if (skip) {
            getLog().info("Not executing specifications.");
        } else {
            prepareReportsDir();
            prepareRunnerExecutors();
            printBanner();
            try {
                runAllTests();
            } finally {
                printFooter();
                for (TestResultsIndex testResultsIndex : testResultsIndexes.values()) {
                    testResultsIndex.dump();
                }
            }
            checkTestsResults();
        }
    }
609945
@Override
    public void execute() throws MojoExecutionException {
        if (wisdomDirectory != null) {
            getLog().info("Skipping the External Assets copy as we are using a remote Wisdom " +
                    "Server");
            removeFromWatching();
            return;
        }
        source = new File(basedir, ASSETS_SRC_DIR);
        destination = new File(getWisdomRootDirectory(), ASSETS_DIR);

        try {
            ResourceCopy.copyExternalAssets(this, filtering);
        } catch (IOException e) {
            throw new MojoExecutionException("Error during asset copy", e);
        }
    }
1236147
public void execute()
            throws MojoExecutionException {
        if (watchFilter == null) {
            removeFromWatching();
        }
        NPM.npm(this, name, version).execute(
                binary != null ? binary : name, arguments);
    }
374214
public void execute()
        throws MojoExecutionException, MojoFailureException
    {
        File jarFile = new File( outputDirectory, finalName + ".jar" );
        File origJarFile = new File( outputDirectory, finalName + "-b4gwt.jar" );
        if ( origJarFile.exists() )
        {
            if ( !origJarFile.delete() )
            {
                throw new MojoExecutionException( "Error removing " + origJarFile );
            }
        }
        if ( !jarFile.renameTo( origJarFile ) )
        {
            throw new MojoExecutionException( "Error renaming " + jarFile + " to " + origJarFile );
        }

        MavenArchiver archiver = new MavenArchiver();

        archiver.setArchiver( jarArchiver );
        archiver.setOutputFile( jarFile );
        archive.setForced( false );
        // It is already created by maven-jar-plugin
        archive.setAddMavenDescriptor( false );

        Collection<ResourceFile> files = getAllResourceFiles();
        try
        {

            // Avoid annoying messages in log "com/package/Ccc.java already added, skipping"
            List<String> jarExcludes = new Vector<String>();

            // Add Sources first since they may already be present in jar from previous run and changed.
            for ( ResourceFile file : files )
            {
                jarArchiver.addFile( new File( file.basedir, file.fileRelativeName ), file.fileRelativeName );
                jarExcludes.add( file.fileRelativeName );
            }

            // Add the context of original jar excluding resources that we just added base on GWT descriptors
            jarArchiver.addArchivedFileSet( origJarFile, null, jarExcludes.toArray( new String[jarExcludes.size()] ) );

            archiver.createArchive( session , getProject(), archive );
        }
        catch ( Exception e )
        {
            throw new MojoExecutionException( "Error assembling JAR", e );
        }

    }
32754
private void executeThis() throws MojoExecutionException {
        // Try to attach agent that will modify Surefire.
        if (AgentLoader.loadEkstaziAgent()) {
            // Prepare initial list of options and set property.
            System.setProperty(AbstractMojoInterceptor.ARGLINE_INTERNAL_PROP, prepareEkstaziOptions());
            // Find non affected classes and set property.
            List<String> nonAffectedClasses = computeNonAffectedClasses();
            System.setProperty(AbstractMojoInterceptor.EXCLUDES_INTERNAL_PROP, Arrays.toString(nonAffectedClasses.toArray(new String[0])));
        } else {
            throw new MojoExecutionException("Ekstazi cannot attach to the JVM, please specify Ekstazi 'restore' explicitly.");
        }
    }