mcconnell 2003/11/12 13:16:36
Modified: meta/plugin plugin.jelly
Log:
Add avalon:artifact goal to generate a artifact descriptor in a java.util.Properties
file format.
Revision Changes Path
1.4 +63 -0 avalon/meta/plugin/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/avalon/meta/plugin/plugin.jelly,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- plugin.jelly 17 Oct 2003 02:03:06 -0000 1.3
+++ plugin.jelly 12 Nov 2003 21:16:36 -0000 1.4
@@ -66,4 +66,67 @@
</goal>
+ <!--
+ #
+ # Write out an artifact descriptor for the projects jar file.
+ #
+ -->
+ <goal name="avalon:artifact">
+
+ <!--
+ <ant:available property="jarPresent"
+ file="${maven.build.dir}/${pom.artifactId}.jar"/>
+ <j:if test="${jarPresent == 'true'}">
+ -->
+ <maven:snapshot project="${pom}"/>
+
+ <ant:property name="filename"
+
value="${maven.build.dir}/${pom.artifactId}-${pom.currentVersion}.jar.meta"/>
+ <ant:echo message="Artifact: ${filename}"/>
+ <j:set var="offset" value="${pom.artifactId.length()}"/>
+ <j:set var="scrap"
+ value="${snapshotSignature.substring(offset,snapshotSignature.length())}"/>
+ <j:set var="signature" value="${scrap.substring(1,scrap.length())}"/>
+ <ant:echo file="${filename}">
+#
+# Artifact descriptor.
+#
+
+avalon.artifact.group = ${pom.groupId}
+avalon.artifact.name = ${pom.artifactId}
+avalon.artifact.version = ${pom.currentVersion}
+avalon.artifact.signature = ${signature}
+
+#
+# Implementation dependencies.
+#
+</ant:echo>
+ <j:set var="index" value="0"/>
+ <j:forEach var="dep" items="${pom.dependencies}">
+ <j:set var="key" value="${dep.groupId}:${dep.artifactId};${dep.version}"/>
+ <ant:echo file="${filename}" append="true">
+avalon.dependency.${index} = ${key}</ant:echo>
+ <j:set var="j" value="0"/>
+ <j:forEach var="p" items="${dep.properties}">
+ <j:set var="v" value="${p.substring(9,p.length())}"/>
+ <j:set var="pos" value="${v.indexOf(':')}"/>
+ <j:set var="len" value="${v.length()}"/>
+ <j:set var="key" value="${v.substring(0,pos)}"/>
+ <j:set var="value" value="${v.substring(pos,len)}"/>
+ <ant:echo file="${filename}" append="true">
+avalon.dependency.${index}.${key} = ${value.substring( 1, value.length()
)}</ant:echo>
+ <j:set var="j" value="${j+1}"/>
+ </j:forEach>
+ <j:set var="index" value="${index+1}"/>
+ </j:forEach>
+ <ant:echo file="${filename}" append="true">
+</ant:echo>
+ <!--
+ </j:if>
+ <j:if test="${jarPresent == 'false'}">
+ <ant:echo message="Ignoring artifact generation (no target jar file)."/>
+ </j:if>
+ -->
+ </goal>
+
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]