Title: [881] trunk/tooling/maven-jbi-plugin: SM-209 : add artifacts installtion / deployment to maven-jbi-plugin
Revision
881
Author
gnt
Date
2005-11-22 03:12:06 -0500 (Tue, 22 Nov 2005)

Log Message

SM-209 : add artifacts installtion / deployment to maven-jbi-plugin

Modified Paths


Diff

Modified: trunk/tooling/maven-jbi-plugin/plugin.jelly (880 => 881)

--- trunk/tooling/maven-jbi-plugin/plugin.jelly	2005-11-22 02:59:21 UTC (rev 880)
+++ trunk/tooling/maven-jbi-plugin/plugin.jelly	2005-11-22 08:12:06 UTC (rev 881)
@@ -19,42 +19,220 @@
 <project xmlns:j="jelly:core"
          xmlns:ant="jelly:ant"
          xmlns:license="license" 
+         xmlns:maven="jelly:maven"
          xmlns:util="jelly:util"
          xmlns:artifact="artifact"
+         xmlns:x="jelly:xml"
          xmlns:interaction="jelly:interaction">
-	<goal name="jbi:generateInstaller" prereqs="jar:jar" description="Generates a JBI installer">  		  	  
-	<ant:mkdir dir="${jbi.build.dir}/lib"/>	
-	<ant:mkdir dir="${jbi.build.dir}/META-INF"/>		
-  	<j:file name="${jbi.build.dir}/META-INF/jbi.xml" prettyPrint="true"
-			outputMode="xml" escapeText="false">
-			<j:import file="${jbi.xml.template}" inherit="true" />
-	</j:file>
 	
-	<util:file var="jbiDirectory" name="${jbi.base.directory}"/>
-    	<j:if test="${servicesFile.exists()}">
-		<copy todir="${jbi.build.dir}">
-	    	<fileset dir="${jbi.base.directory}"/>
-		</copy>
-	</j:if>
-	<ant:copy file="${plugin.resources}/jbi.xsd" todir="${jbi.build.dir}"/>
-	<ant:copy file="${plugin.resources}/service.xsd" todir="${jbi.build.dir}"/>	
-	<ant:zip destfile="${maven.build.dir}/${maven.final.name}-jbi-installer.zip" basedir="${jbi.build.dir}">
-    	<include name="**/*"/>            	
-  	</ant:zip>
+  <!--==================================================================-->
+  <!-- Default goal : Builds a jbi file                                 -->
+  <!--==================================================================-->
+  <goal name="jbi" prereqs="jbi:jbi" description="Build a jbi file"/>
+
+  <!--==================================================================-->
+  <!-- Initializations                                                  -->
+  <!--==================================================================-->
+  <goal name="jbi:init" 
+    description="Initialise filesystem and other resources for a jbi">
+
+    <ant:available property="jbiResourcesPresent" type="dir"
+      file="${maven.jbi.src}"/>
+      
   </goal>
   
+  <!--==================================================================-->
+  <!-- Builds a jbi installer file                                      -->
+  <!--==================================================================-->
+  <goal name="jbi:jbi" prereqs="jbi:init,jar:jar" description="Build a jbi file">
+
+    <ant:echo>Building JBI installer ${pom.artifactId}</ant:echo>
+
+    <ant:mkdir dir="${maven.jbi.build.dir}" />
+    
+    <!-- Copy resources -->
+    <j:if test="${jbiResourcesPresent == 'true'}">
+      <ant:copy todir="${maven.jbi.build.dir}" preservelastmodified="true">
+        <ant:fileset dir="${maven.jbi.src}"
+          includes="${maven.jbi.src.includes}"
+          excludes="${maven.jbi.src.excludes}">
+        </ant:fileset>
+      </ant:copy>
+    </j:if>
+    <ant:copy todir="${maven.jbi.build.dir}" file="${plugin.resources}/jbi.xsd"/>
+    
+    <!-- Copy libs -->
+    <j:forEach var="lib" items="${pom.artifacts}">
+      <j:set var="dep" value="${lib.dependency}"/>     
+      <j:if test="${dep.getProperty('jbi.bundle')=='true'}">
+         <j:if test="${dep.type =='jar'}"> 
+           <ant:copy todir="${maven.jbi.build.lib}" file="${lib.path}"/>  
+         </j:if> 
+      </j:if>  
+    </j:forEach>  
+    <ant:copy todir="${maven.jbi.build.lib}" file="${maven.build.dir}/${maven.final.name}.jar"/>        
+
+    <ant:available property="maven.jbi.descriptor.available"
+      file="${maven.jbi.descriptor}"/>
+    <j:if test="${!maven.jbi.descriptor.available}">
+      <attainGoal name="jbi:generate-jbi-descriptor" />
+    </j:if>
+
+    <ant:available property="maven.jbi.manifest.available"
+      file="${maven.jbi.manifest}"/>
+
+    <ant:jar 
+         destfile="${maven.build.dir}/${maven.jbi.final.name}"
+         basedir="${maven.jbi.build.dir}"         
+         index="${maven.jbi.index}">
+
+      <ant:metainf dir="${licenseFile.canonicalFile.parent}">
+        <ant:include name="${licenseFile.canonicalFile.name}"/>
+      </ant:metainf>
+
+      <j:if test="${maven.jbi.manifest.available}">
+        <ant:setProperty name="manifest" value="${maven.jbi.manifest}" />
+      </j:if>
+
+      <ant:manifest>
+        <j:set var="classPath" value="${maven.jbi.classpath}"/>
+        <j:if test="${!empty(classPath)}">
+            <ant:attribute name="Class-Path" value="${maven.jbi.classpath}"/>
+        </j:if>
+
+        <ant:attribute name="Built-By" value="${user.name}" />
+        <ant:section name="${pom.package}">
+          <ant:attribute name="Specification-Title" value="${pom.artifactId}" />
+          <ant:attribute name="Specification-Version"
+                     value="${pom.currentVersion}" />
+          <ant:attribute name="Specification-Vendor"
+                     value="${pom.organization.name}" />
+          <ant:attribute name="Implementation-Title"
+                     value="${pom.package}" />
+          <ant:attribute name="Implementation-Version"
+                     value="${pom.currentVersion}" />
+          <ant:attribute name="Implementation-Vendor"
+                     value="${pom.organization.name}" />
+        </ant:section>
+      </ant:manifest>
+
+    </ant:jar>
+
+  </goal>
+
+  
+  
+  <!--==================================================================-->
+  <!-- Creates jbi descriptor - jbi.xml file                            -->
+  <!--==================================================================-->
+  <goal name="jbi:generate-jbi-descriptor" description="Generates the jbi descriptor">
+     
+     <ant:echo>Generating jbi descriptor</ant:echo>
+     <ant:mkdir dir="${maven.jbi.build.dir}/META-INF" />
+     <j:file  name="${maven.jbi.build.dir}/META-INF/jbi.xml"
+              outputMode="xml"
+              prettyPrint="true"
+              encoding="${maven.jbi.descriptor.encoding}">
+      <j:import file="${plugin.resources}/jbi.jsl" inherit="true" />
+     </j:file>  
+          
+   </goal>
+   
+
+  
+  <!--==================================================================-->
+  <!-- Install the jbi installer in the local repository                          -->
+  <!--==================================================================-->    
+  <goal name="jbi:install"
+        prereqs="jbi:jbi"
+        description="Install the jbi installer in the local repository">
+     
+     <artifact:install
+        artifact="${maven.build.dir}/${maven.final.name}.zip"
+        type="zip"
+        project="${pom}"/> 
+  
+  </goal>
+  
+  <!--==================================================================-->
+  <!-- Install the snapshot version of the jbi installer in the local repository  -->
+  <!--==================================================================-->      
+  <goal name="jbi:install-snapshot"
+        prereqs="jbi:jbi" 
+        description="Install the snapshot version of the jbi installer in the local repository">
+        
+      <artifact:install-snapshot
+        artifact="${maven.build.dir}/${maven.final.name}.zip"
+        type="zip"
+        project="${pom}"/> 
+        
+  </goal>
+
+  <!--==================================================================-->
+  <!-- Deploys the jbi installer to the remote repository                         -->
+  <!--==================================================================-->      
+  <goal name="jbi:deploy" 
+        prereqs="jbi:jbi" 
+        description="Deploys the jbi installer to the remote repository">
+
+     <artifact:deploy
+        artifact="${maven.build.dir}/${maven.final.name}.zip"
+        type="zip"
+        project="${pom}"/>   
+        
+  </goal>      
+        
+  <!--==================================================================-->
+  <!-- Deploys the snapshot version of the jbi installer to the remote repository         -->
+  <!--==================================================================-->      
+  <goal name="jbi:deploy-snapshot" 
+        prereqs="jbi:jbi"
+        description="Deploys the snapshot version of the jbi to remote repository">  
+
+     <artifact:deploy-snapshot
+        artifact="${maven.build.dir}/${maven.final.name}.zip"
+        type="zip"
+        project="${pom}"/>    
+        
+  </goal>
+
+	
+	
+	
+	
+  <goal name="jbi:generateInstaller" prereqs="jar:jar" description="Generates a JBI installer">  		  	  
+    <ant:mkdir dir="${jbi.build.dir}/lib"/>	
+    <ant:mkdir dir="${jbi.build.dir}/META-INF"/>		
+    <j:file name="${jbi.build.dir}/META-INF/jbi.xml" prettyPrint="true"
+            outputMode="xml" escapeText="false">
+      <j:import file="${jbi.xml.template}" inherit="true" />
+    </j:file>
+	
+    <util:file var="jbiDirectory" name="${jbi.base.directory}"/>
+      <j:if test="${servicesFile.exists()}">
+        <copy todir="${jbi.build.dir}">
+          <fileset dir="${jbi.base.directory}"/>
+        </copy>
+    </j:if>
+    <ant:copy file="${plugin.resources}/jbi.xsd" todir="${jbi.build.dir}"/>
+    <ant:copy file="${plugin.resources}/service.xsd" todir="${jbi.build.dir}"/>	
+    <ant:zip destfile="${maven.build.dir}/${maven.final.name}-jbi-installer.zip" basedir="${jbi.build.dir}">
+      <include name="**/*"/>            	
+    </ant:zip>
+  </goal>
+  
   <goal name="jbi:createArchetype" description="Generates a template JBI project">  		  	  
-  	<interaction:ask question="Enter the name for your new JBI project" prompt="?" answer="projectName"/>
-  	<ant:mkdir dir="${projectName}/src/main/java/"/>
-  	<ant:mkdir dir="${projectName}/src/main/test/"/>  	
-  	<ant:mkdir dir="${projectName}/src/main/merge/"/>  	  	
-  	<ant:mkdir dir="${projectName}/src/main/jbi/META-INF"/>  	  	  	  	
-  	<j:file name="${projectName}/project.xml" prettyPrint="true"
-			outputMode="xml" escapeText="false">
-			<j:import file="${plugin.resources}/project.jsl" inherit="true" />
-	</j:file>
-	<ant:copy file="${plugin.resources}/project.properties" todir="${projectName}"/>
-	<ant:copy file="${plugin.resources}/jbi-spring.xml" todir="${projectName}/src/main/jbi/META-INF"/>
-	<ant:copy file="${plugin.resources}/services.xml" todir="${projectName}/src/main/merge"/>	
+    <interaction:ask question="Enter the name for your new JBI project" prompt="?" answer="projectName"/>
+    <ant:mkdir dir="${projectName}/src/main/java/"/>
+    <ant:mkdir dir="${projectName}/src/main/test/"/>  	
+    <ant:mkdir dir="${projectName}/src/main/merge/"/>  	  	
+    <ant:mkdir dir="${projectName}/src/main/jbi/META-INF"/>  	  	  	  	
+    <j:file name="${projectName}/project.xml" prettyPrint="true"
+            outputMode="xml" escapeText="false">
+      <j:import file="${plugin.resources}/project.jsl" inherit="true" />
+    </j:file>
+    <ant:copy file="${plugin.resources}/project.properties" todir="${projectName}"/>
+    <ant:copy file="${plugin.resources}/jbi-spring.xml" todir="${projectName}/src/main/jbi/META-INF"/>
+    <ant:copy file="${plugin.resources}/services.xml" todir="${projectName}/src/main/merge"/>	
   </goal>
 </project>

Modified: trunk/tooling/maven-jbi-plugin/plugin.properties (880 => 881)

--- trunk/tooling/maven-jbi-plugin/plugin.properties	2005-11-22 02:59:21 UTC (rev 880)
+++ trunk/tooling/maven-jbi-plugin/plugin.properties	2005-11-22 08:12:06 UTC (rev 881)
@@ -21,7 +21,17 @@
 # -------------------------------------------------------------------
 
 # Location of where SAR sources (non-java) are located.
-jbi.build.dir=${maven.build.dir}/jbi
+maven.jbi.build.dir=${maven.build.dir}/jbi
+maven.jbi.build.lib=${maven.jbi.build.dir}/lib
+maven.jbi.final.name=${pom.artifactId}-installer-${pom.currentVersion}.zip
+maven.jbi.index=false
+maven.jbi.src=""
+maven.jbi.src.includes=**
+maven.jbi.src.excludes=
+maven.jbi.manifest=${maven.jbi.src}/META-INF/MANIFEST.MF
+maven.jbi.descriptor=${maven.jbi.src}/META-INF/jbi.xml
+maven.jbi.descriptor.encoding=UTF-8
+
 jbi.xml.template=${plugin.resources}/jbi.jsl
 jbi.merge.directory=${basedir}/src/main/merge
 jbi.base.directory=${basedir}/src/main/jbi

Modified: trunk/tooling/maven-jbi-plugin/project.xml (880 => 881)

--- trunk/tooling/maven-jbi-plugin/project.xml	2005-11-22 02:59:21 UTC (rev 880)
+++ trunk/tooling/maven-jbi-plugin/project.xml	2005-11-22 08:12:06 UTC (rev 881)
@@ -23,17 +23,28 @@
 	<id>maven-jbi-plugin</id>
 	<groupId>servicemix</groupId>
 	<name>Maven JBI Plugin</name>
-	<currentVersion>1.0</currentVersion>
+	<currentVersion>2.0-SNAPSHOT</currentVersion>
 	<description>JBI Plugin for Maven</description>
 	<shortDescription>JBI Plugin for Maven</shortDescription>
 	<developers>
 		<developer>
-			<name>Philip Dodds</name>
-			<id>pdodds</id>
-			<email>Unity Systems</email>
+			<name>Guillaume Nodet</name>
+			<id>gnt</id>
 		</developer>
 	</developers>
 	<dependencies>
+    <dependency>
+      <groupId>commons-jelly</groupId>
+      <artifactId>commons-jelly-tags-xml</artifactId>
+      <version>1.1</version>
+      <url>http://jakarta.apache.org/commons/jelly/libs/xml/</url>
+    </dependency>
+    <dependency>
+      <groupId>commons-jelly</groupId>
+      <artifactId>commons-jelly-tags-util</artifactId>
+      <version>1.1.1</version>
+      <url>http://jakarta.apache.org/commons/jelly/libs/util/index.html</url>
+    </dependency>
 		<dependency>
 			<groupId>commons-jelly</groupId>
 			<artifactId>commons-jelly-tags-interaction</artifactId>

Modified: trunk/tooling/maven-jbi-plugin/src/plugin-resources/jbi.jsl (880 => 881)

--- trunk/tooling/maven-jbi-plugin/src/plugin-resources/jbi.jsl	2005-11-22 02:59:21 UTC (rev 880)
+++ trunk/tooling/maven-jbi-plugin/src/plugin-resources/jbi.jsl	2005-11-22 08:12:06 UTC (rev 881)
@@ -1,62 +1,51 @@
 <?xml version="1.0"?>
 <j:whitespace xmlns:j="jelly:core" xmlns:util="jelly:util" xmlns:x="jelly:xml"
 	xmlns:ant="jelly:ant" xmlns="dummy" trim="true">
-<x:element URI="http://java.sun.com/xml/ns/jbi" name="jbi">
-		<x:attribute name="xmlns" trim="true">
-            http://java.sun.com/xml/ns/jbi
-        </x:attribute>
-        <x:attribute name="xmlns:xsi" trim="true">
-            http://www.w3.org/2001/XMLSchema-instance
-        </x:attribute>
-        <x:attribute name="xsi:schemaLocation" trim="true">
-            http://java.sun.com/xml/ns/jbi
-        </x:attribute>
-        <x:attribute name="version" trim="true">
-            1.0
-        </x:attribute>
-    <component
-        type="${jbi.component.type}">
+  <x:element URI="http://java.sun.com/xml/ns/jbi" name="jbi">
+		<x:attribute name="xmlns" trim="true">http://java.sun.com/xml/ns/jbi</x:attribute>
+    <x:attribute name="xmlns:xsi" trim="true">http://www.w3.org/2001/XMLSchema-instance</x:attribute>
+    <x:attribute name="xsi:schemaLocation" trim="true">../jbi.xsd</x:attribute>
+    <x:attribute name="version" trim="true">1.0</x:attribute>
+    
+    <component type="${jbi.component.type}">
         <identification>
             <name>${pom.artifactId}</name>
-            <description>${pom.description}
-	    </description>
+            <description>${pom.description}</description>
         </identification>
         <j:set var="componentName" value="${jbi.component.class.name}"/>
         <j:set var="componentJar" value="lib/${maven.final.name}.jar"/>
         <j:if test="${componentName!=null}">
-        <component-class-name description="Component Implementation" >${componentName}</component-class-name>
-        <component-class-path>
-        	<ant:copy
-						file="${maven.build.dir}/${maven.final.name}.jar"
-						todir="${jbi.build.dir}/lib" />
-			<path-element>${componentJar}</path-element>        
-	        <j:forEach var="lib" items="${pom.artifacts}">
-       			<j:set var="dep" value="${lib.dependency}"/> 
-	        	<j:if test="${dep.getProperty('jbi.bundle')=='true'}">   
-					<ant:copy
-						file="${pom.getDependencyPath(dep.getId())}"
-						todir="${jbi.build.dir}/lib" />
-					<j:set var="libname" value="lib/${lib.file.name}"/>
-	            	<path-element>${libname}</path-element>
-            	</j:if>
-			</j:forEach>
-         </component-class-path>
+          <component-class-name description="Component Implementation" >${componentName}</component-class-name>
+          <component-class-path>
+			      <path-element>${componentJar}</path-element>        
+	          <j:forEach var="lib" items="${pom.artifacts}">
+       			  <j:set var="dep" value="${lib.dependency}"/> 
+	        	  <j:if test="${dep.getProperty('jbi.bundle')=='true'}">   
+					      <j:set var="libname" value="lib/${lib.file.name}"/>
+	              <path-element>${libname}</path-element>
+              </j:if>
+            </j:forEach>
+          </component-class-path>
         </j:if>
         <j:set var="bootstrapName" value="${jbi.bootstrap.class.name}"/>
         <j:if test="${bootstrapName!=null}">
-        <bootstrap-class-name>${bootstrapName}</bootstrap-class-name>
-        <bootstrap-class-path>
-         	<ant:copy
-				file="${maven.build.dir}/${maven.final.name}.jar"
-					todir="${jbi.build.dir}/lib" />
-			<path-element>${componentJar}</path-element>   
-        </bootstrap-class-path>
+          <bootstrap-class-name>${bootstrapName}</bootstrap-class-name>
+          <bootstrap-class-path>
+			      <path-element>${componentJar}</path-element>   
+	          <j:forEach var="lib" items="${pom.artifacts}">
+       			  <j:set var="dep" value="${lib.dependency}"/> 
+	        	  <j:if test="${dep.getProperty('jbi.bundle')=='true' &amp;&amp; dep.getProperty('jbi.bootstrap')=='true'}">   
+					      <j:set var="libname" value="lib/${lib.file.name}"/>
+	              <path-element>${libname}</path-element>
+              </j:if>
+            </j:forEach>
+          </bootstrap-class-path>
         </j:if>           
     </component>
-	<util:file var="servicesFile" name="${jbi.merge.directory}/services.xml"/>
+	  <util:file var="servicesFile" name="${jbi.merge.directory}/services.xml"/>
     <j:if test="${servicesFile.exists()}">
-    	<util:loadText file="${servicesFile}" var="services"/>
-    	${services}
+     <util:loadText file="${servicesFile}" var="services"/>
+     ${services}
     </j:if>     
-</x:element> 	
-</j:whitespace>
\ No newline at end of file
+  </x:element> 	
+</j:whitespace>

Reply via email to