Search in sources :

Example 1 with ProjectImportConfiguration

use of org.eclipse.m2e.core.project.ProjectImportConfiguration in project sling by apache.

the class AbstractNewMavenBasedSlingApplicationWizard method createProjects.

@Override
protected List<IProject> createProjects(IProgressMonitor monitor) throws CoreException {
    IPath location = chooseArchetypePage.getLocation();
    Archetype archetype = chooseArchetypePage.getSelectedArchetype();
    String groupId = archetypeParametersPage.getGroupId();
    String artifactId = archetypeParametersPage.getArtifactId();
    String version = archetypeParametersPage.getVersion();
    String javaPackage = archetypeParametersPage.getJavaPackage();
    Properties properties = archetypeParametersPage.getProperties();
    ProjectImportConfiguration configuration = new ProjectImportConfiguration();
    IProject existingProject = ResourcesPlugin.getWorkspace().getRoot().getProject(artifactId);
    if (existingProject != null && existingProject.exists()) {
        throw new IllegalStateException("A project with the name " + artifactId + " already exists.");
    }
    advance(monitor, 1);
    List<IProject> projects = MavenPlugin.getProjectConfigurationManager().createArchetypeProjects(location, archetype, groupId, artifactId, version, javaPackage, properties, configuration, new NullProgressMonitor());
    monitor.worked(3);
    return projects;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IPath(org.eclipse.core.runtime.IPath) ProjectImportConfiguration(org.eclipse.m2e.core.project.ProjectImportConfiguration) Archetype(org.apache.maven.archetype.catalog.Archetype) Properties(java.util.Properties) IProject(org.eclipse.core.resources.IProject)

Aggregations

Properties (java.util.Properties)1 Archetype (org.apache.maven.archetype.catalog.Archetype)1 IProject (org.eclipse.core.resources.IProject)1 IPath (org.eclipse.core.runtime.IPath)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 ProjectImportConfiguration (org.eclipse.m2e.core.project.ProjectImportConfiguration)1