You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2014/01/01 15:12:20 UTC

[Bug 54761] Using jar command to create a jar containing two separate implementations of a service doesn't work

https://issues.apache.org/bugzilla/show_bug.cgi?id=54761

Stefan Bodewig <bo...@apache.org> changed:

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

--- Comment #3 from Stefan Bodewig <bo...@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.