use of org.apache.maven.execution.MavenSession in project docker-maven-plugin by fabric8io.
the class DockerAssemblyConfigurationSource method createCommandLinePropertiesInterpolator.
private FixedStringSearchInterpolator createCommandLinePropertiesInterpolator() {
Properties commandLineProperties = System.getProperties();
final MavenSession session = getMavenSession();
if (session != null) {
commandLineProperties = new Properties();
if (session.getSystemProperties() != null) {
commandLineProperties.putAll(session.getSystemProperties());
}
if (session.getUserProperties() != null) {
commandLineProperties.putAll(session.getUserProperties());
}
}
PropertiesBasedValueSource cliProps = new PropertiesBasedValueSource(commandLineProperties);
return FixedStringSearchInterpolator.create(cliProps);
}
use of org.apache.maven.execution.MavenSession in project build-info by JFrogDev.
the class BuildInfoRecorder method extract.
@Override
public Build extract(ExecutionEvent event) {
MavenSession session = event.getSession();
if (!session.getResult().hasExceptions()) {
if (conf.isIncludeEnvVars()) {
Properties envProperties = new Properties();
envProperties.putAll(conf.getAllProperties());
envProperties = BuildInfoExtractorUtils.getEnvProperties(envProperties, conf.getLog());
for (Map.Entry<Object, Object> envProp : envProperties.entrySet()) {
buildInfoBuilder.addProperty(envProp.getKey(), envProp.getValue());
}
}
Date finish = new Date();
long time = finish.getTime() - session.getRequest().getStartTime().getTime();
return buildInfoBuilder.durationMillis(time).build();
}
return null;
}
use of org.apache.maven.execution.MavenSession in project tycho by eclipse.
the class BuildPropertiesParserImplTest method setup.
@Before
public void setup() throws IllegalArgumentException, IllegalAccessException {
legacySupport = mock(LegacySupport.class);
mavenSession = mock(MavenSession.class);
project1 = mock(MavenProject.class);
project2 = mock(MavenProject.class);
logger = mock(Logger.class);
when(legacySupport.getSession()).thenReturn(mavenSession);
when(mavenSession.getProjects()).thenReturn(Arrays.asList(project1, project2));
when(project1.getBasedir()).thenReturn(new File("/bathToProject1"));
when(project2.getBasedir()).thenReturn(new File("/bathToProject2"));
parser = new BuildPropertiesParserImpl(legacySupport, logger);
}
use of org.apache.maven.execution.MavenSession in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReaderTest method testAddTargetWithValidTargetDefinition.
@Test
public void testAddTargetWithValidTargetDefinition() {
Xpp3Dom dom = createGavConfiguration("myGroupId", "myArtifactId", "myVersion");
MavenSession session = setupMockSession();
TargetPlatformConfiguration configuration = new TargetPlatformConfiguration();
configurationReader.addTargetArtifact(configuration, session, null, dom);
assertEquals(1, configuration.getTargets().size());
assertEquals(new File("/basedir/myArtifactId.target").getPath(), configuration.getTargets().get(0).getPath());
}
use of org.apache.maven.execution.MavenSession 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"));
}
}
Aggregations