enhancing classpath before runner runs.

Hi,

 

since IDEA is not capable of supplying extra jars on runner configuration, i thought about writing a plugin. I ve read a little bit about the ecosysstem and would love to hear feedback if this is the correct route. Especially then classpath enhancement path.

1) define extension as in:

<extensions defaultExtensionNs="com.intellij">
<RunConfigurationBeforeRunProviderDelegate implementation="MyTestPackage.MyTestExtension" />
</extensions>

2) implement RunConfigurationBeforeRunProviderDelegate.java Interface

When implementing this interface, i am getting a ExecutionEnvironment object passed into the beforeRun() method, which i need to implement.

Is it possible at all to mock with the classpath somewhere in ExecutionEnvironment object? Since this is a void method, i suspect that the runner itself uses this object passed by reference. 

Is the ExecutionEnvironment prefilled with all the stuff which IDEA evaluated? Meaning.. current classpath based on the IDE libraries / gradle / maven whatever setting.

3) Are there any examples how to configure a plugin (extension) setting panel so that i can enter some rules for classpath mockery? 

 

Thanks for infos and if thats the way i could go. 

 

Note: One shouldnt need to write a plugin for basic IDE functionality like this ;-)

0
2 comments
Avatar
Permanently deleted user

Ok. Built somethng but i dont get called by the extension hooks. This is my plugin.xml

 

<extensions defaultExtensionNs="com.intellij">
<runConfigurationBeforeRunProviderDelegate implementation="de.logentis.rcpe.RunConfigExtension" />
<runConfigurationExtension implementation="de.logentis.rcpe.RunConfigExtension2"/>
</extensions>

<actions>
<group id="MyPlugin.SampleMenu" text="Greeting" description="Greeting menu">
<add-to-group group-id="MainMenu" anchor="last"/>
<action id="Myplugin.Textboxes" class="de.logentis.rcpe.HelloAction" text="Hello" description="Says hello"/>
</group>
</actions>

 The action works without a problem. But i cant hook into the runner process via extensions. I tried two extension points with dummy implmementations who only print out stuff. Neither of them work.
My testcase is simple: just create a "Application" Runner and execute the runner. Normally i should see my system.println from the extension.
Thanks for hints. 

0
Avatar
Permanently deleted user

Just tried to create and test runConfigurationExtension (from IDEA 19.1, Gradle build, Debug mode), and it works fine for me - debugger stops at both isApplicableFor() and updateJavaParameters() methods, System.out prints to the console of the first IDE. Maybe there is something wrong with your implementation or deployment.

public class MyExtension extends RunConfigurationExtension {
@Override
public <T extends RunConfigurationBase> void updateJavaParameters(T configuration, JavaParameters params, RunnerSettings runnerSettings) throws ExecutionException {
System.out.println("updateJavaParameters: configuration = " + configuration);
}

@Override
public boolean isApplicableFor(@NotNull RunConfigurationBase<?> configuration) {
System.out.println("isApplicableFor: configuration = " + configuration);
return true;
}
}
<extensions defaultExtensionNs="com.intellij">
<runConfigurationExtension implementation="test.MyExtension"/>
</extensions>

0

Please sign in to leave a comment.