use of org.eclipse.tycho.core.shared.BuildFailureException in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReaderTest method testExtraRequirementMissingVersionRange.
@Test
public void testExtraRequirementMissingVersionRange() throws Exception {
Xpp3Dom dom = createConfigurationDom("type", "id");
try {
configurationReader.readExtraRequirements(new TargetPlatformConfiguration(), dom);
fail();
} catch (BuildFailureException e) {
assertTrue(e.getMessage().contains("Element <versionRange> is missing in <extraRequirements><requirement> section."));
}
}
use of org.eclipse.tycho.core.shared.BuildFailureException in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReaderTest method testAddTargetWithMissingVersionInTargetDefinition.
@Test
public void testAddTargetWithMissingVersionInTargetDefinition() {
Xpp3Dom dom = createGavConfiguration("myGroupId", "myArtifactId", null);
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.eclipse.tycho.core.shared.BuildFailureException in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReaderTest method testExtraRequirementMissingType.
@Test
public void testExtraRequirementMissingType() throws Exception {
Xpp3Dom dom = createConfigurationDom("id", "versionRange");
try {
configurationReader.readExtraRequirements(new TargetPlatformConfiguration(), dom);
fail();
} catch (BuildFailureException e) {
assertTrue(e.getMessage().contains("Element <type> is missing in <extraRequirements><requirement> section."));
}
}
use of org.eclipse.tycho.core.shared.BuildFailureException in project tycho by eclipse.
the class TychoMavenLifecycleParticipant method afterProjectsRead.
@Override
public void afterProjectsRead(MavenSession session) throws MavenExecutionException {
try {
if (disableLifecycleParticipation(session)) {
return;
}
List<MavenProject> projects = session.getProjects();
validate(projects);
// setting this system property to let EF figure out where the traffic
// is coming from (#467418)
System.setProperty(P2_USER_AGENT_KEY, P2_USER_AGENT_VALUE + TychoVersion.getTychoVersion());
configureComponents(session);
for (MavenProject project : projects) {
resolver.setupProject(session, project, DefaultReactorProject.adapt(project));
}
List<ReactorProject> reactorProjects = DefaultReactorProject.adapt(session);
for (MavenProject project : projects) {
resolver.resolveProject(session, project, reactorProjects);
}
} catch (BuildFailureException e) {
// trace by wrapping it in MavenExecutionException
throw new MavenExecutionException(e.getMessage(), e);
}
}
use of org.eclipse.tycho.core.shared.BuildFailureException in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReader method readExtraRequirements.
protected void readExtraRequirements(TargetPlatformConfiguration result, Xpp3Dom resolverDom) throws BuildFailureException {
Xpp3Dom requirementsDom = resolverDom.getChild("extraRequirements");
if (requirementsDom == null) {
return;
}
for (Xpp3Dom requirementDom : requirementsDom.getChildren("requirement")) {
Dependency d = new Dependency();
if (requirementDom.getChild("type") == null) {
throw new BuildFailureException("Element <type> is missing in <extraRequirements><requirement> section.");
}
if (requirementDom.getChild("id") == null) {
throw new BuildFailureException("Element <id> is missing in <extraRequirements><requirement> section.");
}
if (requirementDom.getChild("versionRange") == null) {
throw new BuildFailureException("Element <versionRange> is missing in <extraRequirements><requirement> section.");
}
d.setType(requirementDom.getChild("type").getValue());
d.setArtifactId(requirementDom.getChild("id").getValue());
d.setVersion(requirementDom.getChild("versionRange").getValue());
result.addExtraRequirement(d);
}
}
Aggregations