You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ah...@apache.org on 2006/11/30 12:49:27 UTC

svn commit: r480902 - in /maven/maven-1/plugins/trunk/eclipse: ./ src/plugin-resources/templates/ src/plugin-resources/templates/wtp/ src/plugin-resources/templates/wtp/0.7/ src/plugin-resources/templates/wtp/1.5/

Author: aheritier
Date: Thu Nov 30 03:49:26 2006
New Revision: 480902

URL: http://svn.apache.org/viewvc?view=rev&rev=480902
Log:
MPECLIPSE-127 : Split settings for wtp 0.7 and wtp 1.5. Add the project facet configuration required by wtp 1.5 (with hardcoded value temporarly)

Added:
    maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/
    maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/0.7/
    maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/0.7/wtpmodules.jelly
      - copied, changed from r480624, maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtpmodules.jelly
    maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/1.5/
    maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/1.5/org.eclipse.wst.common.component.jelly
    maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/1.5/org.eclipse.wst.common.project.facet.core.xml.jelly
Removed:
    maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtpmodules.jelly
Modified:
    maven/maven-1/plugins/trunk/eclipse/plugin.jelly

Modified: maven/maven-1/plugins/trunk/eclipse/plugin.jelly
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/eclipse/plugin.jelly?view=diff&rev=480902&r1=480901&r2=480902
==============================================================================
--- maven/maven-1/plugins/trunk/eclipse/plugin.jelly (original)
+++ maven/maven-1/plugins/trunk/eclipse/plugin.jelly Thu Nov 30 03:49:26 2006
@@ -154,28 +154,29 @@
   <!--==================================================================-->
   <!-- Generate Eclipse .wtpmodules file                                -->
   <!--==================================================================-->
-  <goal name="eclipse:wtpconfig">
-    <j:set var="modulesConfig0.7" value="${basedir}/.wtpmodules"/>
-    <j:set var="modulesConfig1.5" value="${basedir}/.settings/org.eclipse.wst.common.component"/>
-  </goal>
-  
-  <goal name="eclipse:generate-wtpmodules" description="Generate Eclipse .wtpmodules file" prereqs="eclipse:wtpconfig">
+  <goal name="eclipse:generate-wtpmodules" description="Generate Eclipse .wtpmodules file">
     <j:choose>
       <j:when test="${maven.eclipse.wtp.version==0.7}">
-        <j:set var="modulesConfig" value="${modulesConfig0.7}"/>
+	    <ant:echo>Creating ${basedir}/.wtpmodules ...</ant:echo>
+	    <j:file name="${basedir}/.wtpmodules" prettyPrint="true" outputMode="xml" xmlns="dummy">
+	      <j:import file="${plugin.resources}/templates/wtp/0.7/wtpmodules.jelly" inherit="true" />
+	    </j:file>
       </j:when>
       <j:when test="${maven.eclipse.wtp.version==1.5}">
         <ant:mkdir dir="${basedir}/.settings"/>
-        <j:set var="modulesConfig" value="${modulesConfig1.5}"/>
+	    <ant:echo>Creating ${basedir}/.settings/org.eclipse.wst.common.component ...</ant:echo>
+	    <j:file name="${basedir}/.settings/org.eclipse.wst.common.component" prettyPrint="true" outputMode="xml" xmlns="dummy">
+	      <j:import file="${plugin.resources}/templates/wtp/1.5/org.eclipse.wst.common.component.jelly" inherit="true" />
+	    </j:file>
+	    <ant:echo>Creating ${basedir}/.settings/org.eclipse.wst.common.project.facet.core.xml ...</ant:echo>
+	    <j:file name="${basedir}/.settings/org.eclipse.wst.common.project.facet.core.xml" prettyPrint="true" outputMode="xml" xmlns="dummy">
+	      <j:import file="${plugin.resources}/templates/wtp/1.5/org.eclipse.wst.common.project.facet.core.xml.jelly" inherit="true" />
+	    </j:file>
       </j:when>
       <j:otherwise>
         <ant:fail>maven.eclipse.wtp.version=${maven.eclipse.wtp.version} not supported. Please check the plugin documentation to have the list of supported values.</ant:fail>
       </j:otherwise>
     </j:choose>
-    <ant:echo>Creating ${modulesConfig} ...</ant:echo>
-    <j:file name="${modulesConfig}" prettyPrint="true" outputMode="xml" xmlns="dummy">
-      <j:import file="${plugin.resources}/templates/wtpmodules.jelly" inherit="true" />
-    </j:file>
   </goal>
 
   <!--==================================================================-->
@@ -323,13 +324,14 @@
   <!--==================================================================-->
   <!-- Clean up eclipse generated files                                 -->
   <!--==================================================================-->
-  <goal name="eclipse:clean" description="Clean eclipse generated files" prereqs="eclipse:wtpconfig">
-    <j:set var="projectFileName" value="${basedir}/.project" />
-    <j:set var="classpathFileName" value="${basedir}/.classpath" />
-    <ant:delete file="${projectFileName}" />
-    <ant:delete file="${classpathFileName}" />
-    <ant:delete file="${modulesConfig0.7}" />
-    <ant:delete file="${modulesConfig1.5}" />
+  <goal name="eclipse:clean" description="Clean eclipse generated files">
+    <ant:delete file="${basedir}/.project" />
+    <ant:delete file="${basedir}/.classpath" />
+    <!-- WTP 0.7 files -->
+    <ant:delete file="${basedir}/.wtpmodules" />
+    <!-- WTP 1.5 files -->
+    <ant:delete file="${basedir}/.settings/org.eclipse.wst.common.component" />
+    <ant:delete file="${basedir}/.settings/org.eclipse.wst.common.project.facet.core.xml" />
     <ant:echo>Cleaned up eclipse generated files</ant:echo>
   </goal>
 

Copied: maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/0.7/wtpmodules.jelly (from r480624, maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtpmodules.jelly)
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/0.7/wtpmodules.jelly?view=diff&rev=480902&p1=maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtpmodules.jelly&r1=480624&p2=maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/0.7/wtpmodules.jelly&r2=480902
==============================================================================
--- maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtpmodules.jelly (original)
+++ maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/0.7/wtpmodules.jelly Thu Nov 30 03:49:26 2006
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <!--
     /*
-    * Copyright 2001-2005 The Apache Software Foundation.
+    * Copyright 2001-2006 The Apache Software Foundation.
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.

Added: maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/1.5/org.eclipse.wst.common.component.jelly
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/1.5/org.eclipse.wst.common.component.jelly?view=auto&rev=480902
==============================================================================
--- maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/1.5/org.eclipse.wst.common.component.jelly (added)
+++ maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/1.5/org.eclipse.wst.common.component.jelly Thu Nov 30 03:49:26 2006
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    /*
+    * Copyright 2001-2006 The Apache Software Foundation.
+    *
+    * Licensed under the Apache License, Version 2.0 (the "License");
+    * you may not use this file except in compliance with the License.
+    * You may obtain a copy of the License at
+    *
+    *      http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
+-->
+<j:whitespace xmlns:j="jelly:core" xmlns:maven="jelly:maven" xmlns:u="jelly:util" xmlns:eclipse="eclipse" xmlns="dummy" trim="true">
+    <project-modules id="moduleCoreId">
+        <j:set var="deployDir" value="/" />
+        <j:set var="moduletype" value="jst.utility" />
+        <j:set var="deployname" value="${pom.artifactId}" />
+        <j:set var="mmpt" value="${maven.multiproject.type}" trim="true" />
+        <j:choose>
+            <j:when test="${mmpt == 'war'}">
+                <!-- war -->
+                <j:set var="moduletype" value="jst.web" />
+                <j:set var="deployDir" value="/WEB-INF/classes" />
+            </j:when>
+        </j:choose>
+        <wb-module deploy-name="${deployname}">
+            <j:choose>
+                <j:when test="${moduletype == 'jst.web'}">
+                    <!-- war -->
+                    <maven:get var="warPath" plugin='maven-war-plugin' property='maven.war.src' />
+                    <maven:makeRelativePath var="relWarPath" basedir="${basedir}" path="${warPath}" separator="/" />
+                    <module-type module-type-id="jst.web">
+                        <version>
+                            <!-- try to detect servlet dependency, maven.eclipse.servletapilist can hold different names -->
+                            <j:set var="moduleversion" value="x" />
+                            <u:tokenize var="servletapilist" delim=",">${maven.eclipse.servletapilist}</u:tokenize>
+                            <j:forEach var="servletapi" items="${servletapilist}" trim="true">
+                                <j:if test="${pom.getDependency(servletapi) != null}">
+                                    <j:set var="moduleversion" value="${pom.getDependency(servletapi).getVersion()}" />
+                                </j:if>
+                            </j:forEach>
+                            <!-- defaults to 2.2 -->
+                            <j:choose>
+                                <j:when test="${moduleversion.startsWith('2.4')}">2.4</j:when>
+                                <j:when test="${moduleversion.startsWith('2.3')}">2.3</j:when>
+                                <j:otherwise>2.2</j:otherwise>
+                            </j:choose>
+                        </version>
+                        <property name="context-root" value="${pom.artifactId}" />
+                    </module-type>
+                    <wb-resource deploy-path="/" source-path="/${relWarPath}" />
+                </j:when>
+                <j:otherwise>
+                    <!-- jar -->
+                    <module-type module-type-id="jst.utility" />
+                </j:otherwise>
+            </j:choose>
+            <j:set var="srcDir" value="" />
+            <!-- main src dir -->
+            <j:if test="${sourcesPresent}">
+                <maven:makeRelativePath var="srcDir" basedir="${basedir}" path="${pom.build.sourceDirectory}" separator="/" />
+                <wb-resource deploy-path="${deployDir}" source-path="/${srcDir}" />
+            </j:if>
+            <!-- resources -->
+            <j:if test="${maven.eclipse.resources.addtoclasspath}">
+                <j:if test="${!pom.build.resources.isEmpty()}">
+                    <j:forEach var="resource" items="${pom.build.resources}">
+                        <maven:makeRelativePath var="resourceDirectory" basedir="${basedir}" path="${resource.directory}" separator="/" />
+                        <!-- don't add duplicate directories -->
+                        <j:if test="${!resourceDirectory.equals(srcDir)}">
+                            <wb-resource deploy-path="${deployDir}" source-path="/${resourceDirectory}" />
+                        </j:if>
+                    </j:forEach>
+                </j:if>
+            </j:if>
+            <!-- generated source directories -->
+            <u:available file="${maven.gen.src}">
+                <u:file var="genSrcRootDir" name="${maven.gen.src}" />
+                <j:forEach var="genSrcDir" items="${genSrcRootDir.listFiles()}">
+                    <maven:makeRelativePath var="srcDir" basedir="${basedir}" path="${genSrcDir}" separator="/" />
+                    <wb-resource deploy-path="${deployDir}" source-path="/${srcDir}" />
+                </j:forEach>
+            </u:available>
+            <j:if test="${moduletype == 'jst.web'}">
+                <j:forEach var="lib" items="${pom.artifacts}">
+                    <j:set var="eclipseDependency" value="${lib.dependency.getProperty('eclipse.dependency')}" />
+                    <j:choose>
+                        <j:when test="${eclipseDependency == 'true'}">
+                            <dependent-module deploy-path="/WEB-INF/lib"
+                                handle="module:/resource/${lib.dependency.artifactId}/${lib.dependency.artifactId}">
+                                <dependency-type>uses</dependency-type>
+                            </dependent-module>
+                        </j:when>
+                        <j:otherwise>
+                            <!-- make sure it's a webapp library -->
+                            <j:if test="${lib.dependency.getProperty('war.bundle')=='true'}">
+                                <maven:makeRelativePath var="relativePath" basedir="${maven.repo.local}" path="${lib.path}" separator="/" />
+                                <u:file var="checkExist" name="${maven.repo.local}/${relativePath}" />
+                                <j:choose>
+                                    <j:when test="${checkExist.exists()}">
+                                        <j:set var="relativePathCheck" value="${relativePath}X" />
+                                        <j:if test='${relativePathCheck == "X"}'>
+                                            <j:set var="relativePath"
+                                                value="${lib.dependency.groupId}/jars/${lib.dependency.artifactId}-${lib.dependency.version}.jar" />
+                                        </j:if>
+                                        <j:if test="${lib.dependency.type == 'tld'}"><j:set var="outputDir" value="${maven.war.tld.dir}"/></j:if>
+                                        <j:if test="${lib.dependency.type != 'tld'}"><j:set var="outputDir" value="/WEB-INF/lib"/></j:if>
+                                        <dependent-module deploy-path="${outputDir}"
+                                            handle="module:/classpath/var/MAVEN_REPO/${relativePath}">
+                                            <dependency-type>uses</dependency-type>
+                                        </dependent-module>
+                                    </j:when>
+                                    <j:otherwise>
+                                        <dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/${lib.path}">
+                                            <dependency-type>uses</dependency-type>
+                                        </dependent-module>
+                                    </j:otherwise>
+                                </j:choose>
+                            </j:if>
+                        </j:otherwise>
+                    </j:choose>
+                </j:forEach>
+            </j:if>
+        </wb-module>
+    </project-modules>
+</j:whitespace>
\ No newline at end of file

Added: maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/1.5/org.eclipse.wst.common.project.facet.core.xml.jelly
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/1.5/org.eclipse.wst.common.project.facet.core.xml.jelly?view=auto&rev=480902
==============================================================================
--- maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/1.5/org.eclipse.wst.common.project.facet.core.xml.jelly (added)
+++ maven/maven-1/plugins/trunk/eclipse/src/plugin-resources/templates/wtp/1.5/org.eclipse.wst.common.project.facet.core.xml.jelly Thu Nov 30 03:49:26 2006
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    /*
+    * Copyright 2001-2006 The Apache Software Foundation.
+    *
+    * Licensed under the Apache License, Version 2.0 (the "License");
+    * you may not use this file except in compliance with the License.
+    * You may obtain a copy of the License at
+    *
+    *      http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
+-->
+<j:whitespace xmlns:j="jelly:core" xmlns:maven="jelly:maven" xmlns:u="jelly:util" xmlns:eclipse="eclipse" xmlns="dummy" trim="true">
+  <faceted-project>
+    <fixed facet="jst.java"/>
+    <installed facet="jst.java" version="5.0"/>
+    <j:set var="mmpt" value="${maven.multiproject.type}" trim="true" />
+    <j:choose>
+      <j:when test="${mmpt == 'war'}">
+        <fixed facet="jst.web"/>
+        <installed facet="jst.web" version="2.3"/>
+      </j:when>
+      <j:otherwise>
+        <fixed facet="jst.utility"/>
+        <installed facet="jst.utility" version="1.0"/>
+      </j:otherwise>
+    </j:choose>                  
+  </faceted-project>
+</j:whitespace>
\ No newline at end of file