org.apache.maven.MavenExecutionException Java Examples
The following examples show how to use
org.apache.maven.MavenExecutionException.
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: SmartTestingMavenConfigurer.java From smart-testing with Apache License 2.0 | 6 votes |
@Override public void afterProjectsRead(MavenSession session) throws MavenExecutionException { Log.setLoggerFactory(new MavenExtensionLoggerFactory(mavenLogger)); loadConfigAndCheckIfInstallationShouldBeSkipped(session); if (skipExtensionInstallation) { return; } logger.debug("Version: %s", ExtensionVersion.version().toString()); logger.debug("Applied user properties: %s", session.getUserProperties()); File projectDirectory = session.getTopLevelProject().getModel().getProjectDirectory(); logger.info("Enabling extension."); configureExtension(session, configuration); calculateChanges(projectDirectory, configuration); Runtime.getRuntime().addShutdownHook(new Thread(() -> purgeLocalStorageAndExportPom(session))); }
Example #2
Source File: SmartTestingMavenConfigurer.java From smart-testing with Apache License 2.0 | 5 votes |
@Override public void afterSessionEnd(MavenSession session) throws MavenExecutionException { if (skipExtensionInstallation) { return; } if (!configuration.areStrategiesDefined()) { logStrategiesNotDefined(); } purgeLocalStorageAndExportPom(session); }
Example #3
Source File: MavenLifecycleParticipant.java From gitflow-incremental-builder with MIT License | 5 votes |
@Override public void afterProjectsRead(MavenSession session) throws MavenExecutionException { if (Configuration.isHelpRequested(session)) { logHelp(); } if (!Configuration.isEnabled(session)) { logger.info("gitflow-incremental-builder is disabled."); return; } // check prerequisites if (session.getProjectDependencyGraph() == null) { logger.warn("Execution of gitflow-incremental-builder is not supported in this environment: " + "Current MavenSession does not provide a ProjectDependencyGraph. " + "Consider disabling gitflow-incremental-builder via property: " + Property.enabled.fullOrShortName()); return; } logger.info("gitflow-incremental-builder {} starting...", implVersion); try { unchangedProjectsRemover.act(); } catch (Exception e) { boolean isSkipExecException = e instanceof SkipExecutionException; if (!configProvider.get().failOnError || isSkipExecException) { logger.info("gitflow-incremental-builder execution skipped: {}", (isSkipExecException ? e.getMessage() : e.toString())); logger.debug("Full exception:", e); } else { throw new MavenExecutionException("Exception during gitflow-incremental-builder execution occurred.", e); } } logger.info("gitflow-incremental-builder exiting..."); }
Example #4
Source File: MavenLifecycleParticipantTest.java From gitflow-incremental-builder with MIT License | 5 votes |
@Test public void onRuntimeException() throws Exception { RuntimeException runtimeException = new RuntimeException("FAIL !!!"); doThrow(runtimeException).when(unchangedProjectsRemoverMock).act(); assertThatExceptionOfType(MavenExecutionException.class).isThrownBy(() -> underTest.afterProjectsRead(mavenSessionMock)) .withCause(runtimeException); }
Example #5
Source File: DetectExtension.java From os-maven-plugin with Apache License 2.0 | 5 votes |
@Override public void afterProjectsRead(MavenSession session) throws MavenExecutionException { // Detect the OS and CPU architecture. final Properties sessionProps = new Properties(); sessionProps.putAll(session.getSystemProperties()); sessionProps.putAll(session.getUserProperties()); try { detector.detect(sessionProps, getClassifierWithLikes(session)); } catch (DetectionException e) { throw new MavenExecutionException(e.getMessage(), session.getCurrentProject().getFile()); } // Generate the dictionary. final Map<String, String> dict = new LinkedHashMap<String, String>(); dict.put(Detector.DETECTED_NAME, sessionProps.getProperty(Detector.DETECTED_NAME)); dict.put(Detector.DETECTED_ARCH, sessionProps.getProperty(Detector.DETECTED_ARCH)); dict.put(Detector.DETECTED_BITNESS, sessionProps.getProperty(Detector.DETECTED_BITNESS)); dict.put(Detector.DETECTED_CLASSIFIER, sessionProps.getProperty(Detector.DETECTED_CLASSIFIER)); for (Map.Entry<Object, Object> entry : sessionProps.entrySet()) { if (entry.getKey().toString().startsWith(Detector.DETECTED_RELEASE)) { dict.put(entry.getKey().toString(), entry.getValue().toString()); } } // Inject the current session. injectSession(session, dict); /// Perform the interpolation for the properties of all dependencies. for (MavenProject p: session.getProjects()) { interpolate(dict, p); } }
Example #6
Source File: ManipulatingLifeCycleParticipant.java From pom-manipulation-ext with Apache License 2.0 | 5 votes |
@Override public void afterProjectsRead( final MavenSession mavenSession ) throws MavenExecutionException { final ManipulationException error = session.getError(); if ( error != null ) { throw new MavenExecutionException( "POM Manipulation failed: " + error.getMessage(), error ); } super.afterProjectsRead( mavenSession ); }
Example #7
Source File: DeployParticipant.java From takari-lifecycle with Eclipse Public License 1.0 | 5 votes |
@Override public void afterSessionEnd(MavenSession session) throws MavenExecutionException { boolean errors = !session.getResult().getExceptions().isEmpty(); if (!deployAtEndRequests.isEmpty()) { log.info(""); log.info("------------------------------------------------------------------------"); if (errors) { log.info("-- Not performing deploy at end due to errors --"); } else { log.info("-- Performing deploy at end --"); log.info("------------------------------------------------------------------------"); synchronized (deployAtEndRequests) { for (DeployRequest deployRequest : deployAtEndRequests) { try { deploy(session.getRepositorySession(), deployRequest); } catch (DeploymentException e) { log.error(e.getMessage(), e); throw new MavenExecutionException(e.getMessage(), e); } } deployAtEndRequests.clear(); } } log.info("------------------------------------------------------------------------"); } }