public void execute()

in src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java [381:468]


    public void execute() throws MojoExecutionException {
        if (skip) {
            getLog().info("Skipping remote resources execution.");
            return;
        }

        if (encoding == null || encoding.isEmpty()) {
            getLog().warn("File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
                    + ", i.e. build is platform dependent!");
        }

        if (resolveScopes == null) {
            resolveScopes = new String[] {
                (this.includeScope == null || this.includeScope.isEmpty()) ? JavaScopes.TEST : this.includeScope
            };
        }

        if (supplementalModels == null) {
            File sups = new File(appendedResourcesDirectory, "supplemental-models.xml");
            if (sups.exists()) {
                try {
                    supplementalModels = new String[] {sups.toURI().toURL().toString()};
                } catch (MalformedURLException e) {
                    // ignore
                    getLog().debug("URL issue with supplemental-models.xml: " + e);
                }
            }
        }

        configureLocator();

        if (includeProjectProperties) {
            final Properties projectProperties = project.getProperties();
            for (Object key : projectProperties.keySet()) {
                properties.put(key.toString(), projectProperties.get(key).toString());
            }
        }

        ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
        try {
            validate();

            List<File> resourceBundleArtifacts = downloadBundles(resourceBundles);
            supplementModels = loadSupplements(supplementalModels);

            ClassLoader classLoader = initalizeClassloader(resourceBundleArtifacts);

            Thread.currentThread().setContextClassLoader(classLoader);

            velocity = new VelocityEngine();
            velocity.setProperty("resource.loaders", "classpath");
            velocity.setProperty("resource.loader.classpath.class", ClasspathResourceLoader.class.getName());
            velocity.init();

            VelocityContext context = buildVelocityContext(properties);

            processResourceBundles(classLoader, context);

            if (outputDirectory.exists()) {
                // ----------------------------------------------------------------------------
                // Push our newly generated resources directory into the MavenProject so that
                // these resources can be picked up by the process-resources phase.
                // ----------------------------------------------------------------------------
                Resource resource = new Resource();
                resource.setDirectory(outputDirectory.getAbsolutePath());
                // MRRESOURCES-61 handle main and test resources separately
                if (attachToMain) {
                    project.getResources().add(resource);
                }
                if (attachToTest) {
                    project.getTestResources().add(resource);
                }

                // ----------------------------------------------------------------------------
                // Write out archiver dot file
                // ----------------------------------------------------------------------------
                try {
                    File dotFile = new File(project.getBuild().getDirectory(), ".plxarc");
                    FileUtils.mkdir(dotFile.getParentFile().getAbsolutePath());
                    FileUtils.fileWrite(dotFile.getAbsolutePath(), outputDirectory.getName());
                } catch (IOException e) {
                    throw new MojoExecutionException("Error creating dot file for archiving instructions.", e);
                }
            }
        } finally {
            Thread.currentThread().setContextClassLoader(origLoader);
        }
    }