private File logFile(MavenSession session) { String path = session.getUserProperties().getProperty(OUTPUT_FILE, DEFAULT_FILE_DESTINATION); if (new File(path).isAbsolute()) { return new File(path); } String buildDir = session.getExecutionRootDirectory(); return new File(buildDir, path); }
@Override public void afterProjectsRead(MavenSession session) { MavenExecutionRequest request = session.getRequest(); ExecutionListener original = request.getExecutionListener(); BuildEventListener listener = new BuildEventListener(logFile(session)); ExecutionListener chain = new ExecutionListenerChain(original, listener); request.setExecutionListener(chain); }