use of org.apache.maven.execution.MavenSession in project tycho by eclipse.
the class TychoInterpolatorTest method setUp.
@Before
public void setUp() {
MavenSession session = mock(MavenSession.class);
project = mock(MavenProject.class);
settings = mock(Settings.class);
File baseDir = mock(File.class);
Properties projectProperties = new Properties();
projectProperties.put("myProjectPropertyKey", "myProjectPropertyValue");
Properties userProperties = new Properties();
userProperties.put("myUserPropertyKey", "myUserPropertyValue");
Properties systemProperties = new Properties();
systemProperties.put("mySystemPropertyKey", "mySystemPropertyValue");
when(project.getProperties()).thenReturn(projectProperties);
when(session.getSystemProperties()).thenReturn(systemProperties);
when(session.getUserProperties()).thenReturn(userProperties);
when(session.getSettings()).thenReturn(settings);
when(settings.getLocalRepository()).thenReturn("myLocalRepo");
when(project.getBasedir()).thenReturn(baseDir);
when(project.getVersion()).thenReturn("1.0.0");
when(baseDir.getAbsolutePath()).thenReturn("absolutePathToBaseDir");
interpolator = new TychoInterpolator(session, project);
}
use of org.apache.maven.execution.MavenSession in project tycho by eclipse.
the class OsgiSourceMojoTest method testDefaultClassifier.
public void testDefaultClassifier() throws Exception {
File basedir = getBasedir("bundle01");
List<MavenProject> projects = getSortedProjects(basedir, basedir);
MavenSession session = newMavenSession(projects.get(0));
OsgiSourceMojo sourceMojo = (OsgiSourceMojo) lookupMojoWithDefaultConfiguration(projects.get(0), session, "plugin-source");
assertEquals(ReactorProject.SOURCE_ARTIFACT_CLASSIFIER, sourceMojo.getClassifier());
}
use of org.apache.maven.execution.MavenSession in project tycho by eclipse.
the class BuildPropertiesParserImpl method interpolate.
protected void interpolate(Properties properties, File baseDir) {
if (properties.isEmpty()) {
return;
}
MavenSession mavenSession = legacySupport.getSession();
if (mavenSession == null) {
logger.warn("No maven session available, values in the build.properties will not be interpolated!");
return;
}
// find the maven project for the currently used basedir, so that the correct maven project is used by the interpolator.
// if no project could be found, it does not make sense to interpolate the properties
MavenProject mavenProject = MavenSessionUtils.getMavenProject(mavenSession, baseDir);
if (mavenProject == null) {
logger.warn("No maven project found for baseDir '" + baseDir.getAbsolutePath() + "', values in the build.properties will not be interpolated!");
return;
}
TychoInterpolator interpolator = new TychoInterpolator(mavenSession, mavenProject);
for (Entry<Object, Object> entry : properties.entrySet()) {
entry.setValue(interpolator.interpolate((String) entry.getValue()));
}
}
use of org.apache.maven.execution.MavenSession in project tycho by eclipse.
the class OSGiProxyConfigurator method afterFrameworkStarted.
@Override
public void afterFrameworkStarted(EmbeddedEquinox framework) {
MavenSession session = context.getSession();
ProxyServiceFacade proxyService = framework.getServiceFactory().getService(ProxyServiceFacade.class);
// make sure there is no old state from previous aborted builds
clearProxyConfiguration(proxyService);
for (Proxy proxy : session.getSettings().getProxies()) {
if (proxy.isActive()) {
setProxy(proxyService, proxy);
}
}
}
use of org.apache.maven.execution.MavenSession in project tycho by eclipse.
the class TychoOsgiRuntimeLocator method locateRuntime.
@Override
public void locateRuntime(EquinoxRuntimeDescription description) throws MavenExecutionException {
WorkspaceTychoOsgiRuntimeLocator workspaceLocator = WorkspaceTychoOsgiRuntimeLocator.getResolver(this.workspaceState);
MavenSession session = buildContext.getSession();
addRuntimeArtifacts(workspaceLocator, session, description);
for (String systemPackage : SYSTEM_PACKAGES_EXTRA) {
description.addExtraSystemPackage(systemPackage);
}
if (workspaceLocator != null) {
workspaceLocator.addPlatformProperties(description);
}
}
Aggregations