Search in sources :

Example 26 with DependencyResolutionRequiredException

use of org.apache.maven.artifact.DependencyResolutionRequiredException in project kotlin by JetBrains.

the class K2JSCompilerMojo method configureSpecificCompilerArguments.

@Override
protected void configureSpecificCompilerArguments(@NotNull K2JSCompilerArguments arguments) throws MojoExecutionException {
    arguments.outputFile = outputFile;
    arguments.noStdlib = true;
    arguments.metaInfo = metaInfo;
    arguments.moduleKind = moduleKind;
    List<String> libraries = null;
    try {
        libraries = getKotlinJavascriptLibraryFiles();
    } catch (DependencyResolutionRequiredException e) {
        throw new MojoExecutionException("Unresolved dependencies", e);
    }
    getLog().debug("libraries: " + libraries);
    arguments.libraries = StringUtil.join(libraries, File.pathSeparator);
    arguments.sourceMap = sourceMap;
    Set<String> collector = getOutputDirectoriesCollector();
    if (outputFile != null) {
        collector.add(new File(outputFile).getParent());
    }
    if (metaInfo) {
        // fqname here because of J8 compatibility issues
        String output = com.google.common.base.Objects.firstNonNull(outputFile, "");
        String metaFile = StringsKt.substringBeforeLast(output, JavaScript.DOT_EXTENSION, output) + KotlinJavascriptMetadataUtils.META_JS_SUFFIX;
        collector.add(new File(metaFile).getParent());
    }
}
Also used : DependencyResolutionRequiredException(org.apache.maven.artifact.DependencyResolutionRequiredException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) File(java.io.File)

Example 27 with DependencyResolutionRequiredException

use of org.apache.maven.artifact.DependencyResolutionRequiredException in project maven-plugins by apache.

the class AbstractFixJavadocMojo method getProjectClassLoader.

/**
     * @return the classLoader for the given project using lazy instantiation.
     * @throws MojoExecutionException if any
     */
private ClassLoader getProjectClassLoader() throws MojoExecutionException {
    if (projectClassLoader == null) {
        List<String> classPath;
        try {
            classPath = getCompileClasspathElements(project);
        } catch (DependencyResolutionRequiredException e) {
            throw new MojoExecutionException("DependencyResolutionRequiredException: " + e.getMessage(), e);
        }
        List<URL> urls = new ArrayList<URL>(classPath.size());
        for (String filename : classPath) {
            try {
                urls.add(new File(filename).toURL());
            } catch (MalformedURLException e) {
                throw new MojoExecutionException("MalformedURLException: " + e.getMessage(), e);
            }
        }
        projectClassLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]), null);
    }
    return projectClassLoader;
}
Also used : MalformedURLException(java.net.MalformedURLException) DependencyResolutionRequiredException(org.apache.maven.artifact.DependencyResolutionRequiredException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) URLClassLoader(java.net.URLClassLoader) ArrayList(java.util.ArrayList) File(java.io.File) URL(java.net.URL)

Example 28 with DependencyResolutionRequiredException

use of org.apache.maven.artifact.DependencyResolutionRequiredException in project maven-plugins by apache.

the class AbstractJDepsMojo method addJDepsOptions.

protected void addJDepsOptions(Commandline cmd) throws MojoFailureException {
    if (dotOutput != null) {
        cmd.createArg().setValue("-dotoutput");
        cmd.createArg().setFile(dotOutput);
    }
    if (verbose != null) {
        if ("class".equals(verbose)) {
            cmd.createArg().setValue("-verbose:class");
        } else if ("package".equals(verbose)) {
            cmd.createArg().setValue("-verbose:package");
        } else {
            cmd.createArg().setValue("-v");
        }
    }
    try {
        cmd.createArg().setValue("-cp");
        cmd.createArg().setValue(getClassPath());
    } catch (DependencyResolutionRequiredException e) {
        throw new MojoFailureException(e.getMessage(), e);
    }
    if (include != null) {
        cmd.createArg().setValue("-include");
        cmd.createArg().setValue(include);
    }
    if (profile) {
        cmd.createArg().setValue("-P");
    }
    if (module) {
        cmd.createArg().setValue("-M");
    }
    if (apiOnly) {
        cmd.createArg().setValue("-apionly");
    }
    if (recursive) {
        cmd.createArg().setValue("-R");
    }
// cmd.createArg().setValue( "-version" );
}
Also used : DependencyResolutionRequiredException(org.apache.maven.artifact.DependencyResolutionRequiredException) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Example 29 with DependencyResolutionRequiredException

use of org.apache.maven.artifact.DependencyResolutionRequiredException in project siddhi by wso2.

the class MarkdownDocumentationGenerationMojo method execute.

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    // Finding the root maven project
    MavenProject rootMavenProject = mavenProject;
    while (rootMavenProject.getParent().getBasedir() != null) {
        rootMavenProject = rootMavenProject.getParent();
    }
    // Setting the relevant modules target directory if not set by user
    String moduleTargetPath;
    if (moduleTargetDirectory != null) {
        moduleTargetPath = moduleTargetDirectory.getAbsolutePath();
    } else {
        moduleTargetPath = mavenProject.getBuild().getDirectory();
    }
    // Setting the documentation output directory if not set by user
    String docGenBasePath;
    if (docGenBaseDirectory != null) {
        docGenBasePath = docGenBaseDirectory.getAbsolutePath();
    } else {
        docGenBasePath = rootMavenProject.getBasedir() + File.separator + Constants.DOCS_DIRECTORY;
    }
    // Setting the mkdocs config file path if not set by user
    if (mkdocsConfigFile == null) {
        mkdocsConfigFile = new File(rootMavenProject.getBasedir() + File.separator + Constants.MKDOCS_CONFIG_FILE_NAME + Constants.YAML_FILE_EXTENSION);
    }
    // Setting the readme file name if not set by user
    if (readmeFile == null) {
        readmeFile = new File(rootMavenProject.getBasedir() + File.separator + Constants.README_FILE_NAME + Constants.MARKDOWN_FILE_EXTENSION);
    }
    // Retrieving metadata
    List<NamespaceMetaData> namespaceMetaDataList;
    try {
        namespaceMetaDataList = DocumentationUtils.getExtensionMetaData(moduleTargetPath, mavenProject.getRuntimeClasspathElements(), getLog());
    } catch (DependencyResolutionRequiredException e) {
        throw new MojoFailureException("Unable to resolve dependencies of the project", e);
    }
    // Generating the documentation
    if (namespaceMetaDataList.size() > 0) {
        DocumentationUtils.generateDocumentation(namespaceMetaDataList, docGenBasePath, mavenProject.getVersion(), getLog());
    // DocumentationUtils.updateHeadingsInMarkdownFile(homePageTemplateFile, homePageFile,
    // rootMavenProject.getArtifactId(), mavenProject.getVersion(), namespaceMetaDataList);
    // DocumentationUtils.updateHeadingsInMarkdownFile(readmeFile, readmeFile, rootMavenProject.getArtifactId(),
    // mavenProject.getVersion(), namespaceMetaDataList);
    }
}
Also used : DependencyResolutionRequiredException(org.apache.maven.artifact.DependencyResolutionRequiredException) MavenProject(org.apache.maven.project.MavenProject) NamespaceMetaData(org.wso2.siddhi.doc.gen.commons.metadata.NamespaceMetaData) MojoFailureException(org.apache.maven.plugin.MojoFailureException) File(java.io.File)

Example 30 with DependencyResolutionRequiredException

use of org.apache.maven.artifact.DependencyResolutionRequiredException in project jsonschema2pojo by joelittlejohn.

the class CodeGenerationHelper method generate.

public static void generate(final URL schema, final String targetPackage, final Map<String, Object> configValues, final File outputDirectory) {
    try {
        @SuppressWarnings("serial") Jsonschema2PojoMojo pluginMojo = new TestableJsonschema2PojoMojo().configure(new HashMap<String, Object>() {

            {
                put("sourceDirectory", URLUtil.getFileFromURL(schema).getPath());
                put("outputDirectory", outputDirectory);
                put("project", getMockProject());
                put("targetPackage", targetPackage);
                putAll(configValues);
            }
        });
        pluginMojo.execute();
    } catch (MojoExecutionException | DependencyResolutionRequiredException e) {
        throw new RuntimeException(e);
    }
}
Also used : DependencyResolutionRequiredException(org.apache.maven.artifact.DependencyResolutionRequiredException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) JavaFileObject(javax.tools.JavaFileObject) Jsonschema2PojoMojo(org.jsonschema2pojo.maven.Jsonschema2PojoMojo)

Aggregations

DependencyResolutionRequiredException (org.apache.maven.artifact.DependencyResolutionRequiredException)37 File (java.io.File)25 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)16 IOException (java.io.IOException)12 ArchiverException (org.codehaus.plexus.archiver.ArchiverException)11 ManifestException (org.codehaus.plexus.archiver.jar.ManifestException)11 MavenArchiver (org.apache.maven.archiver.MavenArchiver)10 MojoFailureException (org.apache.maven.plugin.MojoFailureException)9 ArrayList (java.util.ArrayList)8 MavenProject (org.apache.maven.project.MavenProject)8 MalformedURLException (java.net.MalformedURLException)6 URLClassLoader (java.net.URLClassLoader)6 URL (java.net.URL)5 FileNotFoundException (java.io.FileNotFoundException)3 HashSet (java.util.HashSet)3 Resource (org.apache.maven.model.Resource)3 Path (org.apache.tools.ant.types.Path)3 NamespaceMetaData (io.siddhi.doc.gen.metadata.NamespaceMetaData)2 Path (java.nio.file.Path)2 List (java.util.List)2