public void ensureDependenciesAreResolved(MavenSession session, MojoExecution execution, IProgressMonitor monitor) throws CoreException {
artifacts = project.getArtifacts();
dependencyArtifacts = project.getDependencyArtifacts();
try {
MojoExecutor mojoExecutor = lookup(MojoExecutor.class);
DependencyContext dependencyContext = mojoExecutor.newDependencyContext(session,
Collections.singletonList(execution));
mojoExecutor.ensureDependenciesAreResolved(execution.getMojoDescriptor(), session, dependencyContext);
} catch(Exception ex) {
dispose();
}
}