当前位置: 首页>>代码示例>>Java>>正文


Java DependencyResolutionRequiredException类代码示例

本文整理汇总了Java中org.apache.maven.artifact.DependencyResolutionRequiredException的典型用法代码示例。如果您正苦于以下问题:Java DependencyResolutionRequiredException类的具体用法?Java DependencyResolutionRequiredException怎么用?Java DependencyResolutionRequiredException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DependencyResolutionRequiredException类属于org.apache.maven.artifact包,在下文中一共展示了DependencyResolutionRequiredException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: collectClasspaths

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
private static Set<String> collectClasspaths(Project prj) throws DependencyResolutionRequiredException {
    Set<String> toRet = new HashSet<String>();
    NbMavenProject watcher = prj.getLookup().lookup(NbMavenProject.class);
    MavenProject mproject = watcher.getMavenProject();
    //TODO this ought to be really configurable based on what class gets debugged.
    toRet.addAll(mproject.getTestClasspathElements());
    //for poms also include all module projects recursively..
    boolean isPom = NbMavenProject.TYPE_POM.equals(watcher.getPackagingType());
    if (isPom) {
        ProjectContainerProvider subs = prj.getLookup().lookup(ProjectContainerProvider.class);
        ProjectContainerProvider.Result res = subs.getContainedProjects();
        for (Project pr : res.getProjects()) {
            toRet.addAll(collectClasspaths(pr));
        }
    }
    return toRet;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:Utils.java

示例2: execute

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {

    MetricFilterPublisher publisher =
            dryRun ? new DryRunMetricFilterPublisher(getLog()) : new CloudwatchMetricFilterPublisher(getLog());

    // Get a map of fully-namespaced metric names mapped to the metric fields in classes that extend LambdaMetricSet
    Map<String, Field> metricFields = new HashMap<>();
    try {
        metricFields.putAll(new MetricsFinder(project).find());
    } catch (DependencyResolutionRequiredException | MalformedURLException e) {
        throw new MojoExecutionException("Could not scan classpath for metric fields", e);
    }

    if (!metricFields.isEmpty()) {
        getLog().info(String.format("Found [%d] metric fields in classpath.", metricFields.size()));

        int removed = publisher.removeMetricFilters(getMetricFilters(metricFields));
        getLog().info(String.format("Removed [%d] metric filters.", removed));
    } else {
        getLog().warn("Did not find any metric fields in classpath.");
    }

}
 
开发者ID:symphoniacloud,项目名称:lambda-monitoring,代码行数:25,代码来源:RemoveMetricFiltersMojo.java

示例3: createForkedRunner

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
private ForkedRunner createForkedRunner() throws MojoExecutionException {

        try {

            if (this.project == null) {
                this.getLog().error("this.project is null");
            }

            return new ForkedRunner(getLog(), NewSubstepsExecutionConfig.getJmxPort(), NewSubstepsExecutionConfig.getVMArgs(), this.project.getTestClasspathElements(),
                    this.stepImplementationArtifacts, this.artifactResolver, this.artifactFactory,
                    this.projectBuilder, this.localRepository, this.remoteRepositories,
                    this.artifactMetadataSource);
        } catch (final DependencyResolutionRequiredException e) {

            throw new MojoExecutionException("Unable to resolve dependencies", e);
        }
    }
 
开发者ID:Substeps,项目名称:substeps-framework,代码行数:18,代码来源:SubstepsRunnerMojo.java

示例4: execute

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
	List<String> compiledCodeDirectoriesToInstrument = new ArrayList<>();
	compiledCodeDirectoriesToInstrument.add(project.getBuild().getOutputDirectory());

	if (additionalApplicationClasspathElements != null) {
		compiledCodeDirectoriesToInstrument.addAll(additionalApplicationClasspathElements);
	}

	getLog().info("Starting to instrument non-test classes for stack distance computation");
	try {
		instrumentCodeDirectories(compiledCodeDirectoriesToInstrument);
	} catch (DependencyResolutionRequiredException | IOException e) {
		throw new MojoExecutionException("Exception occurred", e);
	}
	getLog().info("Completed instrumenting non-test classes for stack distance computation");
}
 
开发者ID:cqse,项目名称:test-analyzer,代码行数:19,代码来源:StackDistanceMojo.java

示例5: createArchiveFile

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
private File createArchiveFile( File targetDirectory, String directory, String archiveExt )
    throws NoSuchArchiverException, IOException, MojoExecutionException
{
    final MavenArchiver mavenArchiver = new MavenArchiver();

    mavenArchiver.setArchiver( jarArchiver );

    jarArchiver.addFileSet( new DefaultFileSet( targetDirectory ) );
    // jarArchiver.setDuplicateBehavior( duplicate );

    File resultArchive = getArchiveFile( getOutputDirectory(), getFinalName(), directory, archiveExt );

    mavenArchiver.setOutputFile( resultArchive );
    try
    {
        mavenArchiver.createArchive( getMavenSession(), getMavenProject(), getArchive() );
    }
    catch ( ArchiverException | ManifestException | DependencyResolutionRequiredException e )
    {
        getLog().error( e.getMessage(), e );
        throw new MojoExecutionException( e.getMessage(), e );
    }

    return resultArchive;

}
 
开发者ID:khmarbaise,项目名称:multienv-maven-plugin,代码行数:27,代码来源:ConfigurationMojo.java

示例6: execute

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
/**
 * Send thePackage and a convenient fixed set of filters to Parser and outputs Parser's result
 *
 * Todo: allow filters to be set from CLI
 *
 * <code>
 * // A very permisive filter configuration:
 * getLog().info("Following is the PlantUML src: \n" + Parser.parse(
 *         thePackage, Filters.FILTER_ALLOW_ALL_RELATIONS, Filters.FILTER_ALLOW_ALL_CLASSES, loader,
 *         Filters.FILTER_RELATION_ALLOW_ALL));

 * </code>
 * @throws MojoExecutionException
 * @throws MojoFailureException
 */
@SuppressWarnings("unchecked")
public void execute() throws MojoExecutionException, MojoFailureException {
    filterParamsSanityCheck();
    prepareCustomFilters();
    try {
        URLClassLoader loader = getLoader();
        getLog().debug("loader URLs: " + Arrays.toString(loader.getURLs()));

        getLog().info("Following is the PlantUML src: \n" + Parser.parse(
                thePackage, FILTERS.get(this.relationTypeFilter), FILTERS.get(this.classesFilter),
                FILTERS.get(this.relationsFilter), loader));

    } catch (DependencyResolutionRequiredException e) {
        throw new MojoExecutionException("Something went wrong", e);
    }
}
 
开发者ID:juanmf,项目名称:Java2PlantUML,代码行数:32,代码来源:Parse.java

示例7: configureClassLoader

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
private void configureClassLoader(MavenProject project)
		throws MojoExecutionException {

	try {
		URL[] urls = project.getRuntimeClasspathElements()
			.stream()
			.map(File::new)
			.map(ConstExprMojo::toUrl)
			.collect(toList())
			.toArray(new URL[0]);

		ClassLoader parentClassLoader = Thread.currentThread().getContextClassLoader();
		URLClassLoader classLoader = URLClassLoader.newInstance(urls, parentClassLoader);
		Thread.currentThread().setContextClassLoader(classLoader);
	} catch (DependencyResolutionRequiredException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:junkdog,项目名称:constexpr-java,代码行数:19,代码来源:ConstExprMojo.java

示例8: createClassLoader

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
/**
 * Creates a ClassLoader from the projects classpath.
 *
 * @return The classloader created.
 *
 * @throws MojoFailureException If the creation fails.
 */
public ClassLoader createClassLoader() throws MojoFailureException
{
    try
    {
        Set<URL> urls = new HashSet<>();
        List<String> elements = project.getCompileClasspathElements();
        for (String element : elements)
        {
            urls.add(new File(element).toURI().toURL());
        }

        return URLClassLoader.newInstance(
                urls.toArray(new URL[0]),
                Thread.currentThread().getContextClassLoader());
    }
    catch (DependencyResolutionRequiredException | MalformedURLException e)
    {
        throw new MojoFailureException(e.getMessage(), e);
    }
}
 
开发者ID:touwolf,项目名称:bridje-framework,代码行数:28,代码来源:GenerateMojo.java

示例9: getUrlClassLoader

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
public static URLClassLoader getUrlClassLoader(MavenProject project) throws MojoFailureException {
    try {
        // collect compile classpath classes
        final List<File> files = new ArrayList<>();
        files.addAll(project.getCompileClasspathElements().stream().map(File::new).collect(toList()));

        // collect project dependencies
        files.addAll(project.getDependencyArtifacts().stream()
                .map(a -> DependencyUtils.resolve(a, project))
                .filter(Objects::nonNull)
                .collect(toList()));

        final List<URL> urls = files.stream()
                .filter(f -> f != null && f.exists())
                .map(new FileToUrl())
                .collect(toList());

        return new URLClassLoader(urls.toArray(new URL[urls.size()]), currentThread().getContextClassLoader());
    } catch (DependencyResolutionRequiredException e) {
        throw new MojoFailureException(e.getMessage(), e);
    }
}
 
开发者ID:lesfurets,项目名称:dOOv,代码行数:23,代码来源:ClassLoaderUtils.java

示例10: getClassRealm

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
private ClassRealm getClassRealm()
        throws DependencyResolutionRequiredException, MalformedURLException {
    if (classRealm == null) {
        List<String> runtimeClasspathElements = project.getRuntimeClasspathElements();

        classRealm = descriptor.getClassRealm();

        if (classRealm == null) {
            classRealm = project.getClassRealm();
        }

        for (String element : runtimeClasspathElements) {
            File elementFile = new File(element);
            classRealm.addURL(elementFile.toURI().toURL());
        }
    }
    return classRealm;
}
 
开发者ID:phoenixnap,项目名称:springmvc-raml-plugin,代码行数:19,代码来源:SpringMvcEndpointGeneratorMojo.java

示例11: createClassLoaderWithCompiledProject

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
/**
 * Creates and returns a {@link ClassLoader} that loads data from the compiled project sources and the dependencies of
 * the project. THe parent of the returned classLoader is this' object classloader.
 * 
 * <p>
 * We expect that the project does not itself implement {@link Collection}, {@link Map}, {@link Object} or any class
 * in {@link #STOP_CLASSES}, or that any transitive dependency of it does.
 */
private ClassLoader createClassLoaderWithCompiledProject() throws MojoFailureException {
  try {
    List<String> curProjectClasspath = project.getRuntimeClasspathElements();
    List<String> curProjectCompileClasspath = project.getCompileClasspathElements();

    Set<String> usedClasspath = new HashSet<>(curProjectClasspath);
    for (String cp : curProjectCompileClasspath)
      if (!usedClasspath.contains(cp))
        curProjectClasspath.add(cp);

    getLog().debug("Using following classpath elements: " + curProjectClasspath);
    URL[] thisProjectClasspathUrls = new URL[curProjectClasspath.size()];
    for (int i = 0; i < curProjectClasspath.size(); i++) {
      thisProjectClasspathUrls[i] = new File(curProjectClasspath.get(i)).toURI().toURL();
    }
    ClassLoader ourClassLoader = new URLClassLoader(thisProjectClasspathUrls, this.getClass().getClassLoader());
    return ourClassLoader;
  } catch (DependencyResolutionRequiredException | MalformedURLException e) {
    throw new MojoFailureException("Could not create classloader", e);
  }
}
 
开发者ID:diqube,项目名称:diqube,代码行数:30,代码来源:GenerateTsMojo.java

示例12: getCompileClasspathElements

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
/**
 * Get compile elements (i.e., classes under /target/classes)
 * 
 * @param project
 * @return
 */
public static List<String> getCompileClasspathElements(MavenProject project) {
	List<String> compileClassPath = new ArrayList<String>();

	try {
		project.getCompileClasspathElements()
			.stream()
			// we only target what has been compiled to a folder
			.filter(element -> !element.endsWith(".jar"))
			.filter(element -> new File(element).exists())
			.forEach(element -> compileClassPath.add(element));
	} catch (DependencyResolutionRequiredException e) {
		e.printStackTrace();
	}

	return compileClassPath;
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:23,代码来源:ProjectUtils.java

示例13: getTestClasspathElements

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
/**
 * Get JUnit elements (i.e., classes under /target/test-classes) and compiled
 * elements (i.e., classes under /target/classes)
 * 
 * @param project
 * @return
 */
public static List<String> getTestClasspathElements(MavenProject project) {
	List<String> testClassPath = new ArrayList<String>();

	try {
		project.getTestClasspathElements()
			.stream()
			// we only target what has been compiled to a folder
			.filter(element -> !element.endsWith(".jar"))
			.filter(element -> new File(element).exists())
			.forEach(element -> testClassPath.add(element));
	} catch (DependencyResolutionRequiredException e) {
		e.printStackTrace();
	}

	return testClassPath;
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:24,代码来源:ProjectUtils.java

示例14: getRuntimeAndCompileClasspath

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
/**
 * Generates a classpath with which source files in the main source directory can be compiled.
 *
 * @return a String containing the complete classpath, with entries separated by {@code :} so it can be given as the
 * classpath argument to javac
 * @throws DependencyResolutionRequiredException
 */
private String getRuntimeAndCompileClasspath() throws DependencyResolutionRequiredException {
    final List compileClasspathElements = project.getCompileClasspathElements();
    final List runtimeClasspathElements = project.getRuntimeClasspathElements();

    final Set<String> classPathElements = new HashSet<String>();
    classPathElements.addAll(compileClasspathElements);
    classPathElements.addAll(runtimeClasspathElements);

    final StringBuilder classpath = new StringBuilder();
    boolean first = true;
    for (final String element : classPathElements) {
        if (!first) {
            classpath.append(':');
        }
        classpath.append(element);
        first = false;
    }

    return classpath.toString();
}
 
开发者ID:anthemengineering,项目名称:infer-maven-plugin,代码行数:28,代码来源:InferMojo.java

示例15: getPathFromArtifacts

import org.apache.maven.artifact.DependencyResolutionRequiredException; //导入依赖的package包/类
/**
 * @param artifacts
 * @param antProject
 * @return a path
 * @throws DependencyResolutionRequiredException
 */
public Path getPathFromArtifacts(Collection artifacts, Project antProject)
        throws DependencyResolutionRequiredException {
    if (artifacts == null) {
        return new Path(antProject);
    }

    List list = new ArrayList(artifacts.size());
    for (Iterator i = artifacts.iterator(); i.hasNext();) {
        Artifact a = (Artifact) i.next();
        File file = a.getFile();
        if (file == null) {
            throw new DependencyResolutionRequiredException(a);
        }
        list.add(file.getPath());
    }

    Path p = new Path(antProject);
    p.setPath(StringUtils.join(list.iterator(), File.pathSeparator));

    return p;
}
 
开发者ID:0xC70FF3,项目名称:java-gems,代码行数:28,代码来源:DebianMojo.java


注:本文中的org.apache.maven.artifact.DependencyResolutionRequiredException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。