You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by es...@apache.org on 2006/08/31 03:00:43 UTC

svn commit: r438736 - in /portals/pluto/trunk: ./ maven-pluto-plugin/ maven-pluto-plugin/src/main/java/org/apache/pluto/maven/ maven-pluto-plugin/src/main/resources/

Author: esm
Date: Wed Aug 30 18:00:42 2006
New Revision: 438736

URL: http://svn.apache.org/viewvc?rev=438736&view=rev
Log:
[PLUTO-191]: Added maven-pluto-plugin/src/main/resources/versions.properties which is interpolated during Maven's process-resources lifecycle phase.  The InstallationDependency class queries the versions.properties file to determine the versions of the artifacts to install.


Added:
    portals/pluto/trunk/maven-pluto-plugin/src/main/resources/
    portals/pluto/trunk/maven-pluto-plugin/src/main/resources/versions.properties   (with props)
Modified:
    portals/pluto/trunk/maven-pluto-plugin/pom.xml
    portals/pluto/trunk/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java
    portals/pluto/trunk/pom.xml

Modified: portals/pluto/trunk/maven-pluto-plugin/pom.xml
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/maven-pluto-plugin/pom.xml?rev=438736&r1=438735&r2=438736&view=diff
==============================================================================
--- portals/pluto/trunk/maven-pluto-plugin/pom.xml (original)
+++ portals/pluto/trunk/maven-pluto-plugin/pom.xml Wed Aug 30 18:00:42 2006
@@ -74,13 +74,17 @@
   </dependencies>
   
   <build> 
-    <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory> 
+    <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>    
     <resources>
       <resource>
         <directory>src/main/scripts</directory>
         <includes>
           <include>**/*.mmld</include>
         </includes>
+      </resource>
+      <resource>
+        <directory>src/main/resources</directory>        
+        <filtering>true</filtering>
       </resource>
     </resources>
     <plugins>

Modified: portals/pluto/trunk/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java?rev=438736&r1=438735&r2=438736&view=diff
==============================================================================
--- portals/pluto/trunk/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java (original)
+++ portals/pluto/trunk/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java Wed Aug 30 18:00:42 2006
@@ -15,47 +15,71 @@
  */
 package org.apache.pluto.maven;
 
-import java.util.List;
+import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
 
 /**
  *
  */
-class InstallationDependency {
-
-	public static final String VERSION = "1.1.0-SNAPSHOT";
+class InstallationDependency {    
+    
+    private static final Properties VERSION_PROPERTIES = new Properties();
+    private static final String PROPERTIES_FILE = "/versions.properties";
+    static
+    {
+        try 
+        {
+            VERSION_PROPERTIES.load(InstallationDependency.class.getResourceAsStream(PROPERTIES_FILE));
+        } 
+        catch (IOException e) 
+        {
+            throw new RuntimeException("Cannot load " + PROPERTIES_FILE + " from the classpath!", e);
+        }
+    }
 
     public static final InstallationDependency PORTLET_API =
-        new InstallationDependency("javax.portlet", "portlet-api", "1.0");
+        new InstallationDependency("javax.portlet", "portlet-api", 
+                VERSION_PROPERTIES.getProperty("portlet-api.version"));
 
     public static final InstallationDependency  DESCRIPTOR_API =
-        new InstallationDependency("org.apache.pluto", "pluto-descriptor-api", VERSION);
+        new InstallationDependency("org.apache.pluto", "pluto-descriptor-api", 
+                VERSION_PROPERTIES.getProperty("pluto.version"));
 
     public static final InstallationDependency  DESCRIPTOR_IMPL =
-            new InstallationDependency("org.apache.pluto", "pluto-descriptor-impl", VERSION);
+            new InstallationDependency("org.apache.pluto", "pluto-descriptor-impl", 
+                    VERSION_PROPERTIES.getProperty("pluto.version"));
 
     public static final InstallationDependency  CONTAINER =
-            new InstallationDependency("org.apache.pluto", "pluto-container", VERSION);
+            new InstallationDependency("org.apache.pluto", "pluto-container", 
+                    VERSION_PROPERTIES.getProperty("pluto.version"));
 
     public static final InstallationDependency  TAGLIB =
-            new InstallationDependency("org.apache.pluto", "pluto-taglib", VERSION);
+            new InstallationDependency("org.apache.pluto", "pluto-taglib", 
+                    VERSION_PROPERTIES.getProperty("pluto.version"));
 
     public static final InstallationDependency  PORTAL =
-            new InstallationDependency("org.apache.pluto", "pluto-portal", VERSION, "war");
+            new InstallationDependency("org.apache.pluto", "pluto-portal", 
+                    VERSION_PROPERTIES.getProperty("pluto.version"), "war");
 
     public static final InstallationDependency  TESTSUITE =
-            new InstallationDependency("org.apache.pluto", "pluto-testsuite", VERSION, "war");
+            new InstallationDependency("org.apache.pluto", "pluto-testsuite", 
+                    VERSION_PROPERTIES.getProperty("pluto.version"), "war");
 
     public static final InstallationDependency  CASTOR =
-            new InstallationDependency("castor", "castor", "0.9.6");
+            new InstallationDependency("castor", "castor", 
+                    VERSION_PROPERTIES.getProperty("castor.version"));
 
     public static final InstallationDependency  XERCES =
-            new InstallationDependency("xerces", "xercesImpl", "2.6.2");
+            new InstallationDependency("xerces", "xercesImpl", 
+                    VERSION_PROPERTIES.getProperty("xercesImpl.version"));
 
     public static final InstallationDependency  XML_PARSER_APIS =
-            new InstallationDependency("xerces", "xmlParserAPIs", "2.6.2");
+            new InstallationDependency("xerces", "xmlParserAPIs", 
+                    VERSION_PROPERTIES.getProperty("xmlParserAPIs.version"));
 
     private static final List ENDORSED = new ArrayList();
     private static final List SHARED = new ArrayList();
@@ -87,13 +111,16 @@
     private String type;
 
     public InstallationDependency(String groupId, String artifactId, String version) {
-        this.groupId = groupId;
-        this.artifactId = artifactId;
-        this.version = version;
-        this.type = "jar";
+        this(groupId, artifactId, version, "jar");
     }
 
     public InstallationDependency(String groupId, String artifactId, String version, String type) {
+        if (version == null || version.trim().equalsIgnoreCase(""))
+        {
+            throw new RuntimeException("Missing or invalid property for artifact " + 
+                    artifactId + " in " + PROPERTIES_FILE + "!");
+        }
+        
         this.groupId = groupId;
         this.artifactId = artifactId;
         this.version = version;
@@ -132,4 +159,5 @@
     public void setType(String type) {
         this.type = type;
     }
+    
 }

Added: portals/pluto/trunk/maven-pluto-plugin/src/main/resources/versions.properties
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/maven-pluto-plugin/src/main/resources/versions.properties?rev=438736&view=auto
==============================================================================
--- portals/pluto/trunk/maven-pluto-plugin/src/main/resources/versions.properties (added)
+++ portals/pluto/trunk/maven-pluto-plugin/src/main/resources/versions.properties Wed Aug 30 18:00:42 2006
@@ -0,0 +1,43 @@
+#
+#  Copyright 2005-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.
+
+
+# The properties defined in this file should align with the names of the 
+# <property> elements of Pluto's parent POM. This property file is 
+# interpolated and placed in the maven-pluto-plugin jar, and is 
+# used by the InstallationDependency class.
+portlet-api.version=${portlet-api.version}
+servlet-api.version=${servlet-api.version}
+jsp-api.version=${jsp-api.version}
+jstl.version=${jstl.version}
+taglibs.standard.version=${taglibs.standard.version}
+xerces.version=${xerces.version}
+xercesImpl.version=${xerces.version}
+xmlParserAPIs.version=${xerces.version}
+castor.version=${castor.version}
+commons-digester.version=${commons-digester.version}
+commons-cli.version=${commons-cli.version}
+commons-httpclient.version=${commons-httpclient.version}
+commons-beanutils.version=${commons-beanutils.version}
+commons-logging.version=${commons-logging.version}
+log4j.version=${log4j.version}
+springframework.version=${springframework.version}
+plexus.version=${plexus.version}
+maven.version=${maven.version}
+ant.version=${ant.version}
+junit.version=${junit.version}
+jmock.version=${jmock.version}
+# The version of Pluto's parent POM.
+pluto.version=${pom.parent.version}

Propchange: portals/pluto/trunk/maven-pluto-plugin/src/main/resources/versions.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/trunk/pom.xml
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pom.xml?rev=438736&r1=438735&r2=438736&view=diff
==============================================================================
--- portals/pluto/trunk/pom.xml (original)
+++ portals/pluto/trunk/pom.xml Wed Aug 30 18:00:42 2006
@@ -216,7 +216,11 @@
   
   
   <!-- Dependency Version Properties ======================================= -->
-  
+ 
+  <!-- 
+    When adding, removing, or renaming a property, please remember to modify
+    maven-pluto-plugin/src/main/resources/versions.properties as well!
+  -->
   <properties>
     <portlet-api.version>1.0</portlet-api.version>
     <servlet-api.version>2.3</servlet-api.version>
@@ -236,7 +240,7 @@
     <maven.version>2.0</maven.version>
     <ant.version>1.6.5</ant.version>
     <junit.version>3.8.1</junit.version>
-    <jmock.version>1.0.1</jmock.version>
+    <jmock.version>1.0.1</jmock.version>    
   </properties>