felipeal 2004/11/15 21:04:56 Modified: ear plugin.jelly plugin.properties ear/xdocs changes.xml properties.xml Added: ear/src/plugin-test/test03 maven.xml project.properties project.xml ear/src/plugin-test/test03/src/application bogus.jar ear/src/plugin-test/test04 maven.xml project.properties project.xml ear/src/plugin-test/test04/src/application bogus.jar ear/src/plugin-test/test04/src/application/META-INF application.xml Log: MPEAR-7: application.xml is now generated at maven.build.dir Revision Changes Path 1.27 +20 -11 maven-plugins/ear/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven-plugins/ear/plugin.jelly,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- plugin.jelly 16 Nov 2004 03:51:39 -0000 1.26 +++ plugin.jelly 16 Nov 2004 05:04:56 -0000 1.27 @@ -48,21 +48,30 @@ <ant:mkdir dir="${maven.build.dir}" /> - <j:set var="isGenerateAppXML" - value="${context.getVariable('maven.ear.appxml.generate')}"/> - <j:if test="${isGenerateAppXML == 'true'}"> - <!-- make sure that target directory exists --> - <ant:mkdir dir="${maven.ear.descriptordir}"/> - <attainGoal name="ear:generate-ear-descriptor"/> - </j:if > + <j:set var="finalAppxml" value="${maven.ear.descriptordir}/application.xml"/> + <j:set var="isGenerateAppXML" + value="${context.getVariable('maven.ear.appxml.generate')}"/> + <!-- make sure that target directory exists --> + <ant:mkdir dir="${maven.ear.descriptordir}"/> + <j:choose> + <j:when test="${isGenerateAppXML == 'true'}"> + <attainGoal name="ear:generate-ear-descriptor"/> + </j:when> + <j:otherwise> + <util:available file="${maven.ear.src}/META-INF/application.xml"> + <ant:copy file="${maven.ear.appxml}" tofile="${finalAppxml}"/> + </util:available> + </j:otherwise> + </j:choose> + - <ant:echo>Building EAR ${maven.final.name} with appxml "${maven.ear.appxml}"</ant:echo> + <ant:echo>Building EAR ${maven.final.name} with appxml "${finalAppxml}"</ant:echo> <ant:available property="maven.ear.manifest.available" file="${maven.ear.manifest}"/> <ant:ear destfile="${maven.build.dir}/${maven.final.name}.ear" - appxml="${maven.ear.appxml}"> + appxml="${finalAppxml}"> <!-- include files from maven.ear.src if available --> <util:available file="${maven.ear.src}"> @@ -161,9 +170,9 @@ <!--==================================================================--> <goal name="ear:generate-ear-descriptor" description="Generates the ear descriptor"> - <ant:echo>Generating appxml file:"${maven.ear.appxml} version ${maven.ear.appxml.version} encoding: ${maven.ear.appxml.encoding}"</ant:echo> + <ant:echo>Generating appxml file:"${finalAppxml} version ${maven.ear.appxml.version} encoding: ${maven.ear.appxml.encoding}"</ant:echo> - <j:file name="${maven.ear.appxml}" + <j:file name="${finalAppxml}" outputMode="xml" prettyPrint="true" encoding="${maven.ear.appxml.encoding}" 1.9 +3 -3 maven-plugins/ear/plugin.properties Index: plugin.properties =================================================================== RCS file: /home/cvs/maven-plugins/ear/plugin.properties,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- plugin.properties 11 Nov 2004 11:55:45 -0000 1.8 +++ plugin.properties 16 Nov 2004 05:04:56 -0000 1.9 @@ -24,9 +24,9 @@ maven.ear.src=${maven.src.dir}/application # Location of xml configs and manifest files -maven.ear.descriptordir=${maven.ear.src}/META-INF -maven.ear.appxml=${maven.ear.descriptordir}/application.xml -maven.ear.manifest=${maven.ear.descriptordir}/MANIFEST.MF +maven.ear.descriptordir=${maven.build.dir} +maven.ear.appxml=${maven.ear.src}/META-INF/application.xml +maven.ear.manifest=${maven.ear.src}/META-INF/MANIFEST.MF maven.ear.appxml.generate=false maven.ear.displayname=${pom.artifactId} maven.ear.appxml.version=1.3 1.1 maven-plugins/ear/src/plugin-test/test03/maven.xml Index: maven.xml =================================================================== <!-- /* * 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. */ --> <project xmlns:assert="assert" xmlns:util="jelly:util" xmlns:j="jelly:core" xmlns:ant="jelly:ant" default="testPlugin"> <goal name="testPlugin" prereqs="test-ear"> <attainGoal name="clean"/> </goal> <goal name="test-ear" prereqs="ear:init"> <!-- makes sure application.xml didn't exist before --> <util:available file="${maven.ear.src}/META-INF/application.xml"> <ant:fail>Testcase should not have file ${maven.ear.src}/META-INF/application.xml. Please remove it first.</ant:fail> </util:available> <attainGoal name="ear"/> <!-- makes sure application.xml wasn't added --> <util:available file="${maven.ear.src}/META-INF/application.xml"> <ant:fail>Plugin should not have created file ${maven.ear.src}/META-INF/application.xml.</ant:fail> </util:available> <!-- tests that the ear is generated --> <assert:assertFileExists file="${maven.build.dir}/${maven.final.name}.ear"/> <!-- extracts the EAR --> <j:set var="tmpEarDir" value="${maven.build.dir}/extractedEar"/> <ant:unzip src="${maven.build.dir}/${maven.final.name}.ear" dest="${tmpEarDir}"/> <!-- asserts the application.xml is there --> <assert:assertFileExists file="${tmpEarDir}/META-INF/application.xml"/> </goal> </project> 1.1 maven-plugins/ear/src/plugin-test/test03/project.properties Index: project.properties =================================================================== # ------------------------------------------------------------------- # 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. # ------------------------------------------------------------------- maven.ear.appxml.generate=true 1.1 maven-plugins/ear/src/plugin-test/test03/project.xml Index: project.xml =================================================================== <?xml version="1.0" encoding="UTF-8"?> <!-- /* * 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. */ --> <project> <pomVersion>3</pomVersion> <name>Test project for Maven Ear Plugin 03</name> <artifactId>test-maven-ear-plugin-03</artifactId> <inceptionYear>2004</inceptionYear> <shortDescription>Tests that application.xml is not generated at maven.ear.src</shortDescription> <shortDescription>Tests that application.xml is not generated at maven.ear.src (see issue MPEAR-7)</shortDescription> <url/> <developers> <developer> <name>Felipe Leme</name> <id>felipeal</id> <role>Jelly Developer</role> </developer> </developers> </project> 1.1 maven-plugins/ear/src/plugin-test/test03/src/application/bogus.jar <<Binary file>> 1.1 maven-plugins/ear/src/plugin-test/test04/maven.xml Index: maven.xml =================================================================== <!-- /* * 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. */ --> <project xmlns:assert="assert" xmlns:util="jelly:util" xmlns:j="jelly:core" xmlns:ant="jelly:ant" default="testPlugin"> <goal name="testPlugin" prereqs="test-ear"> <attainGoal name="clean"/> </goal> <goal name="test-ear" prereqs="ear:init"> <echo>SRC: ${maven.ear.src}</echo> <!-- makes sure application.xml existed before --> <assert:assertFileExists file="${maven.ear.src}/META-INF/application.xml"/> <attainGoal name="ear"/> <!-- makes sure application.xml existed after --> <assert:assertFileExists file="${maven.ear.src}/META-INF/application.xml"/> <!-- tests that the ear is generated --> <assert:assertFileExists file="${maven.build.dir}/${maven.final.name}.ear"/> <!-- extracts the EAR --> <j:set var="tmpEarDir" value="${maven.build.dir}/extractedEar"/> <ant:unzip src="${maven.build.dir}/${maven.final.name}.ear" dest="${tmpEarDir}"/> <!-- asserts the application.xml is there --> <assert:assertFileExists file="${tmpEarDir}/META-INF/application.xml"/> <!-- asserts the application.xml content is the same as before --> <util:loadText var="newAppXml" file="${tmpEarDir}/META-INF/application.xml"/> <util:loadText var="oldAppXml" file="${maven.ear.src}/META-INF/application.xml"/> <assert:assertEquals expected="${oldAppXml}" value="${newAppXml}"/> </goal> </project> 1.1 maven-plugins/ear/src/plugin-test/test04/project.properties Index: project.properties =================================================================== # ------------------------------------------------------------------- # 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. # ------------------------------------------------------------------- maven.ear.appxml.generate=false 1.1 maven-plugins/ear/src/plugin-test/test04/project.xml Index: project.xml =================================================================== <?xml version="1.0" encoding="UTF-8"?> <!-- /* * 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. */ --> <project> <pomVersion>3</pomVersion> <name>Test project for Maven Ear Plugin 04</name> <artifactId>test-maven-ear-plugin-04</artifactId> <inceptionYear>2004</inceptionYear> <shortDescription>Tests that application.xml is correctly bundled</shortDescription> <shortDescription>Tests that application.xml is correctly bundled when it is not generated (see issue MPEAR-7)</shortDescription> <url/> <developers> <developer> <name>Felipe Leme</name> <id>felipeal</id> <role>Jelly Developer</role> </developer> </developers> </project> 1.1 maven-plugins/ear/src/plugin-test/test04/src/application/bogus.jar <<Binary file>> 1.1 maven-plugins/ear/src/plugin-test/test04/src/application/META-INF/application.xml Index: application.xml =================================================================== <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd"> <application> <display-name>My Display</display-name> </application> 1.28 +1 -0 maven-plugins/ear/xdocs/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/maven-plugins/ear/xdocs/changes.xml,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- changes.xml 16 Nov 2004 03:22:59 -0000 1.27 +++ changes.xml 16 Nov 2004 05:04:56 -0000 1.28 @@ -25,6 +25,7 @@ </properties> <body> <release version="1.6-SNAPSHOT" date="in CVS"> + <action dev="felipeal" type="fix" issue="MPEAR-7"><code>application.xml</code> is now generated at <code>maven.build.dir</code></action> <action dev="felipeal" type="add" issue="MPEAR-26">Add new property dependency (<code>ear.bundle.name</code>) to define the name a dependency should have the EAR.</action> <action dev="felipeal" type="fix" issue="MPEAR-20">Changed the default value of <code>maven.ear.displayname</code>.</action> <action dev="felipeal" type="add" issue="MPEAR-23" due-to="Wiley Fuller">Add new property dependency(<code>ear.bundle.dir</code>) to define where a dependency should be added in the EAR.</action> 1.19 +12 -2 maven-plugins/ear/xdocs/properties.xml Index: properties.xml =================================================================== RCS file: /home/cvs/maven-plugins/ear/xdocs/properties.xml,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- properties.xml 16 Nov 2004 03:22:59 -0000 1.18 +++ properties.xml 16 Nov 2004 05:04:56 -0000 1.19 @@ -35,7 +35,7 @@ Location of the manifest file to be used within the ear file. </td> <td> - ${maven.src.dir}/application/META-INF/MANIFEST.MF + ${maven.ear.src}/META-INF/MANIFEST.MF </td> </tr> <tr> @@ -46,7 +46,7 @@ to be used within the ear file. </td> <td> - ${maven.src.dir}/application/META-INF/application.xml + ${maven.ear.src}/META-INF/application.xml </td> </tr> <tr> @@ -109,6 +109,16 @@ </td> <td> UTF-8 + </td> + </tr> + <tr> + <td>maven.ear.descriptordir</td> + <td>Yes</td> + <td> + Directory where the <code>application.xml</code> file will be auto-generated (only if <code>maven.ear.appxml.generate</code> is true). + </td> + <td> + ${maven.build.dir} </td> </tr> </table>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]