/** * Executes dependency-check. * * @throws MojoExecutionException thrown if there is an exception executing * the mojo * @throws MojoFailureException thrown if dependency-check failed the build */ @Override public void execute() throws MojoExecutionException, MojoFailureException { generatingSite = false; final boolean shouldSkip = Boolean.parseBoolean(System.getProperty("dependency-check.skip", Boolean.toString(skip))); if (shouldSkip) { getLog().info("Skipping " + getName(Locale.US)); } else { validateAggregate(); project.setContextValue(getOutputDirectoryContextKey(), this.outputDirectory); runCheck(); } }
/** * Generates the Dependency-Check Site Report. * * @param sink the sink to write the report to * @param locale the locale to use when generating the report * @throws MavenReportException if a maven report exception occurs */ public void generate(Sink sink, Locale locale) throws MavenReportException { final boolean shouldSkip = Boolean.parseBoolean(System.getProperty("dependency-check.skip", Boolean.toString(skip))); if (shouldSkip) { getLog().info("Skipping report generation " + getName(Locale.US)); return; } generatingSite = true; try { validateAggregate(); } catch (MojoExecutionException ex) { throw new MavenReportException(ex.getMessage()); } project.setContextValue(getOutputDirectoryContextKey(), getReportOutputDirectory()); try { runCheck(); } catch (MojoExecutionException ex) { throw new MavenReportException(ex.getMessage(), ex); } catch (MojoFailureException ex) { getLog().warn("Vulnerabilities were identifies that exceed the CVSS threshold for failing the build"); } }
project.setContextValue( KEY_EXTENSIONS_REALMS, pluginRealms );
@Override public void setContextValue(String key, Object value) { project.setContextValue(key, value); }
public void setDependencyArtifacts(MavenSession session, MavenProject project, DependencyArtifacts dependencyArtifacts) { project.setContextValue(TychoConstants.CTX_DEPENDENCY_ARTIFACTS, dependencyArtifacts); }
public static void setExpandedVersion( MavenSession session, File location, String version ) { MavenProject project = MavenSessionUtils.getMavenProject( session, location ); if ( project == null ) { throw new IllegalArgumentException( location.getAbsolutePath() + " does not correspond to a reactor project basedir." ); } project.setContextValue( TychoConstants.CTX_EXPANDED_VERSION, version ); }
@Override public void setDependencyMetadata(boolean primary, Set<?> installableUnits) { project.setContextValue(getDependencyMetadataKey(primary), installableUnits); }
@Override public void setupProject(MavenSession session, MavenProject project) { ArtifactKey key = readArtifactKey(project.getBasedir()); project.setContextValue(CTX_ARTIFACT_KEY, key); }
/** * Returns the (editable) list of {@link DependencySeed}s for the given project. */ @SuppressWarnings("unchecked") public static List<DependencySeed> getDependencySeeds(MavenProject project) { List<DependencySeed> dependencySeeds = (List<DependencySeed>) project .getContextValue(TychoConstants.CTX_DEPENDENCY_SEEDS); if (dependencySeeds == null) { dependencySeeds = new ArrayList<>(); project.setContextValue(TychoConstants.CTX_DEPENDENCY_SEEDS, dependencySeeds); } return dependencySeeds; } }
public static ReactorProject adapt(MavenProject project) { if (project == null) { return null; } ReactorProject reactorProject = (ReactorProject) project.getContextValue(CTX_REACTOR_PROJECT); if (reactorProject == null) { reactorProject = new DefaultReactorProject(project); project.setContextValue(CTX_REACTOR_PROJECT, reactorProject); } return reactorProject; }
project.setContextValue("jruby.resolved.artifacts", resolved);
project.setContextValue("jruby.resolved.artifacts", resolved);
@Override public void setupProject(MavenSession session, MavenProject project, ReactorProject reactorProject) { AbstractTychoProject dr = (AbstractTychoProject) projectTypes.get(project.getPackaging()); if (dr == null) { return; } // skip if setup was already done if (project.getContextValue(TychoConstants.CTX_MERGED_PROPERTIES) != null) { return; } // generic Eclipse/OSGi metadata dr.setupProject(session, project); // p2 metadata Properties properties = new Properties(); properties.putAll(project.getProperties()); properties.putAll(session.getSystemProperties()); // session wins properties.putAll(session.getUserProperties()); project.setContextValue(TychoConstants.CTX_MERGED_PROPERTIES, properties); setTychoEnvironmentProperties(properties, project); TargetPlatformConfiguration configuration = configurationReader .getTargetPlatformConfiguration(session, project); project.setContextValue(TychoConstants.CTX_TARGET_PLATFORM_CONFIGURATION, configuration); ExecutionEnvironmentConfiguration eeConfiguration = new ExecutionEnvironmentConfigurationImpl(logger, !configuration.isResolveWithEEConstraints()); dr.readExecutionEnvironmentConfiguration(project, eeConfiguration); project.setContextValue(TychoConstants.CTX_EXECUTION_ENVIRONMENT_CONFIGURATION, eeConfiguration); DependencyResolver resolver = dependencyResolverLocator.lookupDependencyResolver(project); resolver.setupProjects(session, project, reactorProject); }
public BundleResolutionState getBundleResolutionState( MavenSession session, MavenProject project ) { BundleResolutionState resolver = (BundleResolutionState) project.getContextValue( TychoConstants.CTX_BUNDLE_RESOLUTION_STATE ); if ( resolver == null ) { TargetPlatform platform = (TargetPlatform) project.getContextValue( TychoConstants.CTX_TARGET_PLATFORM ); if ( platform != null ) { resolver = EquinoxBundleResolutionState.newInstance( session.getContainer(), session, project ); } project.setContextValue( TychoConstants.CTX_BUNDLE_RESOLUTION_STATE, resolver ); } return resolver; }
public FeatureResolutionState getFeatureResolutionState( MavenSession session, MavenProject project ) { FeatureResolutionState resolver = (FeatureResolutionState) project.getContextValue( TychoConstants.CTX_FEATURE_RESOLUTION_STATE ); if ( resolver == null ) { TargetPlatform platform = (TargetPlatform) project.getContextValue( TychoConstants.CTX_TARGET_PLATFORM ); if ( platform != null ) { resolver = new FeatureResolutionState( getLogger(), session, platform ); project.setContextValue( TychoConstants.CTX_FEATURE_RESOLUTION_STATE, resolver ); } } return resolver; }
properties.putAll( project.getProperties() ); project.setContextValue( TychoConstants.CTX_MERGED_PROPERTIES, properties ); project.setContextValue( TychoConstants.CTX_TARGET_PLATFORM_CONFIGURATION, configuration ); logger.info( "Resolving target platform for project " + project ); TargetPlatform targetPlatform = resolver.resolvePlatform( project, null, request.getMirrors() ); project.setContextValue( TychoConstants.CTX_TARGET_PLATFORM, targetPlatform ); for ( Dependency dependency : dr.getDependencies( session, project ) )
protected ProjectJsonResponse uploadDependencies(ByteArrayOutputStream outStream) throws Exception { try { String projectId = fetchProjectId(); if (mavenSession.getTopLevelProject().getId().equals(mavenSession.getCurrentProject().getId())){ mavenSession.getTopLevelProject().setContextValue("veye_project_id", projectId); } return updateExistingProject(resource, projectId, outStream); } catch (Exception ex) { getLog().error("Error in UpdateMojo.uploadDependencies " + ex.getMessage()); ProjectJsonResponse response = createNewProject("/projects?api_key=", outStream); if (updatePropertiesAfterCreate) { writeProperties( response ); } merge( response.getId() ); return response; } }
project.setContextValue( TychoConstants.CTX_ECLIPSE_PLUGIN_PROJECT, new EclipsePluginProjectImpl( project, bundleDescription ) );
private MavenProject prepareMavenProject() { MavenProject mp =new MavenProject(); mp.getModel().setGroupId(this.mavenProject.getGroupId()); mp.getModel().setArtifactId(featureId); mp.getModel().setVersion(featureVersion); mp.getModel().setPackaging("eclipse-feature"); mp.setPluginArtifactRepositories(this.mavenProject.getPluginArtifactRepositories()); mp.setFile(featureFile); //sets the basedir for the MavenProject org.eclipse.tycho.artifacts.DependencyArtifacts da = new DefaultDependencyArtifacts(); mp.setContextValue(TychoConstants.CTX_DEPENDENCY_ARTIFACTS, da); return mp; }
public void execute() throws MojoExecutionException, MojoFailureException { try{ setProxy(); prettyPrintStart(); ByteArrayOutputStream jsonDependenciesStream = null; if (transitiveDependencies == true){ jsonDependenciesStream = getTransitiveDependenciesJsonStream(nameStrategy); } else { jsonDependenciesStream = getDirectDependenciesJsonStream(nameStrategy); } if (jsonDependenciesStream == null){ prettyPrint0End(); return ; } ProjectJsonResponse response = uploadDependencies(jsonDependenciesStream); if (mavenSession.getTopLevelProject().getId().equals(mavenSession.getCurrentProject().getId())){ mavenSession.getTopLevelProject().setContextValue("veye_project_id", response.getId()); } merge( response.getId() ); if (updatePropertiesAfterCreate) { writeProperties( response ); } prettyPrint(response); } catch( Exception exception ){ throw new MojoExecutionException("Oh no! Something went wrong :-( " + "Get in touch with the VersionEye guys and give them feedback." + "You find them on Twitter at https//twitter.com/VersionEye. ", exception); } }