Java Code Examples for org.apache.maven.project.MavenProject#setParent()
The following examples show how to use
org.apache.maven.project.MavenProject#setParent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InstallDeployTest.java From takari-lifecycle with Eclipse Public License 1.0 | 6 votes |
private MavenSession newSession(MavenProject project, File localrepo, Properties properties) throws Exception { MavenExecutionRequest request = new DefaultMavenExecutionRequest(); MavenExecutionResult result = new DefaultMavenExecutionResult(); DefaultRepositorySystemSession repoSession = MavenRepositorySystemUtils.newSession(); LocalRepository localRepo = new LocalRepository(localrepo); repoSession.setLocalRepositoryManager(mojos.getContainer().lookup(LocalRepositoryManagerFactory.class, "simple").newInstance(repoSession, localRepo)); MavenSession session = new MavenSession(mojos.getContainer(), repoSession, request, result); List<MavenProject> projects = new ArrayList<>(); projects.add(project); for (String module : project.getModules()) { MavenProject moduleProject = readMavenProject(new File(project.getBasedir(), module), properties); moduleProject.setParent(project); projects.add(moduleProject); } session.setProjects(projects); return session; }
Example 2
Source File: RequirePropertyDivergesTest.java From extra-enforcer-rules with Apache License 2.0 | 5 votes |
/** * Test of execute method, of class RequirePropertyDiverges. */ @Test public void testExecuteInChild() throws EnforcerRuleException { RequirePropertyDiverges mockInstance = createMockRule(); final MavenProject project = createMavenProject( "company", "child" ); final MavenProject parent = createParentProject(); project.setParent( parent ); setUpHelper( project, "childValue" ); mockInstance.execute( helper ); }
Example 3
Source File: RequirePropertyDivergesTest.java From extra-enforcer-rules with Apache License 2.0 | 5 votes |
/** * Test of execute method, of class RequirePropertyDiverges. */ @Test( expected = EnforcerRuleException.class ) public void testExecuteInChildShouldFail() throws EnforcerRuleException { RequirePropertyDiverges mockInstance = createMockRule(); final MavenProject project = createMavenProject( "company", "child" ); final MavenProject parent = createParentProject(); project.setParent( parent ); setUpHelper( project, "parentValue" ); mockInstance.execute( helper ); }
Example 4
Source File: RequirePropertyDivergesTest.java From extra-enforcer-rules with Apache License 2.0 | 5 votes |
void testCheckAgainstParentValue( final String parentGroupId, final String childGroupId ) throws ExpressionEvaluationException, EnforcerRuleException { instance.setProperty( "project.groupId" ); MavenProject parent = createMavenProject( parentGroupId, "parent-pom" ); MavenProject project = createMavenProject( childGroupId, "child" ); project.setParent( parent ); when( helper.evaluate( "${project.parent.groupId}" ) ).thenReturn( parentGroupId ); instance.checkAgainstParentValue( project, parent, helper, childGroupId ); }
Example 5
Source File: AggregatingGraphFactoryTest.java From depgraph-maven-plugin with Apache License 2.0 | 5 votes |
private MavenProject createMavenProject(String artifactId, MavenProject parent) { MavenProject project = createMavenProject(artifactId); project.setParent(parent); parent.getModules().add(artifactId); MavenProject currentParent = parent; while (currentParent != null) { currentParent.getCollectedProjects().add(project); currentParent = currentParent.getParent(); } return project; }