Author: fbricon
Date: 2012-05-15 08:25:08 -0400 (Tue, 15 May 2012)
New Revision: 41023
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/cdi/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/cdi/deltaspike/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/cdi/deltaspike/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/CDIConfiguratorTest.java
Modified:
trunk/maven/plugins/org.jboss.tools.maven.cdi/src/org/jboss/tools/maven/cdi/configurators/CDIProjectConfigurator.java
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/META-INF/MANIFEST.MF
Log:
JBIDE-11741 : enable CDI support on maven projects having a DeltaSpike dependency
Modified:
trunk/maven/plugins/org.jboss.tools.maven.cdi/src/org/jboss/tools/maven/cdi/configurators/CDIProjectConfigurator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.cdi/src/org/jboss/tools/maven/cdi/configurators/CDIProjectConfigurator.java 2012-05-15
11:47:40 UTC (rev 41022)
+++
trunk/maven/plugins/org.jboss.tools.maven.cdi/src/org/jboss/tools/maven/cdi/configurators/CDIProjectConfigurator.java 2012-05-15
12:25:08 UTC (rev 41023)
@@ -182,8 +182,11 @@
}
private boolean isKnownCdiExtension(Artifact artifact) {
- return artifact.getGroupId().startsWith("org.jboss.seam.")
- && artifact.getVersion().startsWith("3.");
+ return (artifact.getGroupId().startsWith("org.jboss.seam.")
+ && artifact.getVersion().startsWith("3."))
+ || artifact.getGroupId().startsWith("org.apache.deltaspike.");
+
+
}
}
Modified:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/META-INF/MANIFEST.MF
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/META-INF/MANIFEST.MF 2012-05-15
11:47:40 UTC (rev 41022)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/META-INF/MANIFEST.MF 2012-05-15
12:25:08 UTC (rev 41023)
@@ -17,6 +17,7 @@
org.jboss.tools.maven.jaxrs,
org.jboss.tools.maven.jbosspackaging,
org.jboss.tools.maven.jpa,
+ org.jboss.tools.maven.cdi,
org.jboss.tools.maven.ui,
org.eclipse.wst.server.core,
org.jboss.tools.common,
@@ -31,7 +32,8 @@
org.eclipse.m2e.tests.common;bundle-version="[1.0.0,1.2.0)",
org.eclipse.jpt.jpa.core;bundle-version="3.0.1",
org.eclipse.jpt.common.core,
- org.eclipse.jpt.common.utility
+ org.eclipse.jpt.common.utility,
+ org.jboss.tools.cdi.core
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Eclipse-RegisterBuddy: org.apache.log4j
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/cdi/deltaspike/pom.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/cdi/deltaspike/pom.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/cdi/deltaspike/pom.xml 2012-05-15
12:25:08 UTC (rev 41023)
@@ -0,0 +1,14 @@
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>foo.bar</groupId>
+ <artifactId>deltaspike</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.deltaspike.core</groupId>
+ <artifactId>deltaspike-core-api</artifactId>
+ <version>0.2-incubating</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/CDIConfiguratorTest.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/CDIConfiguratorTest.java
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/CDIConfiguratorTest.java 2012-05-15
12:25:08 UTC (rev 41023)
@@ -0,0 +1,48 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.configurators.tests;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.cdi.core.CDICoreNature;
+import org.junit.Test;
+
+@SuppressWarnings("restriction")
+public class CDIConfiguratorTest extends AbstractMavenConfiguratorTest {
+
+ protected static final IProjectFacet MAVEN_FACET =
ProjectFacetsManager.getProjectFacet("jboss.m2");
+ protected static final IProjectFacet CDI_FACET =
ProjectFacetsManager.getProjectFacet("jst.cdi"); //$NON-NLS-1$
+ protected static final IProjectFacetVersion DEFAULT_CDI_VERSION =
CDI_FACET.getVersion("1.0"); //$NON-NLS-1$
+
+ @Test
+ public void testJBIDE11741_deltaSpikeDependency() throws Exception {
+ String projectLocation = "projects/cdi/deltaspike";
+ IProject cdiProject = importProject(projectLocation+"/pom.xml");
+ waitForJobsToComplete();
+ assertNoErrors(cdiProject);
+ assertIsCDIProject(cdiProject, DEFAULT_CDI_VERSION);
+ }
+
+ private void assertIsCDIProject(IProject project, IProjectFacetVersion
expectedCdiVersion) throws Exception {
+ assertNoErrors(project);
+ assertTrue("CDI nature is missing",
project.hasNature(CDICoreNature.NATURE_ID));
+
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ if (facetedProject != null) {
+ IProjectFacetVersion cdiVersion = facetedProject.getInstalledVersion(CDI_FACET);
+ assertEquals("Unexpected CDI Version", expectedCdiVersion, cdiVersion);
+ assertTrue("Maven Facet is
missing", facetedProject.hasProjectFacet(MAVEN_FACET));
+ }
+ }
+}