maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject svn commit: r1154498 - in /maven/plugins/trunk/maven-eclipse-plugin/src: it/MECLIPSE-350/ it/MECLIPSE-350/ear-module/ it/MECLIPSE-350/ejb-module/ it/MECLIPSE-350/war-module/ main/java/org/apache/maven/plugin/eclipse/ main/java/org/apache/maven/plugin/e...
Date Sat, 06 Aug 2011 12:10:11 GMT
Author: rfscholte
Date: Sat Aug  6 12:10:10 2011
New Revision: 1154498

URL: http://svn.apache.org/viewvc?rev=1154498&view=rev
Log:
Fix MECLIPSE-350: Allow to bypass the automatic search of JEE (and related) APIs versions

Added:
    maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/
    maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/ear-module/
    maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/ear-module/pom.xml
    maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/ejb-module/
    maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/ejb-module/pom.xml
    maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/invoker.properties
    maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/pom.xml
    maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/verify.bsh
    maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/war-module/
    maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/war-module/pom.xml
Modified:
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MyEclipsePlugin.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseMetadataWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadApplicationXMLWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadJ2EEWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java

Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/ear-module/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/ear-module/pom.xml?rev=1154498&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/ear-module/pom.xml (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/ear-module/pom.xml Sat Aug
 6 12:10:10 2011
@@ -0,0 +1,13 @@
+<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>
+  
+  <parent>
+	  <groupId>org.apache.maven.plugins.it</groupId>
+	  <artifactId>parent-meclipse-350</artifactId>
+	  <version>0.0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>ear-meclipse-350</artifactId>
+  <packaging>ear</packaging>
+  
+</project>
\ No newline at end of file

Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/ejb-module/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/ejb-module/pom.xml?rev=1154498&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/ejb-module/pom.xml (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/ejb-module/pom.xml Sat Aug
 6 12:10:10 2011
@@ -0,0 +1,12 @@
+<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>
+  
+  <parent>
+	  <groupId>org.apache.maven.plugins.it</groupId>
+	  <artifactId>parent-meclipse-350</artifactId>
+	  <version>0.0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>ejb-meclipse-350</artifactId>
+  
+</project>
\ No newline at end of file

Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/invoker.properties?rev=1154498&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/invoker.properties (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/invoker.properties Sat Aug
 6 12:10:10 2011
@@ -0,0 +1 @@
+invoker.goals = eclipse:clean eclipse:eclipse
\ No newline at end of file

Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/pom.xml?rev=1154498&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/pom.xml (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/pom.xml Sat Aug  6 12:10:10
2011
@@ -0,0 +1,31 @@
+<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>org.apache.maven.plugins.it</groupId>
+  <artifactId>parent-meclipse-350</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>ear-module</module>
+    <module>ejb-module</module>
+    <module>war-module</module>
+  </modules>
+  
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-eclipse-plugin</artifactId>
+          <version>@project.version@</version>
+          <configuration>
+            <wtpversion>2.0</wtpversion>
+            <jeeversion>6.0</jeeversion>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+</project>
\ No newline at end of file

Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/verify.bsh?rev=1154498&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/verify.bsh (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/verify.bsh Sat Aug  6 12:10:10
2011
@@ -0,0 +1,71 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+  File earModuleFacetCore = new File( basedir, "ear-module/.settings/org.eclipse.wst.common.project.facet.core.xml");
+  if( !earModuleFacetCore.exists() ) 
+  {
+    System.err.println( "Expected ear-module/.settings/org.eclipse.wst.common.project.facet.core.xml,
but file doesn't exist" );
+    return false;
+  }
+
+  String earModuleFacetCoreContent = FileUtils.fileRead( earModuleFacetCore, "UTF-8" );
+  if ( earModuleFacetCoreContent.indexOf( "<installed facet=\"jst.ear\" version=\"6.0\"/>"
) < 0 )
+  {
+    System.err.println( "Expected ear-module/.settings/org.eclipse.wst.common.project.facet.core.xml
to contain '<installed facet=\"jst.ear\" version=\"6.0\"/>', but it didn't" );
+    return false;
+  }
+
+  File ejbModuleFacetCore = new File( basedir, "ejb-module/.settings/org.eclipse.wst.common.project.facet.core.xml");
+  if( !ejbModuleFacetCore.exists() ) 
+  {
+    System.err.println( "Expected ejb-module/.settings/org.eclipse.wst.common.project.facet.core.xml,
but file doesn't exist" );
+    return false;
+  }
+  
+  File warModuleFacetCore = new File( basedir, "war-module/.settings/org.eclipse.wst.common.project.facet.core.xml");
+  if( !warModuleFacetCore.exists() ) 
+  {
+    System.err.println( "Expected war-module/.settings/org.eclipse.wst.common.project.facet.core.xml,
but file doesn't exist" );
+    return false;
+  }
+  
+  String warModuleFacetCoreContent = FileUtils.fileRead( warModuleFacetCore, "UTF-8" );
+  if ( warModuleFacetCoreContent.indexOf( "<installed facet=\"jst.web\" version=\"3.0\"/>"
) < 0 )
+  {
+    System.err.println( "Expected war-module/.settings/org.eclipse.wst.common.project.facet.core.xml
to contain '<installed facet=\"jst.web\" version=\"3.0\"/>', but it didn't" );
+    return false;
+  }
+  
+}
+catch ( Exception e)
+{
+    e.printStackTrace();
+    result = false;
+}
+return result;
\ No newline at end of file

Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/war-module/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/war-module/pom.xml?rev=1154498&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/war-module/pom.xml (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-350/war-module/pom.xml Sat Aug
 6 12:10:10 2011
@@ -0,0 +1,13 @@
+<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>
+  
+  <parent>
+	  <groupId>org.apache.maven.plugins.it</groupId>
+	  <artifactId>parent-meclipse-350</artifactId>
+	  <version>0.0.1-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>war-meclipse-350</artifactId>
+  <packaging>war</packaging>
+
+</project>
\ No newline at end of file

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=1154498&r1=1154497&r2=1154498&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
Sat Aug  6 12:10:10 2011
@@ -590,6 +590,28 @@ public class EclipsePlugin
      * @parameter expression="${eclipse.testSourcesLast}" default-value="false"
      */
     protected boolean testSourcesLast;
+    
+    /**
+     * The plugin is often capable in predicting the required jee version based on the dependencies
of the project.
+     * By setting this parameter to one of the {@code jeeversion} options the version will
be locked. 
+     *  
+     * <table>
+     *  <thead>
+     *    <tr><th>jeeversion</th><th>EJB version</th><th>Servlet
version</th><th>JSP version</th></tr>
+     *  </thead>
+     *  <tbody>
+     *    <tr><td>6.0</td><td>3.1</td><td>3.0</td><td>2.2</td></tr>
+     *    <tr><td>5.0</td><td>3.0</td><td>2.5</td><td>2.1</td></tr>
+     *    <tr><td>1.4</td><td>2.1</td><td>2.4</td><td>2.0</td></tr>
+     *    <tr><td>1.3</td><td>2.0</td><td>2.3</td><td>1.2</td></tr>
+     *    <tr><td>1.2</td><td>1.1</td><td>2.2</td><td>1.1</td></tr>
+     *  </tbody>
+     * </table>
+     * 
+     * @since 2.9
+     * @parameter expression="${eclipse.jeeversion}"
+     */
+    protected String jeeversion;
 
     protected final boolean isJavaProject()
     {
@@ -1331,6 +1353,7 @@ public class EclipsePlugin
         config.setPackaging( packaging );
         config.setLinkedResources( linkedResources );
         config.setClasspathContainersLast( classpathContainersLast );
+        config.setJeeVersion( jeeversion );
 
         collectWarContextRootsFromReactorEarConfiguration( config );
 

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MyEclipsePlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MyEclipsePlugin.java?rev=1154498&r1=1154497&r2=1154498&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MyEclipsePlugin.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MyEclipsePlugin.java
Sat Aug  6 12:10:10 2011
@@ -278,14 +278,22 @@ public class MyEclipsePlugin
 
         if ( Constants.PROJECT_PACKAGING_WAR.equals( packaging ) )
         {
-            String jeeVersion =
-                JeeUtils.getJeeDescriptorFromServletVersion( JeeUtils.resolveServletVersion(
project ) ).getJeeVersion();
+            String j2eeVersion;
+            if ( this.jeeversion != null )
+            {
+                j2eeVersion = JeeUtils.getJeeDescriptorFromJeeVersion( this.jeeversion ).getJeeVersion();
+            }
+            else
+            {
+                j2eeVersion =
+                    JeeUtils.getJeeDescriptorFromServletVersion( JeeUtils.resolveServletVersion(
project ) ).getJeeVersion();
+            }
 
-            if ( "1.3".equals( jeeVersion ) )
+            if ( "1.3".equals( j2eeVersion ) )
             {
                 getClasspathContainers().add( MYECLIPSE_J2EE_13_CLASSPATH_CONTAINER );
             }
-            else if ( "1.4".equals( jeeVersion ) )
+            else if ( "1.4".equals( j2eeVersion ) )
             {
                 getClasspathContainers().add( MYECLIPSE_J2EE_14_CLASSPATH_CONTAINER );
             }

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java?rev=1154498&r1=1154497&r2=1154498&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java
Sat Aug  6 12:10:10 2011
@@ -155,6 +155,11 @@ public class EclipseWriterConfig
      * @See {@link EclipsePlugin#classpathContainersLast}
      */
     private boolean classpathContainersLast;
+    
+    /**
+     * @see {@link EclipsePlugin#jeeversion}
+     */
+    private String jeeVersion;
 
     public WorkspaceConfiguration getWorkspaceConfiguration()
     {
@@ -648,4 +653,22 @@ public class EclipseWriterConfig
         this.classpathContainersLast = classpathContainersLast;
     }
 
+    /**
+     * Sets the jeeversion.
+     * @return the jeeversion
+     */
+    public String getJeeVersion()
+    {
+        return jeeVersion;
+    }
+
+    /**
+     * Returns the jeeversion
+     * @param jeeversion the jeeversion
+     */
+    public void setJeeVersion( String jeeVersion )
+    {
+        this.jeeVersion = jeeVersion;
+    }
+
 }

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseMetadataWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseMetadataWriter.java?rev=1154498&r1=1154497&r2=1154498&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseMetadataWriter.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseMetadataWriter.java
Sat Aug  6 12:10:10 2011
@@ -154,8 +154,16 @@ public class MyEclipseMetadataWriter
      */
     private String getJeeVersion()
     {
-        String jeeVersion =
-            JeeUtils.getJeeDescriptorFromServletVersion( JeeUtils.resolveServletVersion(
config.getProject() ) ).getJeeVersion();
+        String jeeVersion;
+        if ( config.getJeeVersion() != null )
+        {
+            jeeVersion = JeeUtils.getJeeDescriptorFromJeeVersion( config.getJeeVersion()
).getJeeVersion();
+        }
+        else
+        {
+            jeeVersion =
+                JeeUtils.getJeeDescriptorFromServletVersion( JeeUtils.resolveServletVersion(
config.getProject() ) ).getJeeVersion();
+        }
 
         if ( jeeVersion == null )
         {

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadApplicationXMLWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadApplicationXMLWriter.java?rev=1154498&r1=1154497&r2=1154498&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadApplicationXMLWriter.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadApplicationXMLWriter.java
Sat Aug  6 12:10:10 2011
@@ -177,17 +177,25 @@ public class RadApplicationXMLWriter
      */
     private Xpp3Dom createNewApplicationXml()
     {
-        String j2eeVersion = JeeUtils.resolveJeeVersion( config.getProject() );
+        String jeeVersion;
+        if ( config.getJeeVersion() != null )
+        {
+            jeeVersion = JeeUtils.getJeeDescriptorFromJeeVersion( config.getJeeVersion()
).getJeeVersion();
+        }
+        else
+        {
+            jeeVersion = JeeUtils.resolveJeeVersion( config.getProject() );
+        }
         // By default J2EE version is in the format X.X
         // Must be fixed for JEE < 1.4. Schemas didn't exist
         Xpp3Dom result = new Xpp3Dom( APPLICATION_XML_APPLICATION );
         result.setAttribute( ID, "Application_ID" );
-        result.setAttribute( VERSION, j2eeVersion );
+        result.setAttribute( VERSION, jeeVersion );
         result.setAttribute( XMLNS, "http://java.sun.com/xml/ns/j2ee" );
         result.setAttribute( XMLNS_XSI, "http://www.w3.org/2001/XMLSchema-instance" );
         result.setAttribute( XMLNS_SCHEMA_LOCATION,
                              "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_"
-                                 + j2eeVersion.charAt( 0 ) + "_" + j2eeVersion.charAt( 2
) + ".xsd" );
+                                 + jeeVersion.charAt( 0 ) + "_" + jeeVersion.charAt( 2 )
+ ".xsd" );
         result.addChild( new Xpp3Dom( APPLICATION_XML_DESCRIPTION ) );
         Xpp3Dom name = new Xpp3Dom( APPLICATION_XML_DISPLAY_NAME );
         name.setValue( config.getProject().getArtifactId() );

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadJ2EEWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadJ2EEWriter.java?rev=1154498&r1=1154497&r2=1154498&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadJ2EEWriter.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadJ2EEWriter.java
Sat Aug  6 12:10:10 2011
@@ -104,19 +104,43 @@ public class RadJ2EEWriter
         if ( Constants.PROJECT_PACKAGING_WAR.equalsIgnoreCase( packaging ) )
         {
             // In format X.X
-            String servletVersion = JeeUtils.resolveServletVersion( config.getProject() );
+            String servletVersion;
+            if ( config.getJeeVersion() != null )
+            {
+                servletVersion = JeeUtils.getJeeDescriptorFromJeeVersion( config.getJeeVersion()
).getServletVersion();
+            }
+            else
+            {
+                servletVersion = JeeUtils.resolveServletVersion( config.getProject() );
+            }
             writer.writeText( "" + servletVersion.charAt( 0 ) + servletVersion.charAt( 2
) );
         }
         else if ( Constants.PROJECT_PACKAGING_EJB.equalsIgnoreCase( packaging ) )
         {
             // In format X.X
-            String ejbVersion = JeeUtils.resolveEjbVersion( config.getProject() );
+            String ejbVersion;
+            if ( config.getJeeVersion() != null )
+            {
+                ejbVersion = JeeUtils.getJeeDescriptorFromJeeVersion( config.getJeeVersion()
).getEjbVersion();
+            }
+            else
+            {
+                ejbVersion = JeeUtils.resolveEjbVersion( config.getProject() );
+            }
             writer.writeText( "" + ejbVersion.charAt( 0 ) + ejbVersion.charAt( 2 ) );
         }
         else if ( Constants.PROJECT_PACKAGING_EAR.equalsIgnoreCase( packaging ) )
         {
             // In format X.X
-            String jeeVersion = JeeUtils.resolveJeeVersion( config.getProject() );
+            String jeeVersion;
+            if ( config.getJeeVersion() != null )
+            {
+                jeeVersion = JeeUtils.getJeeDescriptorFromJeeVersion( config.getJeeVersion()
).getJeeVersion();
+            }
+            else
+            {
+                jeeVersion = JeeUtils.resolveJeeVersion( config.getProject() );
+            }
             writer.writeText( "" + jeeVersion.charAt( 0 ) + jeeVersion.charAt( 2 ) );
         }
         writer.endElement();

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java?rev=1154498&r1=1154497&r2=1154498&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java
Sat Aug  6 12:10:10 2011
@@ -151,7 +151,16 @@ public class RadWebSettingsWriter
         writer.writeText( "J2EE" );
         writer.endElement();
         writer.startElement( WEBSETTINGS_JSP_LEVEL );
-        writer.writeText( JeeUtils.resolveJspVersion( config.getProject() ) );
+        String jspVersion;
+        if ( config.getJeeVersion() != null )
+        {
+            jspVersion = JeeUtils.getJeeDescriptorFromJeeVersion( config.getJeeVersion()
).getJspVersion();
+        }
+        else
+        {
+            jspVersion = JeeUtils.resolveJspVersion( config.getProject() );
+        }
+        writer.writeText( jspVersion );
         writer.endElement();
         writer.startElement( WEBSETTINGS_FEATURES );
         writer.startElement( WEBSETTINGS_FEATURE );

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java?rev=1154498&r1=1154497&r2=1154498&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java
Sat Aug  6 12:10:10 2011
@@ -91,8 +91,16 @@ public abstract class AbstractWtpResourc
             writer.addAttribute( ATTR_MODULE_TYPE_ID, "jst.web" ); //$NON-NLS-1$
 
             writer.startElement( ELT_VERSION );
-
-            writer.writeText( JeeUtils.resolveServletVersion( config.getProject() ) );
+            String servletVersion;
+            if ( config.getJeeVersion() != null )
+            {
+                servletVersion = JeeUtils.getJeeDescriptorFromJeeVersion( config.getJeeVersion()
).getServletVersion();
+            }
+            else
+            {
+                servletVersion = JeeUtils.resolveServletVersion( config.getProject() );
+            }
+            writer.writeText( servletVersion );
             writer.endElement();
 
             String contextRoot = config.getContextName();
@@ -107,7 +115,17 @@ public abstract class AbstractWtpResourc
             writer.addAttribute( ATTR_MODULE_TYPE_ID, "jst.ejb" ); //$NON-NLS-1$
 
             writer.startElement( ELT_VERSION );
-            writer.writeText( JeeUtils.resolveEjbVersion( config.getProject() ) );
+
+            String ejbVersion;
+            if ( config.getJeeVersion() != null )
+            {
+                ejbVersion = JeeUtils.getJeeDescriptorFromJeeVersion( config.getJeeVersion()
).getEjbVersion();
+            }
+            else
+            {
+                ejbVersion = JeeUtils.resolveEjbVersion( config.getProject() );
+            }
+            writer.writeText( ejbVersion );
 
             writer.endElement();
 
@@ -123,7 +141,16 @@ public abstract class AbstractWtpResourc
             writer.addAttribute( ATTR_MODULE_TYPE_ID, "jst.ear" ); //$NON-NLS-1$
 
             writer.startElement( ELT_VERSION );
-            writer.writeText( JeeUtils.resolveJeeVersion( config.getProject() ) );
+            String jeeVersion;
+            if ( config.getJeeVersion() != null )
+            {
+                jeeVersion = JeeUtils.getJeeDescriptorFromJeeVersion( config.getJeeVersion()
).getJeeVersion();
+            }
+            else
+            {
+                jeeVersion = JeeUtils.resolveJeeVersion( config.getProject() );
+            }
+            writer.writeText( jeeVersion );
             writer.endElement();
         }
         else

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java?rev=1154498&r1=1154497&r2=1154498&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java
Sat Aug  6 12:10:10 2011
@@ -122,14 +122,33 @@ public class EclipseWtpFacetsWriter
         {
             writeFacetFixedElement( writer, FACET_JST_JAVA ); // fixed
             writeFacetFixedElement( writer, FACET_JST_WEB ); // fixed
-            writeFacetInstalledElement( writer, FACET_JST_WEB, JeeUtils.resolveServletVersion(
config.getProject() ) ); // installed
+            String servletVersion;
+            if ( config.getJeeVersion() != null )
+            {
+                servletVersion = JeeUtils.getJeeDescriptorFromJeeVersion( config.getJeeVersion()
).getServletVersion();
+            }
+            else
+            {
+                servletVersion = JeeUtils.resolveServletVersion( config.getProject() );
+            }
+            writeFacetInstalledElement( writer, FACET_JST_WEB, servletVersion ); // installed
             writeFacetInstalledElement( writer, FACET_JST_JAVA, IdeUtils.resolveJavaVersion(
config.getProject() ) ); // installed
         }
         else if ( Constants.PROJECT_PACKAGING_EJB.equalsIgnoreCase( packaging ) ) //$NON-NLS-1$
         {
             writeFacetFixedElement( writer, FACET_JST_JAVA ); // fixed
             writeFacetFixedElement( writer, FACET_JST_EJB ); // fixed
-            writeFacetInstalledElement( writer, FACET_JST_EJB, JeeUtils.resolveEjbVersion(
config.getProject() ) ); // installed
+            
+            String ejbVersion;
+            if ( config.getJeeVersion() != null )
+            {
+                ejbVersion = JeeUtils.getJeeDescriptorFromJeeVersion( config.getJeeVersion()
).getEjbVersion();
+            }
+            else
+            {
+                ejbVersion = JeeUtils.resolveEjbVersion( config.getProject() );
+            }
+            writeFacetInstalledElement( writer, FACET_JST_EJB, ejbVersion ); // installed
             writeFacetInstalledElement( writer, FACET_JST_JAVA, IdeUtils.resolveJavaVersion(
config.getProject() ) ); // installed
         }
         else if ( Constants.PROJECT_PACKAGING_EAR.equalsIgnoreCase( packaging ) ) //$NON-NLS-1$
@@ -147,7 +166,16 @@ public class EclipseWtpFacetsWriter
 
             }
             writeFacetFixedElement( writer, FACET_JST_EAR ); // fixed
-            writeFacetInstalledElement( writer, FACET_JST_EAR, JeeUtils.resolveJeeVersion(
config.getProject() ) ); // installed
+            String jeeVersion;
+            if ( config.getJeeVersion() != null )
+            {
+                jeeVersion = JeeUtils.getJeeDescriptorFromJeeVersion( config.getJeeVersion()
).getJeeVersion();
+            }
+            else
+            {
+                jeeVersion = JeeUtils.resolveJeeVersion( config.getProject() );
+            }
+            writeFacetInstalledElement( writer, FACET_JST_EAR, jeeVersion ); // installed
 
         }
         else if ( Constants.PROJECT_PACKAGING_JAR.equalsIgnoreCase( packaging ) ) //$NON-NLS-1$



Mime
View raw message