Example usage for org.apache.maven.project MavenProject getContextValue

List of usage examples for org.apache.maven.project MavenProject getContextValue

Introduction

In this page you can find the example usage for org.apache.maven.project MavenProject getContextValue.

Prototype

public Object getContextValue(String key) 

Source Link

Document

Returns context value of this project associated with the given key or null if this project has no such value.

Usage

From source file:org.sourcepit.osgifier.maven.InstallOsgifiedArtifacts.java

License:Apache License

@Override
protected void doExecute() throws MojoExecutionException, MojoFailureException {
    final MavenProject project = buildContext.getSession().getCurrentProject();

    @SuppressWarnings("unchecked")
    final Collection<Artifact> artifacts = (Collection<Artifact>) project.getContextValue("osgified-artifacts");

    final RepositorySystemSession session = buildContext.getRepositorySession();

    final InstallRequest installRequest = new InstallRequest();
    installRequest.setArtifacts(artifacts);
    try {/*from   w w w. j  av  a  2s .c  om*/
        repositorySystem.install(session, installRequest);
    } catch (InstallationException e) {
        throw pipe(e);
    }
}

From source file:org.sourcepit.tpmp.resolver.tycho.AggregatedP2MetadataProvider.java

License:Apache License

@Override
public Map<String, IDependencyMetadata> getDependencyMetadata(MavenSession session, MavenProject project,
        List<TargetEnvironment> environments, OptionalResolutionAction optional) {
    @SuppressWarnings("unchecked")
    final Map<String, IDependencyMetadata> metadata = (Map<String, IDependencyMetadata>) project
            .getContextValue("tpmp.aggregatedMetadata");
    return metadata;
}

From source file:org.sourcepit.tpmp.resolver.tycho.MavenProjectFacade.java

License:Apache License

private void setupProjectLazy(MavenSession session, MavenProject project) {
    final TargetPlatformConfiguration targetPlatformConfiguration = (TargetPlatformConfiguration) project
            .getContextValue(TychoConstants.CTX_TARGET_PLATFORM_CONFIGURATION);
    if (targetPlatformConfiguration == null) {
        // project was not set up by Tycho. Maybe running in -Dtycho.mode=maven
        resolver.setupProject(session, project, DefaultReactorProject.adapt(project));
    }//from w  w w  .  j  av  a2s  .c  o m
}