use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenProjectImportProvider method createSteps.
public ModuleWizardStep[] createSteps(final WizardContext wizardContext) {
final ProjectWizardStepFactory stepFactory = ProjectWizardStepFactory.getInstance();
return new ModuleWizardStep[] { new MavenProjectImportStep(wizardContext), new SelectProfilesStep(wizardContext), new SelectImportedProjectsStep<MavenProject>(wizardContext) {
@Override
protected String getElementText(final MavenProject project) {
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(project.getMavenId());
VirtualFile root = ((MavenProjectBuilder) getBuilder()).getRootDirectory();
if (root != null) {
final String relPath = VfsUtilCore.getRelativePath(project.getDirectoryFile(), root, File.separatorChar);
if (StringUtil.isNotEmpty(relPath)) {
stringBuilder.append(" [").append(relPath).append("]");
}
}
if (!isElementEnabled(project)) {
stringBuilder.append(" (project is ignored. See ").append(CommonBundle.settingsActionPath()).append(" | Maven | Ignored Files)");
}
return stringBuilder.toString();
}
@Override
protected boolean isElementEnabled(MavenProject mavenProject) {
Project project = wizardContext.getProject();
if (project == null)
return true;
return !MavenProjectsManager.getInstance(project).isIgnored(mavenProject);
}
@Override
public void updateDataModel() {
super.updateDataModel();
getWizardContext().setProjectName(((MavenProjectBuilder) getBuilder()).getSuggestedProjectName());
}
@Override
public String getHelpId() {
return "reference.dialogs.new.project.import.maven.page3";
}
}, stepFactory.createProjectJdkStep(wizardContext), stepFactory.createNameAndLocationStep(wizardContext) };
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class InvalidProjectImportingTest method testInvalidRepositoryLayout.
public void testInvalidRepositoryLayout() throws Exception {
importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<distributionManagement>" + " <repository>" + " <id>test</id>" + " <url>http://www.google.com</url>" + // invalid layout
" <layout>nothing</layout>" + " </repository>" + "</distributionManagement>");
assertModules("project");
MavenProject root = getRootProjects().get(0);
assertProblems(root, "Cannot find layout implementation corresponding to: 'nothing' for remote repository with id: 'test'.");
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class InvalidProjectImportingTest method testDoNotFailIfRepositoryHasEmptyLayout.
public void testDoNotFailIfRepositoryHasEmptyLayout() throws Exception {
importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<repositories>" + " <repository>" + " <id>foo1</id>" + " <url>bar1</url>" + " <layout/>" + " </repository>" + "</repositories>" + "<pluginRepositories>" + " <pluginRepository>" + " <id>foo2</id>" + " <url>bar2</url>" + " <layout/>" + " </pluginRepository>" + "</pluginRepositories>");
MavenProject root = getRootProjects().get(0);
assertProblems(root);
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class InvalidProjectImportingTest method testUnknownProblem.
public void testUnknownProblem() throws Exception {
importProject("");
assertModules("project");
MavenProject root = getRootProjects().get(0);
assertProblems(root, "'pom.xml' has syntax errors");
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class InvalidProjectImportingTest method testUnresolvedPlugins.
@Bombed(user = "Vladislav.Soroka", year = 2020, month = Calendar.APRIL, day = 1, description = "temporary disabled")
public void testUnresolvedPlugins() throws Exception {
importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<build>" + " <plugins>" + " <plugin>" + " <groupId>xxx</groupId>" + " <artifactId>yyy</artifactId>" + " <version>1</version>" + " </plugin>" + " </plugins>" + "</build>");
MavenProject root = getRootProjects().get(0);
assertProblems(root, "Unresolved plugin: 'xxx:yyy:1'");
}
Aggregations