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

se.somath.publisher.maven.plugin.PublisherMojo Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
package se.somath.publisher.maven.plugin;

import org.apache.maven.model.Build;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
import se.somath.publisher.Main;

import java.util.List;
import java.util.Map;

/**
 * @goal publish
 * @phase generate-resources
 */
public class PublisherMojo extends AbstractMojo {
    public void execute() throws MojoExecutionException {

        Map pluginContext = getPluginContext();
        MavenProject mavenProject = (MavenProject) pluginContext.get("project");
        Build build = mavenProject.getBuild();
        String targetDirectory = build.getDirectory();
        List resources = build.getResources();
        String sourceDirectory = resources.get(0).getDirectory();

        Main main = new Main();
        main.publish(sourceDirectory, targetDirectory);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy