I've nearly got it solved. Just one final sticking point...

First I borrowed some code from deploy:copy-deps to create jar_copier:copy_jars

<define:taglib uri="jar_copier">
<define:tag name="copy_jars">
<j:scope>
<echo message="Copy ear.bundle.jar jars from ${projectDescriptor} to ${todir}"/>
<mkdir dir="${todir}"/>
<maven:pom var="pom" projectDescriptor="${projectDescriptor}"/>
<j:set var="listOfJars" value=""/>
<j:set var="mavenRepoLocal" value='${context.getVariable("maven.repo.local")}'/>
<j:set var="dependencyProperty" value="${dependencyProperty}"/>
<!-- Create a fileset of dependencies from the other project -->
<!-- that are marked there as ear.bundle.jar -->
<fileset id="security.dependencies" dir="${mavenRepoLocal}">
<j:forEach var="dep" items="${pom.dependencies}">
<j:if test="${dep.getProperty(dependencyProperty)=='true'}">
<j:set var="listOfJars"
value="${listOfJars} ${dep.artifactDirectory}/jars/${dep.artifact}"/>
<include name="${dep.artifactDirectory}/jars/${dep.artifact}"/>
</j:if>
</j:forEach>
</fileset>
<!-- Only invoke copy if the list is not empty. If we invoke -->
<!-- copy on an empty fileset we'll copy all of mavenRepoLocal! -->
<j:if test="${listOfJars == ''}">
<echo message="${projectDescriptor} has no dependencies for our ear file"/>
</j:if>
<j:if test="${listOfJars != ''}">
<copy todir="${todir}" flatten="true">
<fileset refid="security.dependencies"/>
</copy>
</j:if>
</j:scope>
</define:tag>
</define:taglib>


(This is working fine for me. I only include it here in case someone else may find it useful or may offer a better implementation.)

Then I create a simple goal to copy ear.bundle.jar dependencies defined in a couple of project.xml files:

<goal name="copy-jars">

   <jar_copier:copy_jars todir="${maven.build.dir}/jars.for.ear"
                         projectDescriptor="./project.xml"
                         dependencyProperty="ear.bundle.jar"
                         />
   <jar_copier:copy_jars todir="${maven.build.dir}/jars.for.ear"
                         projectDescriptor="../security/project.xml"
                         dependencyProperty="ear.bundle.jar"
                         />

   <pathconvert property="jars.for.ear" pathSep=" ">
     <path>
       <fileset dir="${maven.build.dir}/jars.for.ear">
         <include name="*.jar"/>
       </fileset>
     </path>
   </pathconvert>
   <echo message="Jars are ${jars.for.ear}"/>

</goal>

The sticking point is that my jars.for.ear has the full-paths of the jarfiles when what I really need (for building myjarfile manifest's class-path) is the basenames of the files.

That is, what I get from the echo is:
[echo] Jars are /home/jcej/MyProject/target/jars.for.ear/commons-beanutils-1.5.jar /home/jcej/MyProjecect/target/jars.for.ear/dom4j-1.3.jar ...


And what I really need is:
    [echo] Jars are commons-beanutils-1.5.jar dom4j-1.3.jar ...

Suggestions?

Thanks,
J


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to