-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trace test execution directories in the remote maven execution
Currently running tests in maven via m2e is possible but not very convenient as one still needs to navigate to the results then open the correct file. Another pitfall is that even if one has opened the file once, the "classic" JUnit view not update the view even when the file changes afterwards. This now adds a new process tracking of test executions directories that then can be watched on the m2e side and display the new advanced JUnit view when the run has finished.
- Loading branch information
Showing
10 changed files
with
424 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
....m2e.maven.runtime/src/main/java/org/eclipse/m2e/internal/maven/listener/M2eEventSpy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2022, 2024 Hannes Wellmann and others | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Hannes Wellmann - initial API and implementation | ||
* Christoph Läubrich - factored out | ||
********************************************************************************/ | ||
|
||
package org.eclipse.m2e.internal.maven.listener; | ||
|
||
import javax.inject.Named; | ||
import javax.inject.Singleton; | ||
|
||
import org.apache.maven.eventspy.EventSpy; | ||
import org.apache.maven.execution.ExecutionEvent; | ||
import org.apache.maven.execution.ExecutionEvent.Type; | ||
|
||
import com.google.inject.Inject; | ||
|
||
/** | ||
* This {@link EventSpy} listens to certain events within a Maven build JVM and | ||
* sends certain data (e.g. about projects being built) to the JVM of the | ||
* Eclipse IDE that launched the Maven build JVM. | ||
* | ||
* @author Hannes Wellmann | ||
* | ||
*/ | ||
@Named("m2e") | ||
@Singleton | ||
public class M2eEventSpy implements EventSpy { | ||
|
||
private M2EMavenBuildDataBridge bridge; | ||
static final String PROJECT_START_EVENT = "PSE#"; | ||
|
||
@Inject | ||
public M2eEventSpy(M2EMavenBuildDataBridge bridge) { | ||
this.bridge = bridge; | ||
} | ||
|
||
@Override | ||
public void init(Context context) throws Exception { | ||
|
||
} | ||
|
||
@Override | ||
public void onEvent(Object event) throws Exception { | ||
if (!bridge.isActive()) { | ||
return; | ||
} | ||
if (event instanceof ExecutionEvent) { | ||
ExecutionEvent executionEvent = (ExecutionEvent) event; | ||
if (executionEvent.getType() == Type.ProjectStarted) { | ||
String message = M2eEventSpy.PROJECT_START_EVENT | ||
+ MavenProjectBuildData.serializeProjectData(executionEvent.getProject()); | ||
bridge.sendMessage(message); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void close() throws Exception { | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.