Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Bricon2014-09-30 18:52:49 +0000
committerFred Bricon2014-09-30 18:53:47 +0000
commitd6a903b7e4886d0ae8d24b4240d0fb93d78d51bb (patch)
treea0e842093e093675206e36d1b7885ea1cf4db6c9
parentab495e942fdb3b5d0652c8a3454118511b3c46cc (diff)
downloadm2e-core-d6a903b7e4886d0ae8d24b4240d0fb93d78d51bb.tar.gz
m2e-core-d6a903b7e4886d0ae8d24b4240d0fb93d78d51bb.tar.xz
m2e-core-d6a903b7e4886d0ae8d24b4240d0fb93d78d51bb.zip
343038 : support [name] template in project import
Signed-off-by: Fred Bricon <fbricon@gmail.com>
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/ResolverConfigurationComponent.java3
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/ProjectImportConfiguration.java7
2 files changed, 9 insertions, 1 deletions
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/ResolverConfigurationComponent.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/ResolverConfigurationComponent.java
index 883a61e7..99f23c62 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/ResolverConfigurationComponent.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/ResolverConfigurationComponent.java
@@ -42,7 +42,8 @@ public class ResolverConfigurationComponent extends ExpandableComposite {
private static final String[] DEFAULT_NAME_TEMPLATES = {"[artifactId]", // //$NON-NLS-1$
"[artifactId]-TRUNK", // //$NON-NLS-1$
"[artifactId]-[version]", // //$NON-NLS-1$
- "[groupId].[artifactId]", "[groupId].[artifactId]-[version]"}; //$NON-NLS-1$ //$NON-NLS-2$
+ "[groupId].[artifactId]", "[groupId].[artifactId]-[version]", //$NON-NLS-1$ //$NON-NLS-2$
+ "[name]"}; //$NON-NLS-1$
/** The resolver configuration */
protected final ResolverConfiguration resolverConfiguration;
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/ProjectImportConfiguration.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/ProjectImportConfiguration.java
index 883f8ce0..3e2a7d54 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/ProjectImportConfiguration.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/ProjectImportConfiguration.java
@@ -39,6 +39,8 @@ public class ProjectImportConfiguration {
private static final String VERSION = "\\[version\\]"; //$NON-NLS-1$
+ private static final String NAME = "\\[name\\]"; //$NON-NLS-1$
+
/** resolver configuration bean */
private ResolverConfiguration resolverConfiguration;
@@ -90,10 +92,15 @@ public class ProjectImportConfiguration {
if(version == null && model.getParent() != null) {
version = model.getParent().getVersion();
}
+ String name = model.getName();
+ if(name == null || name.trim().isEmpty()) {
+ name = artifactId;
+ }
// XXX needs MavenProjectManager update to resolve groupId and version
return projectNameTemplate.replaceAll(GROUP_ID, cleanProjectNameComponent(groupId, true))
.replaceAll(ARTIFACT_ID, cleanProjectNameComponent(artifactId, true))
+ .replaceAll(NAME, cleanProjectNameComponent(name, true))
.replaceAll(VERSION, version == null ? "" : cleanProjectNameComponent(version, true)); //$NON-NLS-1$
}

Back to the top