Move the version to 1.12

MPECLIPSE-127 : add support for wtp 1.5
Dynamically set java and servlet versions in the facet descriptor
Add a new property maven.eclipse.enable to avoid to have to define some natures to enable wtp
Update documentation
Generates project settings to store the compiler source and target levels


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@531133 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
aheritier 2007-04-22 01:39:39 +00:00
parent d0af5c92b6
commit ac953e37d0
11 changed files with 276 additions and 170 deletions

View File

@ -116,11 +116,7 @@
<j:if test="${sourcesPresent or !pom.build.resources.isEmpty()}"> <j:if test="${sourcesPresent or !pom.build.resources.isEmpty()}">
<attainGoal name="eclipse:generate-classpath" /> <attainGoal name="eclipse:generate-classpath" />
</j:if> </j:if>
<!-- jelly trick, you can't use "-1" in comparisons --> <j:if test="${maven.eclipse.wtp.enable==true}">
<j:set var="indexnotfound" value="${0-1}" />
<!-- another jelly trick, you can't call methods on variables with a dot -->
<j:set var="mepn" value="${maven.eclipse.projectnatures}x" />
<j:if test="${mepn.indexOf('org.eclipse.wst.common.modulecore.ModuleCoreNature') != indexnotfound}">
<attainGoal name="eclipse:generate-wtpmodules" /> <attainGoal name="eclipse:generate-wtpmodules" />
</j:if> </j:if>
<ant:echo>Now refresh your project in Eclipse (right click on the project and select "Refresh")</ant:echo> <ant:echo>Now refresh your project in Eclipse (right click on the project and select "Refresh")</ant:echo>
@ -149,6 +145,11 @@
<j:file name="${basedir}/.classpath" prettyPrint="true" outputMode="xml" xmlns="dummy"> <j:file name="${basedir}/.classpath" prettyPrint="true" outputMode="xml" xmlns="dummy">
<j:import file="${plugin.resources}/templates/classpath.jelly" inherit="true" /> <j:import file="${plugin.resources}/templates/classpath.jelly" inherit="true" />
</j:file> </j:file>
<ant:mkdir dir="${basedir}/.settings"/>
<ant:echo>Creating ${basedir}/.settings/org.eclipse.jdt.core.prefs ...</ant:echo>
<j:file name="${basedir}/.settings/org.eclipse.jdt.core.prefs" omitXmlDeclaration="true" outputMode="txt" xmlns="dummy">
<j:import file="${plugin.resources}/templates/org.eclipse.jdt.core.prefs.jelly" inherit="true" />
</j:file>
</goal> </goal>
<!--==================================================================--> <!--==================================================================-->

View File

@ -92,3 +92,6 @@ maven.eclipse.servletapilist=javax.servlet:servlet-api,servletapi:servletapi,ger
# For which version of WTP we have to generate the configuration # For which version of WTP we have to generate the configuration
maven.eclipse.wtp.version=1.5 maven.eclipse.wtp.version=1.5
# Do you want to generate WTP configuration files
maven.eclipse.wtp.enable=false

View File

@ -22,7 +22,7 @@
<pomVersion>3</pomVersion> <pomVersion>3</pomVersion>
<id>maven-eclipse-plugin</id> <id>maven-eclipse-plugin</id>
<name>Maven Eclipse Plugin</name> <name>Maven Eclipse Plugin</name>
<currentVersion>1.11.1-SNAPSHOT</currentVersion> <currentVersion>1.12-SNAPSHOT</currentVersion>
<description>A plugin to generate various files for the Eclipse IDE and ease the use of Maven within that environment.</description> <description>A plugin to generate various files for the Eclipse IDE and ease the use of Maven within that environment.</description>
<shortDescription>Eclipse Plugin for Maven</shortDescription> <shortDescription>Eclipse Plugin for Maven</shortDescription>
<versions> <versions>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2004 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="dummy" trim="false">
<j:set var="target" value="${maven.compile.target}" />
<j:set var="source" value="${maven.compile.source}" />
eclipse.preferences.version=1
<j:if test="${target!=null}">
org.eclipse.jdt.core.compiler.codegen.targetPlatform=${target}
org.eclipse.jdt.core.compiler.compliance=${target}
</j:if>
<j:if test="${source!=null}">
org.eclipse.jdt.core.compiler.source=${source}
</j:if>
</j:whitespace>

View File

@ -44,6 +44,26 @@
<j:if test="${mebc.indexOf('org.eclipse.jdt.core.javabuilder') == indexnotfound}"> <j:if test="${mebc.indexOf('org.eclipse.jdt.core.javabuilder') == indexnotfound}">
<j:set var="fullbuildcommands" value="org.eclipse.jdt.core.javabuilder,${maven.eclipse.buildcommands}" /> <j:set var="fullbuildcommands" value="org.eclipse.jdt.core.javabuilder,${maven.eclipse.buildcommands}" />
</j:if> </j:if>
<j:if test="${maven.eclipse.wtp.enable==true}">
<!-- set required natures for WTP -->
<j:if test="${mepn.indexOf('org.eclipse.wst.common.project.facet.core.nature') == indexnotfound}">
<j:set var="fullprojectnatures" value="org.eclipse.wst.common.project.facet.core.nature,${fullprojectnatures}" />
</j:if>
<j:if test="${mepn.indexOf('org.eclipse.wst.common.modulecore.ModuleCoreNature') == indexnotfound}">
<j:set var="fullprojectnatures" value="org.eclipse.wst.common.modulecore.ModuleCoreNature,${fullprojectnatures}" />
</j:if>
<j:if test="${mepn.indexOf('org.eclipse.jem.workbench.JavaEMFNature') == indexnotfound}">
<j:set var="fullprojectnatures" value="org.eclipse.jem.workbench.JavaEMFNature,${fullprojectnatures}" />
</j:if>
<!-- set required build commands for WTP -->
<j:if test="${mebc.indexOf('org.eclipse.wst.common.project.facet.core.builder') == indexnotfound}">
<j:set var="fullbuildcommands" value="org.eclipse.wst.common.project.facet.core.builder,${fullbuildcommands}" />
</j:if>
<j:if test="${mebc.indexOf('org.eclipse.wst.validation.validationbuilder') == indexnotfound}">
<j:set var="fullbuildcommands" value="org.eclipse.wst.validation.validationbuilder,${fullbuildcommands}" />
</j:if>
</j:if>
</j:if> </j:if>
<name>${maven.eclipse.project.name}</name> <name>${maven.eclipse.project.name}</name>

View File

@ -16,8 +16,9 @@
* limitations under the License. * 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"> <j:whitespace xmlns:j="jelly:core" xmlns:maven="jelly:maven" xmlns:u="jelly:util" xmlns:eclipse="eclipse" xmlns="dummy"
<project-modules id="moduleCoreId"> trim="true">
<project-modules id="moduleCoreId" project-version="1.5.0">
<j:set var="deployDir" value="/" /> <j:set var="deployDir" value="/" />
<j:set var="moduletype" value="jst.utility" /> <j:set var="moduletype" value="jst.utility" />
<j:set var="deployname" value="${pom.artifactId}" /> <j:set var="deployname" value="${pom.artifactId}" />
@ -30,37 +31,14 @@
</j:when> </j:when>
</j:choose> </j:choose>
<wb-module deploy-name="${deployname}"> <wb-module deploy-name="${deployname}">
<j:choose> <j:if test="${moduletype == 'jst.web'}">
<j:when test="${moduletype == 'jst.web'}">
<!-- war --> <!-- war -->
<maven:get var="warPath" plugin='maven-war-plugin' property='maven.war.src' /> <maven:get var="warPath" plugin='maven-war-plugin' property='maven.war.src' />
<maven:makeRelativePath var="relWarPath" basedir="${basedir}" path="${warPath}" separator="/" /> <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}" /> <wb-resource deploy-path="/" source-path="/${relWarPath}" />
</j:when> <property name="context-root" value="${pom.artifactId}" />
<j:otherwise> </j:if>
<!-- jar --> <property name="java-output-path" value="/target/classes"/>
<module-type module-type-id="jst.utility" />
</j:otherwise>
</j:choose>
<j:set var="srcDir" value="" /> <j:set var="srcDir" value="" />
<!-- main src dir --> <!-- main src dir -->
<j:if test="${sourcesPresent}"> <j:if test="${sourcesPresent}">
@ -71,7 +49,8 @@
<j:if test="${maven.eclipse.resources.addtoclasspath}"> <j:if test="${maven.eclipse.resources.addtoclasspath}">
<j:if test="${!pom.build.resources.isEmpty()}"> <j:if test="${!pom.build.resources.isEmpty()}">
<j:forEach var="resource" items="${pom.build.resources}"> <j:forEach var="resource" items="${pom.build.resources}">
<maven:makeRelativePath var="resourceDirectory" basedir="${basedir}" path="${resource.directory}" separator="/" /> <maven:makeRelativePath var="resourceDirectory" basedir="${basedir}" path="${resource.directory}"
separator="/" />
<!-- don't add duplicate directories --> <!-- don't add duplicate directories -->
<j:if test="${!resourceDirectory.equals(srcDir)}"> <j:if test="${!resourceDirectory.equals(srcDir)}">
<wb-resource deploy-path="${deployDir}" source-path="/${resourceDirectory}" /> <wb-resource deploy-path="${deployDir}" source-path="/${resourceDirectory}" />
@ -100,7 +79,8 @@
<j:otherwise> <j:otherwise>
<!-- make sure it's a webapp library --> <!-- make sure it's a webapp library -->
<j:if test="${lib.dependency.getProperty('war.bundle')=='true'}"> <j:if test="${lib.dependency.getProperty('war.bundle')=='true'}">
<maven:makeRelativePath var="relativePath" basedir="${maven.repo.local}" path="${lib.path}" separator="/" /> <maven:makeRelativePath var="relativePath" basedir="${maven.repo.local}" path="${lib.path}"
separator="/" />
<u:file var="checkExist" name="${maven.repo.local}/${relativePath}" /> <u:file var="checkExist" name="${maven.repo.local}/${relativePath}" />
<j:choose> <j:choose>
<j:when test="${checkExist.exists()}"> <j:when test="${checkExist.exists()}">
@ -109,8 +89,12 @@
<j:set var="relativePath" <j:set var="relativePath"
value="${lib.dependency.groupId}/jars/${lib.dependency.artifactId}-${lib.dependency.version}.jar" /> value="${lib.dependency.groupId}/jars/${lib.dependency.artifactId}-${lib.dependency.version}.jar" />
</j:if> </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:if test="${lib.dependency.type != 'tld'}"><j:set var="outputDir" value="/WEB-INF/lib"/></j:if> <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}" <dependent-module deploy-path="${outputDir}"
handle="module:/classpath/var/MAVEN_REPO/${relativePath}"> handle="module:/classpath/var/MAVEN_REPO/${relativePath}">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>

View File

@ -16,19 +16,51 @@
* limitations under the License. * 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"> <j:whitespace xmlns:j="jelly:core" xmlns:maven="jelly:maven" xmlns:u="jelly:util" xmlns:eclipse="eclipse" xmlns="dummy"
trim="true">
<faceted-project> <faceted-project>
<fixed facet="jst.java"/> <fixed facet="jst.java" />
<installed facet="jst.java" version="5.0"/> <j:set var="javaversion" value="${maven.compile.target}" />
<j:if test="javaversion==null">
<j:set var="javaversion" value="${maven.compile.source}" />
</j:if>
<j:choose>
<j:when test="${javaversion.startsWith('1.5')}">
<j:set var="javaversion" value="5.0" />
</j:when>
<j:when test="${javaversion.startsWith('1.6')}">
<j:set var="javaversion" value="6.0" />
</j:when>
</j:choose>
<installed facet="jst.java" version="${javaversion}" />
<j:set var="mmpt" value="${maven.multiproject.type}" trim="true" /> <j:set var="mmpt" value="${maven.multiproject.type}" trim="true" />
<j:choose> <j:choose>
<j:when test="${mmpt == 'war'}"> <j:when test="${mmpt == 'war'}">
<fixed facet="jst.web"/> <fixed facet="jst.web" />
<installed facet="jst.web" version="2.3"/> <!-- 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')}">
<installed facet="jst.web" version="2.4" />
</j:when>
<j:when test="${moduleversion.startsWith('2.3')}">
<installed facet="jst.web" version="2.3" />
</j:when> </j:when>
<j:otherwise> <j:otherwise>
<fixed facet="jst.utility"/> <installed facet="jst.web" version="2.2" />
<installed facet="jst.utility" version="1.0"/> </j:otherwise>
</j:choose>
</j:when>
<j:otherwise>
<fixed facet="jst.utility" />
<installed facet="jst.utility" version="1.0" />
</j:otherwise> </j:otherwise>
</j:choose> </j:choose>
</faceted-project> </faceted-project>

View File

@ -1,6 +1,3 @@
maven.eclipse.resources.addtoclasspath=true maven.eclipse.resources.addtoclasspath=true
maven.multiproject.type=war maven.multiproject.type=war
maven.eclipse.wtp.enable=true
maven.eclipse.projectnatures=org.eclipse.jdt.core.javanature,org.eclipse.wst.common.modulecore.ModuleCoreNature
maven.eclipse.buildcommands=org.eclipse.wst.common.modulecore.ComponentStructuralBuilder,org.eclipse.jdt.core.javabuilder,org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver
maven.eclipse.conclasspath=org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5,org.eclipse.jst.j2ee.internal.web.container/wtptest

View File

@ -23,7 +23,9 @@
<author email="dion@multitask.com.au">dIon Gillard</author> <author email="dion@multitask.com.au">dIon Gillard</author>
</properties> </properties>
<body> <body>
<release version="1.11.1-SNAPSHOT" date="In SVN"> <release version="1.12-SNAPSHOT" date="In SVN">
<action dev="aheritier" type="add">Project preferences are now generated with the classpath (to define the java version for sources and target).</action>
<action dev="aheritier" type="update">WTP settings are now generated if maven.eclipse.wtp.enable=false. No more need to define natures, build commands.</action>
<action dev="aheritier" type="add" issues="MPECLIPSE-127">Add basic support (jar,war) for WTP 1.5</action> <action dev="aheritier" type="add" issues="MPECLIPSE-127">Add basic support (jar,war) for WTP 1.5</action>
<action dev="aheritier" type="fix">WTP configuration : tld dependencies weren't deployed in ${maven.war.tld.dir} but in WEB-INF/lib</action> <action dev="aheritier" type="fix">WTP configuration : tld dependencies weren't deployed in ${maven.war.tld.dir} but in WEB-INF/lib</action>
<action dev="aheritier" type="add">New goal eclipse:multiclean</action> <action dev="aheritier" type="add">New goal eclipse:multiclean</action>

View File

@ -119,4 +119,26 @@ maven.hibernate.output.dir=${maven.build.dir}/generated-sources/schema
</answer> </answer>
</faq> </faq>
</part> </part>
<part id="WTP">
<title>WTP support</title>
<faq id="version">
<question>How can I set the version of WTP ?</question>
<answer>
<p>To specify the version of WTP configuration files, set the property <a href="properties.html">maven.eclipse.wtp.version</a> .</p>
</answer>
</faq>
<faq id="activation">
<question>How can I activate WTP support for my project ?</question>
<answer>
<p>To activate WTP you have to set the property <a href="properties.html">maven.eclipse.wtp.enable</a> to true.</p>
</answer>
</faq>
<faq id="multiproject">
<question>Can I use WTP in a multiproject ?</question>
<answer>
<p>Yes, the plugin will read the value of the property maven.multiproject.type to generate the settings for libraries and for the web application.</p>
</answer>
</faq>
</part>
</faqs> </faqs>

View File

@ -252,6 +252,13 @@
</p> </p>
</td> </td>
</tr> </tr>
<tr>
<td>maven.eclipse.wtp.enable</td>
<td>Yes</td>
<td>
<p>Do you want to generate settings for WTP? Default value : false.</p>
</td>
</tr>
<tr> <tr>
<td>maven.eclipse.wtp.version</td> <td>maven.eclipse.wtp.version</td>
<td>Yes</td> <td>Yes</td>
@ -260,6 +267,14 @@
<p>Default value is <code>1.5</code>.</p> <p>Default value is <code>1.5</code>.</p>
</td> </td>
</tr> </tr>
<tr>
<td>maven.eclipse.servletapilist</td>
<td>Yes</td>
<td>
<p>List of servlet api used to find the servlet version to set in wtp.</p>
<p>Default value is <code>javax.servlet:servlet-api,servletapi:servletapi,geronimo-spec:geronimo-spec-servlet</code>.</p>
</td>
</tr>
</table> </table>
<p> <p>
Note that you will need to defined a Note that you will need to defined a