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)
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@480902 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0734ab2fff
commit
14d371108c
@ -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>
|
||||
|
||||
|
||||
@ -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.
|
||||
@ -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>
|
||||
@ -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>
|
||||
Loading…
x
Reference in New Issue
Block a user