You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by th...@apache.org on 2012/05/23 16:09:51 UTC

svn commit: r1341870 - in /cocoon/cocoon3/trunk/cocoon-archetype-block: ./ pom.xml src/main/resources/archetype-resources/pom.xml xsl/ xsl/properties-to-pom.xsl

Author: thorsten
Date: Wed May 23 14:09:50 2012
New Revision: 1341870

URL: http://svn.apache.org/viewvc?rev=1341870&view=rev
Log:
COCOON3-101 refactoring cocoon-archetype-block to use the parent versions of the deps so we do not need to keep them in sync by hand.

Added:
    cocoon/cocoon3/trunk/cocoon-archetype-block/xsl/
    cocoon/cocoon3/trunk/cocoon-archetype-block/xsl/properties-to-pom.xsl
Removed:
    cocoon/cocoon3/trunk/cocoon-archetype-block/src/main/resources/archetype-resources/pom.xml
Modified:
    cocoon/cocoon3/trunk/cocoon-archetype-block/   (props changed)
    cocoon/cocoon3/trunk/cocoon-archetype-block/pom.xml

Propchange: cocoon/cocoon3/trunk/cocoon-archetype-block/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed May 23 14:09:50 2012
@@ -3,3 +3,4 @@
 .settings
 target
 *.iml
+src/main/resources/archetype-resources/pom.xml

Modified: cocoon/cocoon3/trunk/cocoon-archetype-block/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-archetype-block/pom.xml?rev=1341870&r1=1341869&r2=1341870&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-archetype-block/pom.xml (original)
+++ cocoon/cocoon3/trunk/cocoon-archetype-block/pom.xml Wed May 23 14:09:50 2012
@@ -1,27 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
+<!-- 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. -->
 <!-- $Id$ -->
-<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/maven-v4_0_0.xsd">
+<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/maven-v4_0_0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
-  
+
   <parent>
     <groupId>org.apache.cocoon.parent</groupId>
     <artifactId>cocoon-parent</artifactId>
@@ -31,7 +24,128 @@
 
   <groupId>org.apache.cocoon.archetype-block</groupId>
   <artifactId>cocoon-archetype-block</artifactId>
-  <version>3.0.0-beta-1-SNAPSHOT</version>
-
   <name>Apache Cocoon 3: Block Archetype</name>
+  
+  <!-- FIXME this props should come from the parent! -->
+  <properties>
+    <cocoon.version>3.0.0-beta-1-SNAPSHOT</cocoon.version>
+    <spring.version>3.1.1.RELEASE</spring.version>
+  </properties>
+  
+  <build>
+    <plugins>
+    <!-- FIXME next is not working but the idea is to have probs for
+    parent and archetypes in common -->
+      <!-- <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>properties-maven-plugin</artifactId>
+        <version>1.0-alpha-2</version>
+        <executions>
+          <execution>
+            <phase>initialize</phase>
+            <goals>
+              <goal>read-project-properties</goal>
+            </goals>
+            <configuration>
+              <files>
+                <file>../parent/dev.properties</file>
+              </files>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>-->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>xml-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>transform</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <transformationSets>
+            <transformationSet>
+              <dir>../parent</dir>
+              <outputDir>${basedir}/src/main/resources/archetype-resources</outputDir>
+              <stylesheet>${basedir}/xsl/properties-to-pom.xsl</stylesheet>
+              <includes>
+                <include>pom.xml</include>
+              </includes>
+              <parameters>
+                <parameter>
+                  <name>cocoonVersion</name>
+                  <value>${cocoon.version}</value>
+                </parameter>
+                <parameter>
+                  <name>springVersion</name>
+                  <value>${spring.version}</value>
+                </parameter>
+              </parameters>
+            </transformationSet>
+          </transformationSets>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>net.sf.saxon</groupId>
+            <artifactId>saxon</artifactId>
+            <version>8.7</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+    <pluginManagement>
+      <plugins>
+        <!--This plugin's configuration is used to store Eclipse m2e settings 
+          only. It has no influence on the Maven build itself. -->
+        <plugin>
+          <groupId>org.eclipse.m2e</groupId>
+          <artifactId>lifecycle-mapping</artifactId>
+          <version>1.0.0</version>
+          <configuration>
+            <lifecycleMappingMetadata>
+              <pluginExecutions>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>
+                      xml-maven-plugin
+                    </artifactId>
+                    <versionRange>[1.0,)</versionRange>
+                    <goals>
+                      <goal>transform</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore></ignore>
+                  </action>
+                </pluginExecution>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>
+                      properties-maven-plugin
+                    </artifactId>
+                    <versionRange>
+                      [1.0-alpha-2,)
+                    </versionRange>
+                    <goals>
+                      <goal>
+                        read-project-properties
+                      </goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore></ignore>
+                  </action>
+                </pluginExecution>
+              </pluginExecutions>
+            </lifecycleMappingMetadata>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
 </project>

Added: cocoon/cocoon3/trunk/cocoon-archetype-block/xsl/properties-to-pom.xsl
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-archetype-block/xsl/properties-to-pom.xsl?rev=1341870&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-archetype-block/xsl/properties-to-pom.xsl (added)
+++ cocoon/cocoon3/trunk/cocoon-archetype-block/xsl/properties-to-pom.xsl Wed May 23 14:09:50 2012
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:saxon="http://saxon.sf.net/" version="2.0"
+  xmlns:m="http://maven.apache.org/POM/4.0.0" xmlns="http://maven.apache.org/POM/4.0.0">
+  <xsl:param name="cocoonVersion" />
+  <xsl:param name="springVersion" />
+  <xsl:variable name="versionedDeps">
+  <![CDATA[<dependencies xmlns="http://maven.apache.org/POM/4.0.0">
+      <dependency>
+        <groupId>javax.servlet</groupId>
+        <artifactId>servlet-api</artifactId>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-jmx</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.aspectj</groupId>
+        <artifactId>aspectjrt</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.aspectj</groupId>
+        <artifactId>aspectjweaver</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>ch.qos.logback</groupId>
+        <artifactId>logback-core</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>ch.qos.logback</groupId>
+        <artifactId>logback-classic</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>commons-logging</groupId>
+        <artifactId>commons-logging</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>jcl-over-slf4j</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <scope>test</scope>
+      </dependency>
+    </dependencies>]]></xsl:variable>
+  <xsl:variable name="deps" select="saxon:parse($versionedDeps)" />
+  <xsl:variable name="depsV" select="//m:dependencies" />
+  <xsl:template match="/">
+    <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/maven-v4_0_0.xsd
+">
+
+      <modelVersion>4.0.0</modelVersion>
+      <packaging>jar</packaging>
+
+      <artifactId>${artifactId}</artifactId>
+      <groupId>${groupId}</groupId>
+      <version>${version}</version>
+      <name>${artifactId}</name>
+      <description>${groupId}:${artifactId}:${version}</description>
+
+      <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <cocoon.version>
+          <xsl:value-of select="$cocoonVersion" />
+        </cocoon.version>
+        <spring.version>
+          <xsl:value-of select="$springVersion" />
+        </spring.version>
+      </properties>
+      <dependencies>
+        <dependency>
+          <groupId>org.apache.cocoon.servlet</groupId>
+          <artifactId>cocoon-servlet</artifactId>
+          <version>${cocoon.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.cocoon.stringtemplate</groupId>
+          <artifactId>cocoon-stringtemplate</artifactId>
+          <version>${cocoon.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-beans</artifactId>
+          <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-core</artifactId>
+          <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-context</artifactId>
+          <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-context-support</artifactId>
+          <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-aop</artifactId>
+          <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-web</artifactId>
+          <version>${spring.version}</version>
+        </dependency>
+        <xsl:apply-templates select="$deps/*/*" />
+      </dependencies>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-eclipse-plugin</artifactId>
+            <version>2.8</version>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.cocoon</groupId>
+            <artifactId>cocoon-maven-plugin</artifactId>
+            <version>1.0.0</version>
+            <configuration>
+              <webappProfile>ssf</webappProfile>
+              <customWebappDirectory>rcl-config</customWebappDirectory>
+            </configuration>
+            <executions>
+              <execution>
+                <phase>compile</phase>
+                <goals>
+                  <goal>prepare</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.mortbay.jetty</groupId>
+            <artifactId>maven-jetty-plugin</artifactId>
+            <version>6.1.26</version>
+            <configuration>
+              <connectors>
+                <connector
+                  implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+                  <port>8888</port>
+                  <maxIdleTime>30000</maxIdleTime>
+                </connector>
+              </connectors>
+              <webAppSourceDirectory>${project.build.directory}/rcl/webapp
+              </webAppSourceDirectory>
+              <contextPath>/</contextPath>
+              <systemProperties>
+                <systemProperty>
+                  <name>org.apache.cocoon.mode</name>
+                  <value>dev</value>
+                </systemProperty>
+              </systemProperties>
+            </configuration>
+          </plugin>
+          <plugin>
+            <artifactId>maven-jar-plugin</artifactId>
+            <version>2.1</version>
+            <configuration>
+              <archive>
+                <manifestEntries>
+                  <Cocoon-Block-Name>${project.artifactId}
+                  </Cocoon-Block-Name>
+                </manifestEntries>
+              </archive>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </project>
+  </xsl:template>
+  <xsl:template match="m:dependency">
+    <xsl:variable name="artifactId" select="m:artifactId" />
+    <xsl:variable name="groupId" select="m:groupId" />
+    <dependency>
+      <groupId>
+        <xsl:value-of select="$groupId" />
+      </groupId>
+      <artifactId>
+        <xsl:value-of select="$artifactId" />
+      </artifactId>
+      <version>
+        <xsl:value-of
+          select="$depsV/*[m:artifactId=$artifactId and m:groupId=$groupId]/m:version" />
+      </version>
+    </dependency>
+  </xsl:template>
+</xsl:stylesheet>