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());
}
}
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;
}
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" );
}
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);
}
}
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);
}
}
Aggregations