use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenModuleWizardStep method updateStep.
@Override
public void updateStep() {
if (myArchetypes != null && myArchetypes.isSkipUpdateUI())
return;
if (isMavenizedProject()) {
MavenProject parent = findPotentialParentProject(myProjectOrNull);
myAggregator = parent;
myParent = parent;
}
MavenId projectId = myBuilder.getProjectId();
if (projectId == null) {
setTestIfEmpty(myArtifactIdField, myBuilder.getName());
setTestIfEmpty(myGroupIdField, myParent == null ? myBuilder.getName() : myParent.getMavenId().getGroupId());
setTestIfEmpty(myVersionField, myParent == null ? "1.0-SNAPSHOT" : myParent.getMavenId().getVersion());
} else {
setTestIfEmpty(myArtifactIdField, projectId.getArtifactId());
setTestIfEmpty(myGroupIdField, projectId.getGroupId());
setTestIfEmpty(myVersionField, projectId.getVersion());
}
myInheritGroupIdCheckBox.setSelected(myBuilder.isInheritGroupId());
myInheritVersionCheckBox.setSelected(myBuilder.isInheritVersion());
if (myArchetypes != null) {
myArchetypes.requestUpdate();
}
updateComponents();
}
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");
}
Aggregations