public static void importMavenProject ( IWorkspaceRoot workspaceRoot , String projectName , boolean addSarlSpecificSourceFolders , IProgressMonitor monitor ) { // XXX: The m2e plugin seems to have an issue for creating a fresh project with the SARL plugin as an extension. // Solution: Create a simple project, and switch to a real SARL project. final WorkspaceJob bugFixJob = new WorkspaceJob ( "Creating Simple Maven project" ) { //$NON-NLS-1$ @ SuppressWarnings ( "synthetic-access" ) @ Override public IStatus runInWorkspace ( IProgressMonitor monitor ) throws CoreException { try { final SubMonitor submon = SubMonitor . convert ( monitor , 3 ) ; forceSimplePom ( workspaceRoot , projectName , submon . newChild ( 1 ) ) ; final AbstractProjectScanner < MavenProjectInfo > scanner = getProjectScanner ( workspaceRoot , projectName ) ; scanner . run ( submon . newChild ( 1 ) ) ; final ProjectImportConfiguration importConfiguration = new ProjectImportConfiguration ( ) ; runFixedImportJob ( addSarlSpecificSourceFolders , scanner . getProjects ( ) , importConfiguration , null , submon . newChild ( 1 ) ) ; } catch ( Exception exception ) { return SARLMavenEclipsePlugin . getDefault ( ) . createStatus ( IStatus . ERROR , exception ) ; } return Status . OK_STATUS ; } } ; bugFixJob . setRule ( MavenPlugin . getProjectConfigurationManager ( ) . getRule ( ) ) ; bugFixJob . schedule ( ) ; }
Create a fresh Maven project from existing files assuming a pom file exists .