ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 54761] Using jar command to create a jar containing two separate implementations of a service doesn't work
Date Wed, 01 Jan 2014 14:12:20 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=54761

Stefan Bodewig <bodewig@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #3 from Stefan Bodewig <bodewig@apache.org> ---
maybe I'm jut repeating what Antoine says, but it seems to work as expected:

stefanb@brick:/tmp$ cat foo.xml
<project>
  <property name="dist.dir" location="."/>
  <mkdir dir="build/BergChecker"/>
  <macrodef name="build-checker" >
    <attribute name="scname" />
    <attribute name="extra1" default=""/>
    <sequential>
      <jar jarfile="${dist.dir}/@{scname}.jar" >
        <fileset dir="build/@{scname}"/>
        <service type="com.riskdecisions.sanitycheck.SanityCheck">
          <provider
classname="com.riskdecisions.sanitycheck.providers.@{scname}" />
          <provider
classname="com.riskdecisions.sanitycheck.providers.@{extra1}" />
        </service>
      </jar>
    </sequential>
  </macrodef>
  <build-checker scname="BergChecker" extra1="CheckCluster"/>
</project>
stefanb@brick:/tmp$ ant -f foo.xml 
Buildfile: /tmp/foo.xml
    [mkdir] Created dir: /tmp/build/BergChecker
      [jar] Building MANIFEST-only jar: /tmp/BergChecker.jar

BUILD SUCCESSFUL
Total time: 0 seconds
stefanb@brick:/tmp$ unzip BergChecker.jar 
Archive:  BergChecker.jar
   creating: META-INF/
  inflating: META-INF/MANIFEST.MF    
  inflating: META-INF/services/com.riskdecisions.sanitycheck.SanityCheck  
stefanb@brick:/tmp$ cat
META-INF/services/com.riskdecisions.sanitycheck.SanityCheck 
com.riskdecisions.sanitycheck.providers.BergChecker
com.riskdecisions.sanitycheck.providers.CheckCluster

there even is an AntUnit test for that in
http://svn.apache.org/repos/asf/ant/core/trunk/src/tests/antunit/taskdefs/jar-spi-test.xml
(test-providers)

-- 
You are receiving this mail because:
You are the assignee for the bug.

Mime
View raw message