use of org.apache.maven.execution.MavenSession in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReaderTest method testAddTargetWithMissingGroupInTargetDefinition.
@Test
public void testAddTargetWithMissingGroupInTargetDefinition() {
Xpp3Dom dom = createGavConfiguration(null, "myArtifactId", "myVersion");
MavenSession session = setupMockSession();
TargetPlatformConfiguration configuration = new TargetPlatformConfiguration();
try {
configurationReader.addTargetArtifact(configuration, session, null, dom);
fail();
} catch (BuildFailureException e) {
assertTrue(e.getMessage().contains("The target artifact configuration is invalid"));
}
}
use of org.apache.maven.execution.MavenSession in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReaderTest method testAddTargetWithMissingArtifactIdInTargetDefinition.
@Test
public void testAddTargetWithMissingArtifactIdInTargetDefinition() {
Xpp3Dom dom = createGavConfiguration("myGroupId", null, "myVersion");
MavenSession session = setupMockSession();
TargetPlatformConfiguration configuration = new TargetPlatformConfiguration();
try {
configurationReader.addTargetArtifact(configuration, session, null, dom);
fail();
} catch (BuildFailureException e) {
assertTrue(e.getMessage().contains("The target artifact configuration is invalid"));
}
}
use of org.apache.maven.execution.MavenSession in project tycho by eclipse.
the class ArtifactDependencyWalkerTest method getTargetPlatform.
protected DependencyArtifacts getTargetPlatform() throws Exception {
LocalDependencyResolver resolver = (LocalDependencyResolver) lookup(DependencyResolver.class, LocalDependencyResolver.ROLE_HINT);
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request.setLocalRepository(new StubArtifactRepository(System.getProperty("java.io.tmpdir")));
MavenExecutionResult result = new DefaultMavenExecutionResult();
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
MavenSession session = new MavenSession(getContainer(), repositorySession, request, result);
session.setProjects(new ArrayList<MavenProject>());
lookup(LegacySupport.class).setSession(session);
MavenProject project = new MavenProject();
resolver.setLocation(new File("src/test/resources/targetplatforms/basic"));
DependencyArtifacts platform = resolver.resolveDependencies(session, project, null, DefaultReactorProject.adapt(session), null);
return platform;
}
use of org.apache.maven.execution.MavenSession in project tycho by eclipse.
the class LocalDependencyResolverTest method getTargetPlatform.
protected DependencyArtifacts getTargetPlatform(File location) throws Exception, IOException {
LocalDependencyResolver resolver = (LocalDependencyResolver) lookup(DependencyResolver.class, LocalDependencyResolver.ROLE_HINT);
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request.setLocalRepository(new StubArtifactRepository(location.getAbsolutePath()));
MavenExecutionResult result = new DefaultMavenExecutionResult();
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
MavenSession session = new MavenSession(getContainer(), repositorySession, request, result);
session.setProjects(new ArrayList<MavenProject>());
lookup(LegacySupport.class).setSession(session);
MavenProject project = new MavenProject();
resolver.setLocation(location);
DependencyArtifacts platform = resolver.resolveDependencies(session, project, null, DefaultReactorProject.adapt(session), null);
return platform;
}
use of org.apache.maven.execution.MavenSession in project tycho by eclipse.
the class TychoTest method testWithValidExplicitTargetEnvironment.
public void testWithValidExplicitTargetEnvironment() throws Exception {
File basedir = getBasedir("projects/explicitenvironment/valid");
List<MavenProject> projects = getSortedProjects(basedir);
assertEquals(1, projects.size());
assertEquals("valid", projects.get(0).getArtifactId());
DefaultTargetPlatformConfigurationReader resolver = lookup(DefaultTargetPlatformConfigurationReader.class);
MavenSession session = newMavenSession(projects.get(0), projects);
TargetPlatformConfiguration configuration;
List<TargetEnvironment> environments;
configuration = resolver.getTargetPlatformConfiguration(session, session.getCurrentProject());
environments = configuration.getEnvironments();
assertEquals(1, environments.size());
TargetEnvironment env = environments.get(0);
assertEquals("linux", env.getOs());
assertEquals("gtk", env.getWs());
assertEquals("arm", env.getArch());
}
Aggregations