Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] JavaLaunchDelegate : add maven dependencies to classpath

Hi,
I created MyJavaLaunchDelegate that extends JavaLaunchDelegate for running my own type of files. Files are inside JavaProject with m2e nature. I would like to add maven dependencies to the classpath of my run.

As I know I have to put them into:

@Override
public String[] getClasspath(ILaunchConfiguration configuration) throws CoreException {
List<String> extendedClasspath = new ArrayList<>();
Collections.addAll(extendedClasspath, super.getClasspath(configuration));
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(configuration.getAttribute(SystemInCloudLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""));
IPath path = project.getLocation();
extendedClasspath.add(path.toString() + "/target/test-classes");
extendedClasspath.add(path.toString() + "/target/classes");
...
return extendedClasspath.toArray(new String[extendedClasspath.size()]);
}

I am adding already classes of my project.
I will be thankful for any tips.

Marek


--
Marek Jagielski


Back to the top