You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by fe...@apache.org on 2005/03/11 11:46:24 UTC

cvs commit: jakarta-cactus/integration/maven/xdocs changes.xml

felipeal    2005/03/11 02:46:24

  Modified:    integration/maven plugin.jelly
               integration/maven/xdocs changes.xml
  Added:       integration/maven/src/plugin-test/testBundleProperties
                        maven.xml project.properties project.xml
  Log:
  CACTUS-197: goal cactus:cactifyear now uses dependency properties <ear.bundle.name> and <ear.bundle.dir>
  
  Revision  Changes    Path
  1.43      +26 -8     jakarta-cactus/integration/maven/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/maven/plugin.jelly,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- plugin.jelly	10 Jan 2005 19:08:16 -0000	1.42
  +++ plugin.jelly	11 Mar 2005 10:46:24 -0000	1.43
  @@ -21,6 +21,7 @@
     xmlns:x="jelly:xml"
     xmlns:maven="jelly:maven"
     xmlns:test="test"
  +  xmlns:ear="ear"
     xmlns:cactustag="cactus"
     xmlns:cactus="jelly:org.apache.cactus.integration.maven.CactusTagLibrary">
   
  @@ -1022,15 +1023,31 @@
         </ant:fileset>
   
         <!-- include marked dependencies -->
  +      <j:set var="tmpDependenciesDir" value="${maven.build.dir}/tmpEarDeps"/>
         <j:forEach var="lib" items="${pom.artifacts}">
           <j:set var="dep" value="${lib.dependency}"/>      
  +        <j:set var="originalPath" value="${lib.file.name}"/>      
           <j:if test="${dep.getProperty('ear.bundle')=='true' || dep.getProperty('ear.module')=='true'}">
  -          <ant:fileset dir="${lib.file.parent}">
  -            <ant:include name="${lib.file.name}"/>
  -          </ant:fileset>
  +          <ear:setPath lib="${lib}" var="bundledPath"/>
  +          <j:choose>
  +             <j:when test="${originalPath.equals(bundledPath)}">
  +               <ant:fileset dir="${lib.file.parent}">
  +                 <ant:include name="${originalPath}"/>
  +               </ant:fileset>
  +             </j:when>
  +             <j:otherwise>
  +               <echo>Dependency ${lib.file.name} will be bundled as ${bundledPath}</echo>
  +               <ant:copy file="${lib.file.parent}/${lib.file.name}" tofile="${tmpDependenciesDir}/${bundledPath}"/>
  +             </j:otherwise>
  +          </j:choose>
           </j:if>  
         </j:forEach>
   
  +      <!-- bundle all dependencies that were copied to a temporary dir -->
  +      <util:available file="${tmpDependenciesDir}">
  +         <ant:fileset dir="${tmpDependenciesDir}"/>
  +      </util:available>
  +
         <j:if test="${cactus.ear.manifest.available}">
           <ant:setProperty name="manifest" 
               value="${pom.getPluginContext('maven-ear-plugin').getVariable('maven.ear.manifest')}"/>
  @@ -1266,36 +1283,37 @@
   
           <j:forEach var="lib" items="${pom.artifacts}">
             <j:set var="dep" value="${lib.dependency}"/>
  +          <ear:setPath lib="${lib}" var="bundledPath"/>
             <j:if test="${dep.getProperty('ear.bundle')=='true' || dep.getProperty('ear.module')=='true'}">
               <j:choose>
                 <j:when test="${dep.type=='war'}">
                   <x:element name="module">
                     <x:element name="web">
  -                    <x:element name="web-uri">${dep.getArtifact()}</x:element>
  +                    <x:element name="web-uri">${bundledPath}</x:element>
                       <x:element name="context-root">${dep.getProperty('ear.appxml.war.context-root')}</x:element>
                    </x:element>                
                   </x:element>
                 </j:when>
                 <j:when test="${dep.type=='ejb'}">
                   <x:element name="module">
  -                  <x:element name="ejb">${dep.getArtifact()}</x:element>                 
  +                  <x:element name="ejb">${bundledPath}</x:element>                 
                   </x:element>
                 </j:when>       
                 <j:when test="${dep.type=='jar'}">
                   <j:if test="${dep.getProperty('ear.module')=='true'}">
                     <x:element name="module">  
  -                    <x:element name="java">${dep.getArtifact()}</x:element>                 
  +                  <x:element name="java">${bundledPath}</x:element>                 
                     </x:element>
                   </j:if>
                 </j:when>
                 <j:when test="${dep.type=='rar'}">
                   <x:element name="module">  
  -                  <x:element name="connector">${dep.getArtifact()}</x:element>                 
  +                <x:element name="connector">${bundledPath}</x:element>                 
                   </x:element>
                 </j:when>
                 <j:when test="${dep.type=='sar'}">
                   <x:element name="module">
  -                  <x:element name="connector">${dep.getArtifact()}</x:element>
  +                <x:element name="connector">${bundledPath}</x:element>
                   </x:element>
                 </j:when>
               </j:choose> 
  
  
  
  1.1                  jakarta-cactus/integration/maven/src/plugin-test/testBundleProperties/maven.xml
  
  Index: maven.xml
  ===================================================================
  <!-- 
  /*
   * Copyright 2005 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.
   */
   -->
  
  <!-- OBS: this test was copied from the maven-ear-plugin test cases -->
  <project xmlns:j="jelly:core" 
           xmlns:assert="assert"
           xmlns:util="jelly:util"
           xmlns:x="jelly:xml"
           default="testPlugin">
  
    <goal name="testPlugin" prereqs="cactus:cactifyear,test-ear">
      <attainGoal name="clean"/>
    </goal>
    
    <goal name="test-ear">
  
      <!-- tests that the ear is generated -->
      <j:set var="earFile" value="${maven.build.dir}/${pom.artifactId}-cactus.ear"/>
      <assert:assertFileExists file="${earFile}"/>
      
      <!-- unzip the ear and look for the jars -->
      <j:set var="unzipDir" value= "${maven.build.dir}/eartest"/>
      <mkdir dir="${unzipDir}"/>
      <unzip src="${earFile}" dest="${unzipDir}"/>
  
      <!-- check for commons-logging -->
      <j:set var="commonsExpectedPath" value="/APP-INF/lib/commons-logging-1.0.3.jar"/>
      <assert:assertFileExists file="${unzipDir}${commonsExpectedPath}"
        msg="commons-logging was not bundled"/>
      
      <!-- check that commons-collections has been packaged in the right place-->
      <assert:assertFileExists file="${unzipDir}/commons-collections-2.1.jar"
        msg="commons-collections was bundled incorrectly"/>
  
      <!-- check that commons-digester has been packaged in the right place-->
      <assert:assertFileExists file="${unzipDir}/commons-digester.jar"
        msg="commons-digester was bundled incorrectly"/>
  
      <!-- check that log4j has been packaged in the right place-->
      <assert:assertFileExists file="${unzipDir}/APP-INF/lib/LOG4J.JAR"
        msg="log4j was bundled incorrectly"/>
  
      <!-- check that the application.xml was generated -->
      <j:set var="appXml" value="${unzipDir}/META-INF/application.xml"/>
      <assert:assertFileExists file="${appXml}"
        msg="application.xml was not generated"/>
  
      <!-- check that commons-logging was set with the right path -->
      <util:file var="appXmlFile" name="${appXml}"/>
      <x:parse var="appXmlDoc" xml="${appXmlFile}"/>
      <x:set var="commonsLogging" select="string($appXmlDoc/application/module/java)"/>
      <assert:assertEquals expected="${commonsExpectedPath}" value="${commonsLogging}"/>
  
    </goal>
  </project>
  
  
  
  1.1                  jakarta-cactus/integration/maven/src/plugin-test/testBundleProperties/project.properties
  
  Index: project.properties
  ===================================================================
  # -------------------------------------------------------------------
  # Copyright 2005 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.
  # -------------------------------------------------------------------
  maven.ear.appxml.generate=true
  
  
  
  1.1                  jakarta-cactus/integration/maven/src/plugin-test/testBundleProperties/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!-- 
  /*
   * Copyright 2005 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.
   */
   -->
  
  
  <project>
    <pomVersion>3</pomVersion>
    <name>testBundlePropertiesTest</name>
    <artifactId>testBundlePropertiesTest</artifactId>
    <currentVersion>1.0.0</currentVersion>
    <shortDescription>Test for new properties ear.bundle.name and ear.bundle.dir</shortDescription>
    <description>Tests if a dependency which has the properties ear.bundle.name or ear.bundle.dir it is properly bundled in the EAR (see issues MPEAR-26, MPEAR-23 and CACTUS-197)</description>
    <dependencies>
      <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.0.3</version>
        <properties>
          <ear.bundle.dir>/APP-INF/lib</ear.bundle.dir>
          <ear.module>true</ear.module>
        </properties>
      </dependency>
      <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>2.1</version>
        <properties>
          <ear.bundle>true</ear.bundle>
        </properties>
      </dependency>
      <dependency>
        <groupId>commons-digester</groupId>
        <artifactId>commons-digester</artifactId>
        <version>1.6</version>
        <properties>
          <ear.bundle>true</ear.bundle>
          <ear.bundle.name>commons-digester.jar</ear.bundle.name>
        </properties>
      </dependency>
      <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.8</version>
        <properties>
          <ear.bundle>true</ear.bundle>
          <ear.bundle.name>LOG4J.JAR</ear.bundle.name>
          <ear.bundle.dir>/APP-INF/lib</ear.bundle.dir>
        </properties>
      </dependency>
    </dependencies>
  </project>
  
  
  
  1.61      +4 -0      jakarta-cactus/integration/maven/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/maven/xdocs/changes.xml,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- changes.xml	28 Jan 2005 13:00:00 -0000	1.60
  +++ changes.xml	11 Mar 2005 10:46:24 -0000	1.61
  @@ -8,6 +8,10 @@
     <body>
   
       <release version="1.8dev" date="in CVS">
  +      <action dev="felipeal" type="fix" due-to="Brett Porter" issue="CACTUS-197">
  +        Added support for <code>ear.bundle.name</code> and
  +        <code>ear.bundle.dir</code> properties.
  +      </action>
       </release>
   
       <release version="1.7" date="2005-01-28">
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org