How to include my own RunConfigurationExtension in MavenRunConfiguration?

Answered

I'd like to extend Maven's Run configuration with another tab. Currently there are 4 tabs: Parameters, General, Runner, Logs. To me it looks like these tabs are hardcoded inside the source code:

@NotNull
@Override
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
SettingsEditorGroup<MavenRunConfiguration> group = new SettingsEditorGroup<>();

group.addEditor(RunnerBundle.message("maven.runner.parameters.title"), new MavenRunnerParametersSettingEditor(getProject()));

group.addEditor(CommonBundle.message("tab.title.general"), new MavenGeneralSettingsEditor(getProject()));
group.addEditor(RunnerBundle.message("maven.tab.runner"), new MavenRunnerSettingsEditor(getProject()));
group.addEditor(ExecutionBundle.message("logs.tab.title"), new LogConfigurationPanel<>());
return group;
}

Is there any way to add my own tab to this group?

5 comments
Comment actions Permalink

What is the purpose of this additional tab/what do you want to customize in Maven behavior?

 

See com.intellij.execution.configuration.RunConfigurationExtensionBase

0
Comment actions Permalink

I'm attaching a Java Agent to the application and I'd like to customize how the agent behaves. Only the Maven Configuration does not support this kind of functionality. Other Run Configurations like Gradle, Spring, JUnit etc. support it.

0
Comment actions Permalink

Yann Cebron
So, I created my own RunConfigurationExtensionBase by extending

RunConfigurationExtension

but even if I return true in isApplicableFor() my custom tab is not applied to the Maven template. It works with everything else including Gradle, Junit, Spring, Application but not with Maven.

Update: I am sure I implemented the correct methods, because my Tab which extends

SettingsEditor

does show up and everything else works as expected, but still it doesn't work for the Maven configuration/template. I tested it and if I have a Maven Configuration, the isApplicable() method is not even called for Maven. For everything else (Gradle, Spring, JUnit etc.) it is called.

0
Comment actions Permalink

Unfortunately no. Maven plugin, by historic reasons, have another codebase than other build systems. Could you please create a feature request, it is not hard to add support for RunConfigurationExtension EP, but this need to be implemented. And this will be implemented only in next big release (2020.3)

0

Please sign in to leave a comment.