Author: fbricon
Date: 2012-02-16 13:19:57 -0500 (Thu, 16 Feb 2012)
New Revision: 38840
Added:
trunk/maven/plugins/org.jboss.tools.maven.core/poms/jsf-template20.xml
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDataModelProvider.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDelegate.java
trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators/HibernateProjectConfigurator.java
trunk/maven/plugins/org.jboss.tools.maven.seam/poms/parent-pom.xml
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/MavenPostInstallListener.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java
Log:
JBIDE-10762 : cleaned up mavenification of projects, added JSF 2.0 maven library provider
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/plugin.properties 2012-02-16 18:17:15
UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/plugin.properties 2012-02-16 18:19:57
UTC (rev 38840)
@@ -6,6 +6,7 @@
Maven_library_provider=Maven library provider
Maven_JSF_1_2_Libraries=Maven JSF 1.2 Libraries
Maven_JSF_1_1_Libraries=Maven JSF 1.1 Libraries
+Maven_JSF_2_0_Libraries=Maven JSF 2.0 Libraries
Hibernate_3_3_2_Libraries=Hibernate 3.3.2 Libraries
Maven_Portlet_1_0_Libraries=Maven Portlet 1.0 Libraries
Maven_Portlet_2_0_Libraries=Maven Portlet 2.0 Libraries
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml 2012-02-16 18:17:15 UTC (rev
38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml 2012-02-16 18:19:57 UTC (rev
38840)
@@ -39,6 +39,10 @@
facet="jst.connector"
soft="true"
version="[1.0"/>
+ <requires
+ facet="jst.webfragment"
+ soft="true"
+ version="[3.0"/>
</or>
</constraint>
</project-facet-version>
@@ -116,8 +120,24 @@
</enablement>
</provider>
</extension>
-
+
<extension
point="org.eclipse.jst.common.project.facet.core.libraryProviders">
+ <provider id="jsf20-maven-library-provider"
extends="maven-library-provider">
+ <label>%Maven_JSF_2_0_Libraries</label>
+ <param name="template"
value="platform:/plugin/org.jboss.tools.maven.core/poms/jsf-template20.xml"/>
+ <enablement>
+ <and>
+ <with variable="projectFacets">
+ <test property="org.jboss.tools.maven.core.projectFacets"
value="jst.jsf,jboss.m2" forcePluginActivation="true"/>
+ </with>
+ <with variable="requestingProjectFacet">
+ <test
property="org.eclipse.wst.common.project.facet.core.projectFacet"
value="jst.jsf:2.0" forcePluginActivation="true"/>
+ </with>
+ </and>
+ </enablement>
+ </provider>
+ </extension>
+ <extension
point="org.eclipse.jst.common.project.facet.core.libraryProviders">
<provider id="hibernate332-maven-library-provider"
extends="maven-library-provider">
<label>%Hibernate_3_3_2_Libraries</label>
<param name="template"
value="platform:/plugin/org.jboss.tools.maven.core/poms/hibernate332-template.xml"/>
@@ -170,6 +190,7 @@
</enablement>
</provider>
</extension>
+
<extension
point="org.eclipse.jst.common.project.facet.core.libraryProviders">
<provider id="portletbridge200alpha-maven-library-provider"
extends="maven-library-provider">
Added: trunk/maven/plugins/org.jboss.tools.maven.core/poms/jsf-template20.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/poms/jsf-template20.xml
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/poms/jsf-template20.xml 2012-02-16
18:19:57 UTC (rev 38840)
@@ -0,0 +1,30 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>template</groupId>
+ <artifactId>template</artifactId>
+ <packaging>pom</packaging>
+ <version>0.0.1-SNAPSHOT</version>
+ <properties>
+ <javaee6.web.spec.version>2.0.0.Final</javaee6.web.spec.version>
+ </properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-web-6.0</artifactId>
+ <version>${javaee6.web.spec.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec.javax.faces</groupId>
+ <artifactId>jboss-jsf-api_2.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2012-02-16
18:17:15 UTC (rev 38839)
+++
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2012-02-16
18:19:57 UTC (rev 38840)
@@ -49,17 +49,17 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jst.common.project.facet.JavaFacetUtils;
import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.MavenModelManager;
import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.m2e.core.project.IProjectConfigurationManager;
import org.eclipse.m2e.jdt.internal.BuildPathManager;
import org.eclipse.m2e.model.edit.pom.Dependency;
+import org.eclipse.m2e.model.edit.pom.DependencyManagement;
import org.eclipse.m2e.model.edit.pom.PomFactory;
import org.eclipse.m2e.model.edit.pom.PropertyElement;
import org.eclipse.m2e.model.edit.pom.Repository;
@@ -69,7 +69,7 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.osgi.framework.BundleContext;
/**
@@ -91,6 +91,10 @@
public static final String ENCODING = "UTF-8"; //$NON-NLS-1$
public static final List<LibraryProviderOperationConfig>
libraryProviderOperationConfigs = new ArrayList<LibraryProviderOperationConfig>();
+
+ private static final String DEFAULT_COMPILER_LEVEL = "1.5"; //$NON-NLS-1$
+
+ private static final String DEFAULT_WEBCONTENT_ROOT = "src/main/webapp";
//$NON-NLS-1$
// The shared instance
private static MavenCoreActivator plugin;
@@ -165,50 +169,6 @@
}
project.open(monitor);
}
- IJavaProject javaProject = JavaCore.create(project);
- IProjectDescription description = project.getDescription();
- String[] natureIds = description.getNatureIds();
- boolean hasJavaNature = false;
- for (int i = 0; i < natureIds.length; i++) {
- if (JavaCore.NATURE_ID.equals(natureIds[i])) {
- hasJavaNature = true;
- break;
- }
- }
- if (!hasJavaNature) {
- // EAR project
- createFolder("target",monitor, project); //$NON-NLS-1$
- IFolder binFolder = createFolder("target/classes",monitor, project);
//$NON-NLS-1$
- String[] newNatureIds = new String[natureIds.length + 1];
- for (int i = 0; i < natureIds.length; i++) {
- newNatureIds[i]=natureIds[i];
- }
- newNatureIds[natureIds.length] = JavaCore.NATURE_ID;
- description.setNatureIds(newNatureIds);
- project.setDescription(description, monitor);
- javaProject.setRawClasspath(new IClasspathEntry[0], monitor);
- javaProject.setOutputLocation(binFolder.getFullPath(), monitor);
- IClasspathEntry entry = JavaRuntime.getDefaultJREContainerEntry();
- IClasspathEntry[] entries = javaProject.getRawClasspath();
- IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
- System.arraycopy(entries, 0, newEntries, 0, entries.length);
- newEntries[entries.length] = entry;
- javaProject.setRawClasspath(newEntries, monitor);
- }
- if (FacetedProjectFramework.hasProjectFacet(project,
IJ2EEFacetConstants.ENTERPRISE_APPLICATION)) {
- String sourceDirectory = getSourceDirectory(javaProject);
- if (sourceDirectory == null || sourceDirectory.trim().length() <= 0) {
- IVirtualComponent component = ComponentCore.createComponent(project);
- IVirtualFolder rootVFolder = component.getRootFolder();
- IContainer rootFolder = rootVFolder.getUnderlyingFolder();
- IPath path = rootFolder.getFullPath();
- IClasspathEntry[] entries = javaProject.getRawClasspath();
- IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
- System.arraycopy(entries, 0, newEntries, 0, entries.length);
- newEntries[entries.length] = JavaCore.newSourceEntry(path);
- javaProject.setRawClasspath(newEntries, monitor);
- }
- }
addMavenCapabilities(project, monitor, model);
return project;
}
@@ -254,8 +214,7 @@
boolean hasJavaNature = project.hasNature(JavaCore.NATURE_ID);
if (hasJavaNature) {
IJavaProject javaProject = JavaCore.create(project);
- IClasspathContainer mavenContainer = BuildPathManager
- .getMaven2ClasspathContainer(javaProject);
+ IClasspathContainer mavenContainer =
BuildPathManager.getMaven2ClasspathContainer(javaProject);
if (mavenContainer == null) {
IPath path = new Path(BuildPathManager.CONTAINER_ID);
setContainerPath(monitor, javaProject, path);
@@ -325,34 +284,46 @@
public static void updateMavenProjectConfiguration(IProject project)
throws CoreException {
- IProjectConfigurationManager configurationManager = MavenPlugin
- .getDefault().getProjectConfigurationManager();
- configurationManager.updateProjectConfiguration(project,
- new NullProgressMonitor());
+ IProjectConfigurationManager configurationManager =
MavenPlugin.getProjectConfigurationManager();
+ configurationManager.updateProjectConfiguration(project, new NullProgressMonitor());
}
- public static void addMavenWarPlugin(Build build, IProject project) throws
JavaModelException {
- org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
- plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
- plugin.setArtifactId("maven-war-plugin"); //$NON-NLS-1$
-
- Xpp3Dom configuration = new Xpp3Dom( "configuration" ); //$NON-NLS-1$
+ public static void addMavenWarPlugin(Build build, IProject project, IProjectFacetVersion
webFacetversion) throws JavaModelException {
IVirtualComponent component = ComponentCore.createComponent(project);
+ if (component == null) {
+ return;
+ }
IVirtualFolder rootFolder = component.getRootFolder();
IContainer root = rootFolder.getUnderlyingFolder();
String webContentRoot = root.getProjectRelativePath().toString();
- Xpp3Dom warSourceDirectory = new Xpp3Dom("warSourceDirectory");
//$NON-NLS-1$
- if (webContentRoot.startsWith(SEPARATOR)) {
- warSourceDirectory.setValue(MavenCoreActivator.BASEDIR + webContentRoot);
- } else {
- warSourceDirectory.setValue(MavenCoreActivator.BASEDIR + SEPARATOR + webContentRoot);
+ boolean isDefaultWarSource = DEFAULT_WEBCONTENT_ROOT.equals(webContentRoot);
+ boolean needsFailOnMissingWebXml = webFacetversion != null &&
JavaEEProjectUtilities.DYNAMIC_WEB_25.compareTo(webFacetversion) < 1;
+ if (isDefaultWarSource && !needsFailOnMissingWebXml) {
+ return;
}
- configuration.addChild(warSourceDirectory);
+ org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
+ plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
+ plugin.setArtifactId("maven-war-plugin"); //$NON-NLS-1$
+ plugin.setVersion("2.2");//$NON-NLS-1$
+ Xpp3Dom configuration = new Xpp3Dom( "configuration" ); //$NON-NLS-1$
+ if (!isDefaultWarSource){
+ Xpp3Dom warSourceDirectory = new Xpp3Dom("warSourceDirectory");
//$NON-NLS-1$
+ if (webContentRoot.startsWith(SEPARATOR)) {
+ warSourceDirectory.setValue(MavenCoreActivator.BASEDIR + webContentRoot);
+ } else {
+ warSourceDirectory.setValue(MavenCoreActivator.BASEDIR + SEPARATOR +
webContentRoot);
+ }
+ configuration.addChild(warSourceDirectory);
+ }
+ if (needsFailOnMissingWebXml) {
+ Xpp3Dom failOnMissingWebXml = new Xpp3Dom("failOnMissingWebXml");
//$NON-NLS-1$
+ failOnMissingWebXml.setValue("false");//$NON-NLS-1$
+ configuration.addChild(failOnMissingWebXml);
+ }
+
plugin.setConfiguration(configuration);
build.getPlugins().add(plugin);
-
- addResource(build, project, null);
}
public static void addResource(Build build, IProject project, String sourceDirectory)
@@ -373,34 +344,36 @@
build.getResources().add(resource);
}
- public static void addMavenEarPlugin(Build build, IProject project, IDataModel
m2FacetModel, String ejbArtifactId, boolean addModule) throws JavaModelException {
+ public static void addMavenEarPlugin(Build build, IProject project, IDataModel
m2FacetModel, String ejbArtifactId,
+ IProjectFacetVersion earFacetVersion, boolean addSeamModules) throws
JavaModelException {
String sourceDirectory = getEarRoot(project);
- build.setSourceDirectory(sourceDirectory);
org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
plugin.setArtifactId("maven-ear-plugin"); //$NON-NLS-1$
-
+ plugin.setVersion("2.7");//$NON-NLS-1$
Xpp3Dom configuration = new Xpp3Dom( "configuration" ); //$NON-NLS-1$
- Xpp3Dom version = new Xpp3Dom("version"); //$NON-NLS-1$
- version.setValue("5"); //$NON-NLS-1$
- configuration.addChild(version);
- Xpp3Dom generateApplicationXml = new Xpp3Dom("generateApplicationXml");
//$NON-NLS-1$
- generateApplicationXml.setValue("true"); //$NON-NLS-1$
- configuration.addChild(generateApplicationXml);
+ if (earFacetVersion != null) {
+ String earVersion = earFacetVersion.getVersionString();
+ if (earVersion.endsWith(".0")) {//$NON-NLS-1$
+ //YYiikes
+ earVersion = ""+Double.valueOf(earVersion).intValue();//$NON-NLS-1$
+ }
+ Xpp3Dom version = new Xpp3Dom("version"); //$NON-NLS-1$
+ version.setValue(earVersion); //$NON-NLS-1$
+ configuration.addChild(version);
+ }
Xpp3Dom defaultLibBundleDir = new Xpp3Dom("defaultLibBundleDir");
//$NON-NLS-1$
defaultLibBundleDir.setValue("lib"); //$NON-NLS-1$
configuration.addChild(defaultLibBundleDir);
- Xpp3Dom earSourceDirectory = new Xpp3Dom("earSourceDirectory");
//$NON-NLS-1$
- earSourceDirectory.setValue(sourceDirectory);
- configuration.addChild(earSourceDirectory);
+ if(!"src/main/application".equals(sourceDirectory)) {//$NON-NLS-1$
+ Xpp3Dom earSourceDirectory = new Xpp3Dom("earSourceDirectory");
//$NON-NLS-1$
+ earSourceDirectory.setValue(sourceDirectory);
+ configuration.addChild(earSourceDirectory);
+ }
- if (addModule) {
+ if (addSeamModules) {
Xpp3Dom modules = new Xpp3Dom("modules"); //$NON-NLS-1$
configuration.addChild(modules);
-
- Xpp3Dom seamModule = getEarModule("ejbModule", "org.jboss.seam",
//$NON-NLS-1$ //$NON-NLS-2$
- "jboss-seam", ROOT_DIR, null); //$NON-NLS-1$ //$NON-NLS-2$
- modules.addChild(seamModule);
if (ejbArtifactId != null) {
String ejbModuleName = ejbArtifactId + ".jar"; //$NON-NLS-1$
@@ -432,15 +405,10 @@
"commons-digester", "commons-digester", "/lib", null);
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
modules.addChild(commonDigester);
- //Xpp3Dom mvel14 = getEarModule("jarModule", //$NON-NLS-1$
- // "org.mvel", "mvel14", "/", null); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
- //modules.addChild(mvel14);
}
plugin.setConfiguration(configuration);
build.getPlugins().add(plugin);
-
- addResource(build, project, sourceDirectory);
}
private static Xpp3Dom getEarModule(String module,
@@ -467,20 +435,22 @@
return earModule;
}
- public static void addMavenEjbPlugin(Build build, IProject project) throws
JavaModelException {
- org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
- plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
- plugin.setArtifactId("maven-ejb-plugin"); //$NON-NLS-1$
- plugin.setInherited("true"); //$NON-NLS-1$
-
- Xpp3Dom configuration = new Xpp3Dom( "configuration" ); //$NON-NLS-1$
- Xpp3Dom ejbVersion = new Xpp3Dom("ejbVersion"); //$NON-NLS-1$
- ejbVersion.setValue("3.0"); //$NON-NLS-1$
- configuration.addChild(ejbVersion);
- plugin.setConfiguration(configuration);
- build.getPlugins().add(plugin);
-
- addResource(build, project, null);
+ public static void addMavenEjbPlugin(Build build, IProject project, IProjectFacetVersion
ejbFacetVersion) throws JavaModelException {
+ if (ejbFacetVersion != null) {
+ String version = ejbFacetVersion.getVersionString();
+ if (!"2.1".equals(version)) { //$NON-NLS-1$
+ org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
+ plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
+ plugin.setArtifactId("maven-ejb-plugin"); //$NON-NLS-1$
+ plugin.setVersion("2.3"); //$NON-NLS-1$
+ Xpp3Dom configuration = new Xpp3Dom( "configuration" ); //$NON-NLS-1$
+ Xpp3Dom ejbVersion = new Xpp3Dom("ejbVersion"); //$NON-NLS-1$
+ ejbVersion.setValue(version);
+ configuration.addChild(ejbVersion);
+ plugin.setConfiguration(configuration);
+ build.getPlugins().add(plugin);
+ }
+ }
}
public static String getOutputDirectory(IJavaProject javaProject) throws CoreException
{
@@ -512,12 +482,21 @@
addProperties(projectModel,libraryModel);
addRepositories(projectModel,libraryModel);
addPlugins(projectModel,libraryModel);
- addDependencies(projectModel,libraryModel);
+
+ DependencyManagement depMgtProject = projectModel.getDependencyManagement();
+ DependencyManagement depMgtLibrary = libraryModel.getDependencyManagement();
+ if (depMgtLibrary != null && !depMgtLibrary.getDependencies().isEmpty()) {
+ if (depMgtProject == null) {
+ depMgtProject = PomFactory.eINSTANCE.createDependencyManagement();
+ projectModel.setDependencyManagement(depMgtProject);
+ }
+ addDependencies(projectModel.getDependencyManagement().getDependencies(),libraryModel.getDependencyManagement().getDependencies());
+ }
+ //getDependencies() never returns null
+ addDependencies(projectModel.getDependencies(),libraryModel.getDependencies());
}
- private static void addDependencies(org.eclipse.m2e.model.edit.pom.Model projectModel,
org.eclipse.m2e.model.edit.pom.Model libraryModel) {
- List<org.eclipse.m2e.model.edit.pom.Dependency> projectDependencies =
projectModel.getDependencies();
- List<org.eclipse.m2e.model.edit.pom.Dependency> libraryDependencies =
libraryModel.getDependencies();
+ private static void
addDependencies(List<org.eclipse.m2e.model.edit.pom.Dependency> projectDependencies
, List<org.eclipse.m2e.model.edit.pom.Dependency> libraryDependencies) {
for (Dependency dependency:libraryDependencies) {
if (!dependencyExists(dependency,projectDependencies)) {
Dependency newDependency = (Dependency) EcoreUtil.copy(dependency);
@@ -527,8 +506,7 @@
}
- private static boolean dependencyExists(Dependency dependency,
- List<Dependency> projectDependencies) {
+ private static boolean dependencyExists(Dependency dependency, List<Dependency>
projectDependencies) {
String groupId = dependency.getGroupId();
String artifactId = dependency.getArtifactId();
if (artifactId == null) {
@@ -733,12 +711,13 @@
public static void addCompilerPlugin(Build build, IProject project) {
String compilerLevel = JavaFacetUtils.getCompilerLevel(project);
- if (compilerLevel == null) {
+ if (compilerLevel == null || DEFAULT_COMPILER_LEVEL.equals(compilerLevel)) {
return;
}
org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
plugin.setArtifactId("maven-compiler-plugin"); //$NON-NLS-1$
+ plugin.setVersion("2.3.2");
Xpp3Dom configuration = new Xpp3Dom( "configuration" ); //$NON-NLS-1$
Xpp3Dom source = new Xpp3Dom("source"); //$NON-NLS-1$
source.setValue(compilerLevel); //$NON-NLS-1$
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java 2012-02-16
18:17:15 UTC (rev 38839)
+++
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java 2012-02-16
18:19:57 UTC (rev 38840)
@@ -16,10 +16,15 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
/**
* A utility class for Eclipse Projects.
@@ -135,4 +140,20 @@
return relative.replace('\\', '/'); //$NON-NLS-1$ //$NON-NLS-2$
}
+ public static void removeWTPContainers(IDataModel m2FacetModel, IProject project) throws
JavaModelException {
+ if (m2FacetModel != null && project != null &&
m2FacetModel.getBooleanProperty(IJBossMavenConstants.REMOVE_WTP_CLASSPATH_CONTAINERS)) {
+ IJavaProject javaProject = JavaCore.create(project);
+ if(javaProject != null) {
+ // remove classpatch container from JavaProject
+ ArrayList<IClasspathEntry> newEntries = new
ArrayList<IClasspathEntry>();
+ for(IClasspathEntry entry : javaProject.getRawClasspath()) {
+ String path = entry.getPath().toString();
+ if(path != null &&
!path.startsWith("org.eclipse.jst.j2ee.internal.")) {
+ newEntries.add(entry);
+ }
+ }
+ javaProject.setRawClasspath(newEntries.toArray(new
IClasspathEntry[newEntries.size()]), null);
+ }
+ }
+ }
}
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDataModelProvider.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDataModelProvider.java 2012-02-16
18:17:15 UTC (rev 38839)
+++
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDataModelProvider.java 2012-02-16
18:19:57 UTC (rev 38840)
@@ -98,8 +98,8 @@
}
}
if(propertyName.equals(IJBossMavenConstants.PACKAGING)){
- String groupId = getStringProperty(IJBossMavenConstants.PACKAGING);
- if (groupId == null || groupId.trim().length() <= 0) {
+ String packaging = getStringProperty(IJBossMavenConstants.PACKAGING);
+ if (packaging == null || packaging.trim().length() <= 0) {
status = new Status(IStatus.ERROR, MavenCoreActivator.PLUGIN_ID ,
Messages.MavenFacetInstallPage_The_packaging_field_is_required);
}
}
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDelegate.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDelegate.java 2012-02-16
18:17:15 UTC (rev 38839)
+++
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDelegate.java 2012-02-16
18:19:57 UTC (rev 38840)
@@ -40,6 +40,7 @@
import org.jboss.tools.maven.core.IJBossMavenConstants;
import org.jboss.tools.maven.core.MavenCoreActivator;
import org.jboss.tools.maven.core.Messages;
+import org.jboss.tools.maven.core.ProjectUtil;
import org.jboss.tools.maven.core.libprov.MavenLibraryProviderInstallOperation;
/**
@@ -70,80 +71,74 @@
if (!pom.exists()) {
Model model = new Model();
model.setModelVersion(IJBossMavenConstants.MAVEN_MODEL_VERSION);
- model.setGroupId(config
- .getStringProperty(IJBossMavenConstants.GROUP_ID));
- String artifactId = config
- .getStringProperty(IJBossMavenConstants.ARTIFACT_ID);
+ model.setGroupId(config.getStringProperty(IJBossMavenConstants.GROUP_ID));
+ String artifactId = config.getStringProperty(IJBossMavenConstants.ARTIFACT_ID);
model.setArtifactId(artifactId);
- model.setVersion(config
- .getStringProperty(IJBossMavenConstants.VERSION));
- model.setName(config
- .getStringProperty(IJBossMavenConstants.NAME));
- model.setPackaging(config
- .getStringProperty(IJBossMavenConstants.PACKAGING));
- model.setDescription(config
- .getStringProperty(IJBossMavenConstants.DESCRIPTION));
+ model.setVersion(config.getStringProperty(IJBossMavenConstants.VERSION));
+ model.setName(config.getStringProperty(IJBossMavenConstants.NAME));
+ String packaging = config.getStringProperty(IJBossMavenConstants.PACKAGING);
+ model.setPackaging(packaging);
+ String description = config.getStringProperty(IJBossMavenConstants.DESCRIPTION);
+ if (description != null && description.trim().length() > 0) {
+ model.setDescription(description);
+ }
Build build = new Build();
model.setBuild(build);
// build.setFinalName(artifactId);
if (fpwc.hasProjectFacet(JavaFacet.FACET)) {
- String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
- build.setOutputDirectory(outputDirectory);
+// String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
+// if (!"${basedir}/target/classes".equals(outputDirectory)) {
+// build.setOutputDirectory(outputDirectory);
+// }
String sourceDirectory = MavenCoreActivator.getSourceDirectory(javaProject);
- if (sourceDirectory != null) {
+ if (sourceDirectory != null &&
!"${basedir}/src/main/java".equals(sourceDirectory)) {
build.setSourceDirectory(sourceDirectory);
}
+ MavenCoreActivator.addResource(build, project, sourceDirectory);
+
}
- if (fpwc.hasProjectFacet(WebFacetUtils.WEB_FACET)) {
-
- MavenCoreActivator.addMavenWarPlugin(build, project);
+ IProjectFacetVersion webFacetVersion =
fpwc.getProjectFacetVersion(IJ2EEFacetConstants.DYNAMIC_WEB_FACET);
+ if (webFacetVersion != null && "war".equals(packaging)) {
+ MavenCoreActivator.addMavenWarPlugin(build, project, webFacetVersion);
}
- if (fpwc.hasProjectFacet(IJ2EEFacetConstants.EJB_FACET)) {
-
- MavenCoreActivator.addMavenEjbPlugin(build, project);
+ IProjectFacetVersion ejbFacetVersion =
fpwc.getProjectFacetVersion(IJ2EEFacetConstants.EJB_FACET);
+ if (ejbFacetVersion != null && "ejb".equals(packaging)) {
+ MavenCoreActivator.addMavenEjbPlugin(build, project, ejbFacetVersion);
}
- if (fpwc
- .hasProjectFacet(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET)) {
- MavenCoreActivator.addMavenEarPlugin(build, project,
- config, null, false);
- MavenCoreActivator.createMavenProject(project.getName(),
- monitor, model, true);
+ IProjectFacetVersion earFacetVersion =
fpwc.getProjectFacetVersion(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET);
+ if (earFacetVersion != null && "ear".equals(packaging)) {
+ MavenCoreActivator.addMavenEarPlugin(build, project, config, null, earFacetVersion,
false);
+ MavenCoreActivator.createMavenProject(project.getName(), monitor, model, true);
}
IProjectFacet seamFacet = ProjectFacetsManager.getProjectFacet(SEAM_FACET_ID);
- if (!fpwc.hasProjectFacet(seamFacet)) {
+ if (!"pom".equals(packaging) && !fpwc.hasProjectFacet(seamFacet))
{
MavenCoreActivator.addCompilerPlugin(build, project);
}
if (!pom.exists()) {
- MavenModelManager modelManager = MavenPlugin.getDefault()
- .getMavenModelManager();
+ MavenModelManager modelManager = MavenPlugin.getMavenModelManager();
modelManager.createMavenModel(pom, model);
}
}
- boolean hasMavenNature = MavenCoreActivator.addMavenNature(project,
- monitor);
+ MavenCoreActivator.addMavenNature(project, monitor);
if (fpwc.hasProjectFacet(WebFacetUtils.WEB_FACET)) {
IClasspathAttribute attribute = JavaCore
.newClasspathAttribute(
IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY,
- ClasspathDependencyUtil.getDefaultRuntimePath(
- true).toString());
- MavenCoreActivator.addClasspathAttribute(javaProject,
- attribute, monitor);
+ ClasspathDependencyUtil.getDefaultRuntimePath(true).toString());
+ MavenCoreActivator.addClasspathAttribute(javaProject, attribute, monitor);
}
// FIXME
IClasspathAttribute attribute = JavaCore.newClasspathAttribute(
MavenCoreActivator.OWNER_PROJECT_FACETS_ATTR,
IJBossMavenConstants.M2_FACET_ID);
- MavenCoreActivator.addClasspathAttribute(javaProject, attribute,
- monitor);
+ MavenCoreActivator.addClasspathAttribute(javaProject, attribute, monitor);
- List<LibraryProviderOperationConfig> configs = MavenCoreActivator
- .getLibraryProviderOperationConfigs();
+ List<LibraryProviderOperationConfig> configs =
MavenCoreActivator.getLibraryProviderOperationConfigs();
if (configs.size() > 0) {
MavenLibraryProviderInstallOperation operation = new
MavenLibraryProviderInstallOperation();
for (LibraryProviderOperationConfig libraryProviderOperationConfig : configs) {
@@ -151,6 +146,8 @@
}
configs.clear();
}
+
+ ProjectUtil.removeWTPContainers(config, project);
} finally {
if (fpwc != null) {
fpwc.dispose();
Modified:
trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators/HibernateProjectConfigurator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators/HibernateProjectConfigurator.java 2012-02-16
18:17:15 UTC (rev 38839)
+++
trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators/HibernateProjectConfigurator.java 2012-02-16
18:19:57 UTC (rev 38840)
@@ -15,6 +15,7 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
import org.apache.maven.project.MavenProject;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
@@ -86,7 +87,7 @@
private boolean isHibernateProject(MavenProject mavenProject) {
List<Artifact> artifacts = new ArrayList<Artifact>();
- ArtifactFilter filter = new
org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter(
+ ArtifactFilter filter = new ScopeArtifactFilter(
Artifact.SCOPE_TEST);
for (Artifact artifact : mavenProject.getArtifacts()) {
if (filter.include(artifact)) {
Modified: trunk/maven/plugins/org.jboss.tools.maven.seam/poms/parent-pom.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/poms/parent-pom.xml 2012-02-16 18:17:15
UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/poms/parent-pom.xml 2012-02-16 18:19:57
UTC (rev 38840)
@@ -85,6 +85,7 @@
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
<version>${seam.version}</version>
+ <type>ejb</type>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
@@ -311,7 +312,6 @@
<artifactId>jboss-deployers-client-spi</artifactId>
</exclusion>
</exclusions>
-
</dependency>
<dependency>
<groupId>org.jboss.seam.embedded</groupId>
@@ -503,6 +503,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
@@ -511,7 +512,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.5</version>
+ <version>2.7.2</version>
<configuration>
<argLine>-Dsun.lang.ClassLoader.allowArraySyntax=true</argLine>
</configuration>
Modified:
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java 2012-02-16
18:17:15 UTC (rev 38839)
+++
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java 2012-02-16
18:19:57 UTC (rev 38840)
@@ -43,12 +43,11 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.MavenModelManager;
import org.eclipse.m2e.core.internal.IMavenConstants;
-import org.eclipse.m2e.core.internal.MavenPluginActivator;
import org.eclipse.m2e.core.internal.project.ResolverConfigurationIO;
-import org.eclipse.m2e.core.internal.project.registry.MavenProjectManager;
import org.eclipse.m2e.core.project.ResolverConfiguration;
import org.eclipse.m2e.model.edit.pom.Configuration;
import org.eclipse.m2e.model.edit.pom.Plugin;
@@ -67,6 +66,7 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.maven.core.IJBossMavenConstants;
import org.jboss.tools.maven.core.MavenCoreActivator;
+import org.jboss.tools.maven.core.ProjectUtil;
import org.jboss.tools.maven.core.xpl.ProjectUpdater;
import org.jboss.tools.seam.core.SeamUtil;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
@@ -144,8 +144,7 @@
}
- public void configureSeamProject(IDataModel seamFacetModel,
- IDataModel m2FacetModel) {
+ public void configureSeamProject(IDataModel seamFacetModel, IDataModel m2FacetModel) {
Assert.isNotNull(seamFacetModel);
Assert.isNotNull(m2FacetModel);
webProjectName =
seamFacetModel.getStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME);
@@ -162,11 +161,9 @@
configureParentProject(m2FacetModel, seamFacetModel);
configureWarProject(m2FacetModel, seamFacetModel);
configureTestProject(m2FacetModel, seamFacetModel);
- if (!SeamFacetAbstractInstallDelegate
- .isWarConfiguration(seamFacetModel)) {
+ if (!SeamFacetAbstractInstallDelegate.isWarConfiguration(seamFacetModel)) {
configureEjbProject(m2FacetModel, seamFacetModel);
configureEarProject(m2FacetModel, seamFacetModel);
-
}
}
@@ -231,8 +228,7 @@
dependency = new Dependency();
dependency.setGroupId("org.testng"); //$NON-NLS-1$
dependency.setArtifactId("testng"); //$NON-NLS-1$
- // FIXME
- dependency.setVersion("${testng.version}"); //$NON-NLS-1$
+ //dependency.setVersion("${testng.version}"); //$NON-NLS-1$
dependency.setClassifier("jdk15"); //$NON-NLS-1$
dependency.setScope("compile"); //$NON-NLS-1$
dependencies.add(dependency);
@@ -257,7 +253,6 @@
dependency.setGroupId(groupId);
dependency.setArtifactId(artifactId);
dependency.setType("war"); //$NON-NLS-1$
- dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
dependency.setScope("test"); //$NON-NLS-1$
dependencies.add(dependency);
@@ -267,7 +262,6 @@
dependency.setGroupId(groupId);
dependency.setArtifactId(ejbArtifactId);
dependency.setType("ejb"); //$NON-NLS-1$
- dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
dependency.setScope("test"); //$NON-NLS-1$
dependencies.add(dependency);
}
@@ -297,9 +291,9 @@
if (sourceDirectory != null) {
build.setTestSourceDirectory(sourceDirectory);
}
- String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
- build.setOutputDirectory(outputDirectory);
- build.setTestOutputDirectory(outputDirectory);
+ //String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
+ //build.setOutputDirectory(outputDirectory);
+ //build.setTestOutputDirectory(outputDirectory);
MavenCoreActivator.addResource(build, project, sourceDirectory);
Resource resource = new Resource();
@@ -361,21 +355,17 @@
Dependency dependency = new Dependency();
dependency.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
dependency.setArtifactId(ejbProjectName);
- dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
dependency.setType("ejb"); //$NON-NLS-1$
- dependency.setScope("runtime"); //$NON-NLS-1$
dependencies.add(dependency);
dependency = new Dependency();
dependency.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
dependency.setArtifactId(webProjectName);
- dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
dependency.setType("war"); //$NON-NLS-1$
- dependency.setScope("runtime"); //$NON-NLS-1$
dependencies.add(dependency);
dependency = getSeamDependency();
- dependency.setVersion("${seam.version}"); //$NON-NLS-1$
+ //dependency.setVersion("${seam.version}"); //$NON-NLS-1$
dependency.setType("ejb"); //$NON-NLS-1$
dependency.setScope("compile"); //$NON-NLS-1$
List<Exclusion> exclusions = dependency.getExclusions();
@@ -466,16 +456,9 @@
Build build = new Build();
try {
build.setFinalName(earProjectName);
-
- String sourceDirectory = MavenCoreActivator.getEarRoot(project);
- if (sourceDirectory != null) {
- build.setSourceDirectory(sourceDirectory);
- }
- build.setOutputDirectory("target/classes"); //$NON-NLS-1$
- MavenCoreActivator.addMavenEarPlugin(build, project, m2FacetModel, ejbArtifactId,
true);
+ MavenCoreActivator.addMavenEarPlugin(build, project, m2FacetModel, ejbArtifactId,
JavaEEProjectUtilities.ENTERPRISE_APPLICATION_50, true);
model.setBuild(build);
MavenCoreActivator.createMavenProject(earProjectName, null, model, true);
- removeWTPContainers(m2FacetModel, project);
} catch (Exception e) {
MavenSeamActivator.log(e);
}
@@ -545,16 +528,17 @@
try {
// FIXME
//build.setFinalName(ejbArtifactId);
- String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
- build.setOutputDirectory(outputDirectory);
+ //String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
+ //build.setOutputDirectory(outputDirectory);
String sourceDirectory = MavenCoreActivator.getSourceDirectory(javaProject);
if (sourceDirectory != null) {
build.setSourceDirectory(sourceDirectory);
}
- MavenCoreActivator.addMavenEjbPlugin(build, project);
+ MavenCoreActivator.addMavenEjbPlugin(build, project, JavaEEProjectUtilities.EJB_30);
model.setBuild(build);
MavenCoreActivator.createMavenProject(ejbProjectName, null, model, true);
- removeWTPContainers(m2FacetModel, project);
+
+ ProjectUtil.removeWTPContainers(m2FacetModel, project);
} catch (Exception e) {
MavenSeamActivator.log(e);
}
@@ -642,7 +626,7 @@
dependency.setGroupId("org.jboss.seam"); //$NON-NLS-1$
dependency.setArtifactId("jboss-seam-debug"); //$NON-NLS-1$
// FIXME
- dependency.setVersion("${seam.version}"); //$NON-NLS-1$
+ //dependency.setVersion("${seam.version}"); //$NON-NLS-1$
addDependency(pomFile,dependency);
@@ -737,14 +721,14 @@
dependency = new Dependency();
dependency.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
dependency.setArtifactId(ejbProjectName);
- dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
dependency.setType("ejb"); //$NON-NLS-1$
dependency.setScope("provided"); //$NON-NLS-1$
addDependency(pomFile,dependency);
}
updateProject(pomFile, new WarProjectUpdater(webProject));
- removeWTPContainers(m2FacetModel, webProject);
+
+ ProjectUtil.removeWTPContainers(m2FacetModel, webProject);
} catch (Exception e) {
MavenSeamActivator.log(e);
}
@@ -780,33 +764,6 @@
return newPlugin;
}
- private void removeWTPContainers(IDataModel m2FacetModel,
- IProject webProject) throws JavaModelException {
- if
(m2FacetModel.getBooleanProperty(IJBossMavenConstants.REMOVE_WTP_CLASSPATH_CONTAINERS)) {
- IJavaProject javaProject = JavaCore.create(webProject);
- IClasspathEntry[] entries = javaProject.getRawClasspath();
- List<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>();
- for (int i = 0; i < entries.length; i++) {
- IClasspathEntry entry = entries[i];
- boolean add = true;
- if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
- // FIXME
- IPath path = entry.getPath();
- if (path != null) {
- String value = path.toString();
- if (value.startsWith("org.eclipse.jst")) { //$NON-NLS-1$
- add = false;
- }
- }
- }
- if (add) {
- newEntries.add(entry);
- }
- }
- javaProject.setRawClasspath(newEntries.toArray(new IClasspathEntry[0]), null);
- }
- }
-
private Dependency getHibernateValidator() {
Dependency dependency = new Dependency();
dependency.setGroupId("org.hibernate"); //$NON-NLS-1$
@@ -851,6 +808,7 @@
dependency = new Dependency();
dependency.setGroupId("org.jboss.seam"); //$NON-NLS-1$
dependency.setArtifactId("jboss-seam"); //$NON-NLS-1$
+ dependency.setType("ejb");
return dependency;
}
@@ -860,7 +818,7 @@
InputStream inputStream = null;
try {
URL resolvedURL = FileLocator.resolve(parentPomEntryURL);
- MavenModelManager modelManager = MavenPlugin.getDefault().getMavenModelManager();
+ MavenModelManager modelManager = MavenPlugin.getMavenModelManager();
inputStream = resolvedURL.openStream();
Model model = modelManager.readMavenModel(inputStream);
model.setArtifactId(parentArtifactId);
@@ -899,6 +857,7 @@
try {
Model rootPomModel = modelManager.readMavenModel(rootPom);
List<Dependency> seamDependencies =
rootPomModel.getDependencyManagement().getDependencies();
+
setArtifactVersion("jsf.version", properties, "javax.faces",
"jsf-api", seamDependencies); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String richfacesVersion = setArtifactVersion("richfaces.version",
properties, "org.richfaces.framework", "richfaces-impl",
seamDependencies); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (richfacesVersion == null) {
@@ -950,11 +909,26 @@
}
List<String> modules = model.getModules();
+
modules.add("../" + artifactId); //$NON-NLS-1$
if (!SeamFacetAbstractInstallDelegate
.isWarConfiguration(seamFacetModel)) {
modules.add("../" + ejbArtifactId); //$NON-NLS-1$
modules.add("../" + earArtifactId); //$NON-NLS-1$
+
+ Dependency dependency = new Dependency();
+ dependency.setGroupId(model.getGroupId());
+ dependency.setArtifactId(ejbProjectName);
+ dependency.setType("ejb"); //$NON-NLS-1$
+ dependency.setVersion(projectVersion);
+ model.getDependencyManagement().getDependencies().add(0, dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId(model.getGroupId());
+ dependency.setArtifactId(webProjectName);
+ dependency.setType("war"); //$NON-NLS-1$
+ dependency.setVersion(projectVersion);
+ model.getDependencyManagement().getDependencies().add(1, dependency);
}
webProjectName =
seamFacetModel.getStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME);
@@ -963,7 +937,6 @@
location = location.append(parentProjectName);
MavenCoreActivator.createMavenProject(parentProjectName, null, model, false,
location);
// disable workspace resolution
- MavenProjectManager projectManager =
MavenPluginActivator.getDefault().getMavenProjectManager();
IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(parentProjectName);
ResolverConfiguration configuration =
ResolverConfigurationIO.readResolverConfiguration(project);
configuration.setResolveWorkspaceProjects(false);
@@ -1117,7 +1090,7 @@
}
configuration.setStringValue(WAR_SOURCE_DIRECTORY, value);
}
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
boolean first = true;
for (IPath output:outputs) {
if (first) {
Modified:
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/MavenPostInstallListener.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/MavenPostInstallListener.java 2012-02-16
18:17:15 UTC (rev 38839)
+++
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/MavenPostInstallListener.java 2012-02-16
18:19:57 UTC (rev 38840)
@@ -10,10 +10,8 @@
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
import org.eclipse.wst.common.project.facet.core.events.IProjectFacetActionEvent;
import org.jboss.tools.maven.core.IJBossMavenConstants;
-import
org.jboss.tools.maven.core.internal.project.facet.MavenFacetInstallDataModelProvider;
import org.jboss.tools.maven.seam.MavenSeamActivator;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
-import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider;
public class MavenPostInstallListener implements IFacetedProjectListener {
@@ -31,11 +29,10 @@
boolean isM2Project = false;
for (IProjectFacetVersion projectFacetVersion : projectFacets) {
IProjectFacet projectFacet = projectFacetVersion.getProjectFacet();
- if (ISeamFacetDataModelProperties.SEAM_FACET_ID.equals(projectFacet
- .getId())) {
+ if (ISeamFacetDataModelProperties.SEAM_FACET_ID.equals(projectFacet.getId())) {
isSeamProject = true;
}
- if (IJBossMavenConstants.M2_FACET_ID.equals(projectFacet.getId())) {
+ else if (IJBossMavenConstants.M2_FACET_ID.equals(projectFacet.getId())) {
isM2Project = true;
}
}
@@ -46,9 +43,8 @@
IDataModel dataModel = (IDataModel) object;
if ( SEAM_FACET_MODEL_PROVIDER.equals(dataModel.getID())) {
seamFacetModel = dataModel;
- }
-
- if ( M2_FACET_MODEL_PROVIDER.equals(dataModel.getID()) ) {
+ }
+ else if ( M2_FACET_MODEL_PROVIDER.equals(dataModel.getID()) ) {
m2FacetModel = dataModel;
}
}
Modified:
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java 2012-02-16
18:17:15 UTC (rev 38839)
+++
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java 2012-02-16
18:19:57 UTC (rev 38840)
@@ -128,6 +128,7 @@
packaging.setLayoutData(gd);
String[] items = { "war","ear", "ejb", "jar" };
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
packaging.setItems(items);
+ synchHelper.synchCombo(packaging, IJBossMavenConstants.PACKAGING, null);
IFacetedProjectWorkingCopy fpwc = null;
try {
@@ -135,8 +136,7 @@
if (!mavenProjectExists) {
if (fpwc.hasProjectFacet(WebFacetUtils.WEB_FACET)) {
packaging.select(0);
- } else if (fpwc
- .hasProjectFacet(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET)) {
+ } else if (fpwc.hasProjectFacet(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET)) {
packaging.select(1);
} else if (fpwc.hasProjectFacet(IJ2EEFacetConstants.EJB_FACET)) {
packaging.select(2);
@@ -147,7 +147,6 @@
String mavenPackaging =
getDataModel().getStringProperty(IJBossMavenConstants.PACKAGING);
packaging.setText(mavenPackaging);
}
- synchHelper.synchCombo(packaging, IJBossMavenConstants.PACKAGING, null);
name = createField(composite, Messages.MavenFacetInstallPage_Name,
IJBossMavenConstants.NAME);
name.setText(projectName);
@@ -162,6 +161,8 @@
seamVersion.setText("2.1.1.GA"); //$NON-NLS-1$
} else if ("2.2".equals(seamFacetVersion.getVersionString())) {
//$NON-NLS-1$
seamVersion.setText("2.2.1.Final"); //$NON-NLS-1$
+ } else if ("2.3".equals(seamFacetVersion.getVersionString())) {
//$NON-NLS-1$
+ seamVersion.setText("2.3.0.ALPHA"); //$NON-NLS-1$
}
Button removeWTPContainers = new Button(composite,SWT.CHECK);
removeWTPContainers.setText(Messages.MavenFacetInstallPage_Remove_WTP_Classpath_containers);