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


Java MavenSession.getProjects方法代码示例

本文整理汇总了Java中org.apache.maven.execution.MavenSession.getProjects方法的典型用法代码示例。如果您正苦于以下问题:Java MavenSession.getProjects方法的具体用法?Java MavenSession.getProjects怎么用?Java MavenSession.getProjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.execution.MavenSession的用法示例。


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

示例1: afterProjectsRead

import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
@Override
	public void afterProjectsRead(MavenSession session) throws MavenExecutionException {

		Set<String> goals = new HashSet<>(session.getGoals());

		if (goals.size() == 1 && goals.contains("clean")) {
			logger.info("Eccentric modularity not started (clean only session)! ");
			return;
		}

//		executionListener.setDelegate(session.getRequest().getExecutionListener());
//		session.getRequest().setExecutionListener(executionListener);
		logger.info("Eccentric modularity extension started!");
		
		
		List<MavenProject> allProjects = session.getProjects();
		for (MavenProject mavenProject : allProjects) {
			logger.info("Preparing " + mavenProject);
			executionListener.projectStarted(session.getProjectBuildingRequest(), mavenProject);
		}
		
	}
 
开发者ID:commsen,项目名称:EM,代码行数:23,代码来源:EccentricModularityMavenLifecycleParticipant.java

示例2: detectUnmanagedModules

import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
private void detectUnmanagedModules(EnforcerRuleHelper helper, MavenProject project) throws ExpressionEvaluationException, EnforcerRuleException {
    Log log = helper.getLog();
    MavenSession session = RuleHelper.getSession(helper);
    List<MavenProject> projects = session.getProjects();
    ImmutableListMultimap managedDependencies = RuleHelper.getManagedDependenciesAsMap(project);

    for (MavenProject mavenProject : projects) {
        if (ruleIsDefinedInProjectOrNotModuleParent(mavenProject, log)) {
            continue;
        }
        String projectIdentifier = RuleHelper.getProjectIdentifier(mavenProject);
        if (!managedDependencies.containsKey(projectIdentifier)) {
            logHeader(log, "manage all modules");
            log.warn("unmanaged project found: " + projectIdentifier);
            failureDetected = true;
        }
    }

    if (failureDetected) {
        throw new EnforcerRuleException("Failing because of unmanaged projects");
    }
}
 
开发者ID:1and1,项目名称:ono-extra-enforcer-rules,代码行数:23,代码来源:ManageAllModulesRule.java

示例3: loadProject

import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
private MavenProject loadProject ( File file, final MavenSession session ) throws Exception
{
    file = file.getCanonicalFile ();
    for ( final MavenProject project : session.getProjects () )
    {
        final File projectFile = project.getFile ().getCanonicalFile ();
        if ( projectFile.equals ( file ) )
        {
            return project;
        }
    }

    throw new MojoExecutionException ( file, "Unreferenced project found", String.format ( "Project at '%s' is not in the list of active projects. This plugin can only"
            + "work on projects there were loaded by maven. You need to include the project in your build.", file ) );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:16,代码来源:DefaultPomHelper.java

示例4: afterProjectsRead

import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
@Override
    public void afterProjectsRead(MavenSession session) throws MavenExecutionException {
        try {
            for (MavenProject project : session.getProjects()) {
                if (!revisionGenerator.isDirty()) {
                    pluginMerger.merge(project, plugins.getEnforcerPlugin(project));
                }
//                pluginMerger.merge(project, plugins.getVersionFixPlugin());
            }
        } catch (Exception ex) {
            throw new MavenExecutionException("Unexpected Exception during Plugin Merging", ex);
        }
    }
 
开发者ID:IG-Group,项目名称:cdversion-maven-extension,代码行数:14,代码来源:CDVersionLifecycleParticipant.java

示例5: build

import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
private void build(MavenSession session, MavenProject project, List<MavenProject> allProjects, GoalSet goals) throws MojoExecutionException {
    session.setProjects(allProjects);
    ProjectIndex projectIndex = new ProjectIndex(session.getProjects());
    try {
        ReactorBuildStatus reactorBuildStatus = new ReactorBuildStatus(new BomDependencyGraph(session.getProjects()));
        ReactorContext reactorContext = new ReactorContextFactory(new MavenVersion(mavenVersion)).create(session.getResult(), projectIndex, Thread.currentThread().getContextClassLoader(),
                reactorBuildStatus, builder);
        List<TaskSegment> segments = segmentCalculator.calculateTaskSegments(session);
        for (TaskSegment segment : segments) {
            builder.buildProject(session, reactorContext, project, filterSegment(segment, goals));
        }
    } catch (Throwable t) {
        throw new MojoExecutionException("Error building generated bom:" + project.getArtifactId(), t);
    }
}
 
开发者ID:sundrio,项目名称:sundrio,代码行数:16,代码来源:GenerateBomMojo.java

示例6: afterProjectsRead

import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
@Override
public void afterProjectsRead(MavenSession session) throws MavenExecutionException {
    // Detect the OS and CPU architecture.
    Properties sessionProps = new Properties();
    sessionProps.putAll(session.getSystemProperties());
    sessionProps.putAll(session.getUserProperties());
    try {
        detector.detect(sessionProps, getClassifierWithLikes(session));
    } catch (DetectionException e) {
        throw new MavenExecutionException(e.getMessage(), session.getCurrentProject().getFile());
    }

    // Generate the dictionary.
    Map<String, String> dict = new LinkedHashMap<String, String>();
    dict.put(Detector.DETECTED_NAME, sessionProps.getProperty(Detector.DETECTED_NAME));
    dict.put(Detector.DETECTED_ARCH, sessionProps.getProperty(Detector.DETECTED_ARCH));
    dict.put(Detector.DETECTED_CLASSIFIER, sessionProps.getProperty(Detector.DETECTED_CLASSIFIER));
    for (Map.Entry<Object, Object> entry : sessionProps.entrySet()) {
        if (entry.getKey().toString().startsWith(Detector.DETECTED_RELEASE)) {
            dict.put(entry.getKey().toString(), entry.getValue().toString());
        }
    }

    // Inject the current session.
    injectSession(session, dict);

    /// Perform the interpolation for the properties of all dependencies.
    for (MavenProject p: session.getProjects()) {
        interpolate(dict, p);
    }
}
 
开发者ID:trustin,项目名称:os-maven-plugin,代码行数:32,代码来源:DetectExtension.java

示例7: ReactorProjects

import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
@Inject
public ReactorProjects(MavenSession session) {
  Map<String, MavenProject> projects = new HashMap<>();
  for (MavenProject project : session.getProjects()) {
    projects.put(key(project.getGroupId(), project.getArtifactId(), project.getVersion()), project);
  }
  this.projects = ImmutableMap.copyOf(projects);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:9,代码来源:ReactorProjects.java

示例8: testDeployAtEnd

import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
@Test
public void testDeployAtEnd() throws Exception {
  File basedir = resources.getBasedir("install-deploy/deploy-at-end");

  File localrepo = new File(basedir, "target/localrepo");
  Assert.assertTrue(localrepo.mkdirs());

  File remoterepo = new File(basedir, "target/remoterepo");
  Assert.assertTrue(remoterepo.mkdirs());

  Properties properties = new Properties();
  properties.put("version", "1.0");
  properties.put("repopath", remoterepo.getCanonicalPath());
  MavenProject project = readMavenProject(basedir, properties);

  MavenSession session = newSession(project, localrepo, properties);

  DeployParticipant deployParticipant = mojos.getContainer().lookup(DeployParticipant.class);

  Assert.assertEquals(0, deployParticipant.getDeployAtEndRequests().size());

  for (MavenProject reactorProject : session.getProjects()) {
    session.setCurrentProject(reactorProject);
    if (!reactorProject.getPackaging().equals("pom")) {
      mojos.executeMojo(session, reactorProject, "compile");
      mojos.executeMojo(session, reactorProject, "jar");
    }
    mojos.executeMojo(session, reactorProject, "deploy");
  }

  Assert.assertFalse(new File(remoterepo, "io/takari/lifecycle/its/test/1.0/test-1.0.pom").canRead());
  Assert.assertFalse(new File(remoterepo, "io/takari/lifecycle/its/test-modulea/1.0/test-modulea-1.0.jar").canRead());
  Assert.assertFalse(new File(remoterepo, "io/takari/lifecycle/its/test-modulea/1.0/test-modulea-1.0.pom").canRead());
  Assert.assertFalse(new File(remoterepo, "io/takari/lifecycle/its/test-moduleb/1.0/test-moduleb-1.0.jar").canRead());
  Assert.assertFalse(new File(remoterepo, "io/takari/lifecycle/its/test-moduleb/1.0/test-moduleb-1.0.pom").canRead());

  Assert.assertEquals(3, deployParticipant.getDeployAtEndRequests().size());
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:39,代码来源:InstallDeployTest.java

示例9: getProjects

import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
public static List<MavenProject> getProjects( MavenProject project, MavenSession session, boolean aggregator )
{
    if ( aggregator )
    {
        return session.getProjects();
    }
    else
    {
        return Collections.singletonList( project );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:12,代码来源:LifecycleDependencyResolver.java

示例10: calculateProjectBuilds

import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
public ProjectBuildList calculateProjectBuilds( MavenSession session, List<TaskSegment> taskSegments )
{
    List<ProjectSegment> projectBuilds = new ArrayList<ProjectSegment>();

    MavenProject rootProject = session.getTopLevelProject();

    for ( TaskSegment taskSegment : taskSegments )
    {
        List<MavenProject> projects;

        if ( taskSegment.isAggregating() )
        {
            projects = Collections.singletonList( rootProject );
        }
        else
        {
            projects = session.getProjects();
        }
        for ( MavenProject project : projects )
        {
            BuilderCommon.attachToThread( project ); // Not totally sure if this is needed for anything
            MavenSession copiedSession = session.clone();
            copiedSession.setCurrentProject( project );
            projectBuilds.add( new ProjectSegment( project, taskSegment, copiedSession ) );
        }
    }
    return new ProjectBuildList( projectBuilds );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:29,代码来源:BuildListCalculator.java

示例11: logReactorSummary

import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
private void logReactorSummary( MavenSession session )
{
    logger.info( chars( '-', LINE_LENGTH ) );

    logger.info( "Reactor Summary:" );

    logger.info( "" );

    MavenExecutionResult result = session.getResult();

    for ( MavenProject project : session.getProjects() )
    {
        StringBuilder buffer = new StringBuilder( 128 );

        buffer.append( project.getName() );

        buffer.append( ' ' );
        while ( buffer.length() < LINE_LENGTH - 21 )
        {
            buffer.append( '.' );
        }
        buffer.append( ' ' );

        BuildSummary buildSummary = result.getBuildSummary( project );

        if ( buildSummary == null )
        {
            buffer.append( "SKIPPED" );
        }
        else if ( buildSummary instanceof BuildSuccess )
        {
            buffer.append( "SUCCESS [" );
            buffer.append( getFormattedTime( buildSummary.getTime() ) );
            buffer.append( "]" );
        }
        else if ( buildSummary instanceof BuildFailure )
        {
            buffer.append( "FAILURE [" );
            buffer.append( getFormattedTime( buildSummary.getTime() ) );
            buffer.append( "]" );
        }

        logger.info( buffer.toString() );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:46,代码来源:ExecutionEventLogger.java


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