简体   繁体   中英

Using jarbundler ant task to add dependencies to the app

I have a Netbeans Java project. When I build my project it create a directory dist and dist/lib . It stores the Jar of the file in dist and other jar files on which the main jar file depends, in the lib directory.

Now I want to create a release for OSX. For that I am using the jarbundler ant task like this

<target name="mac">
        <mkdir dir="release"/>
        <taskdef name="jarbundler"
        classname="net.sourceforge.jarbundler.JarBundler" />
        <jarbundler dir="release"
            name="MyApp"
            mainClass="controller.MyApp"
            jar="dist/MyApp.jar" />
</target>

This creates the app with the jar, but how do I add the dependent libraries to the app.

This is what is needed

The jar attribute should be replaced with jarfileset like this.

<target name="mac">
      <mkdir dir="release"/>
      <taskdef name="jarbundler"
               classname="net.sourceforge.jarbundler.JarBundler" />

               <jarbundler dir="release"
                           name="MyApp"
                           mainClass="controller.MyApp">
                      <jarfileset dir="dist">
                          <include name="**/*.jar" />
                      </jarfileset>
               </jarbundler>
</target>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM