jar libs / aocr.jar有一个主类com.asprise.ocr.Ocr,它与声明的主calss不匹配

时间:2015-06-25 22:53:24

标签: java javafx

当我运行ant build来构建dmg文件时,捆绑器跳过安装程序,并且由于配置问题而忽略了“Bundler DMG安装程序:主应用程序jar丢失”。

有错误,“jar libs / aocr.jar有一个主类com.asprise.ocr.Ocr,与声明的主ej.dogar.oms.MainApp不匹配”。

任何解决方案..?

的build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="Office Management System" default="do-deploy" basedir="."  xmlns:fx="javafx:com.sun.javafx.tools.ant">
<target name="init-fx-tasks">
    <path id="fxant">
        <filelist>
            <file name="${java.home}\..\lib\ant-javafx.jar"/>
            <file name="${java.home}\lib\jfxrt.jar"/>
        </filelist>
    </path>

    <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
        uri="javafx:com.sun.javafx.tools.ant"
        classpathref="fxant"/>
</target>
<target name="setup-staging-area">
    <delete dir="externalLibs" />
    <delete dir="project" />
    <delete dir="projectRefs" />

    <mkdir dir="externalLibs" />

    <copy todir="externalLibs">
        <fileset dir="/Users/ej/Documents/workspace/workspace for javafx/Office Management System/lib">
            <filename name="aocr.jar"/>
        </fileset>
    </copy>

    <mkdir dir="project" />
    <copy todir="project">
        <fileset dir="/Users/ej/Documents/workspace/workspace for javafx/Office Management System">
            <include name="src/**" />
        </fileset>
    </copy>

    <mkdir dir="projectRefs" />
</target>
<target name='do-compile'>
    <delete dir="build" />
    <mkdir dir="build/src" />
    <mkdir dir="build/libs" />
    <mkdir dir="build/classes" />

    <!-- Copy project-libs references -->
    <copy todir="build/libs">
        <fileset dir="externalLibs">
            <include name="aocr.jar"/>
        </fileset>
    </copy>

    <!-- Copy project references -->

    <!-- Copy project sources itself -->
    <copy todir="build/src">
        <fileset dir="project/src">
            <include name="**/*"/>
        </fileset>
    </copy>

    <javac includeantruntime="false" source="1.8" target="1.8" srcdir="build/src" destdir="build/classes" encoding="UTF-8">
        <classpath>
            <fileset dir="build/libs">
                <include name="*"/>
            </fileset>
        </classpath>
    </javac>

    <!-- Copy over none Java-Files -->
    <copy todir="build/classes">
    <fileset dir="project/src">
        <exclude name="**/*.java"/>
    </fileset>
    </copy>


</target>
<target name="do-deploy" depends="setup-staging-area, do-compile, init-fx-tasks">
    <delete file="dist"/>
    <delete file="deploy" />

    <mkdir dir="dist" />
    <mkdir dir="dist/libs" />

    <copy todir="dist/libs">
        <fileset dir="externalLibs">
            <include name="*" />
        </fileset>
    </copy>


    <fx:resources id="appRes">
        <fx:fileset dir="dist" includes="Office Management System.jar"/>
        <fx:fileset dir="dist" includes="libs/*"/>
    </fx:resources>

    <fx:application id="fxApplication"
        name="Letter Management Software"
        mainClass="ej.dogar.oms.MainApp"
        toolkit="fx"
    />

    <mkdir dir="build/classes/META-INF" />



    <fx:jar destfile="dist/Office Management System.jar">
        <fx:application refid="fxApplication"/>
        <fileset dir="build/classes">
        </fileset>
        <fx:resources refid="appRes"/>

        <manifest>
            <attribute name="Implementation-Vendor" value=""/>
            <attribute name="Implementation-Title" value="Letter Management Software"/>
            <attribute name="Implementation-Version" value="1.0"/>
        </manifest>
    </fx:jar>


    <mkdir dir="deploy" />
    <!-- Need to use ${basedir} because somehow the ant task is calculating the directory differently -->
    <fx:deploy
        embedJNLP="false"
        extension="false"
        includeDT="false"
        offlineAllowed="true"
        outdir="${basedir}/deploy"
        outfile="Office Management System" nativeBundles="dmg"
        updatemode="background" >

        <fx:platform basedir="${java.home}"/>
        <fx:info title="Office Management System" vendor=""/>

        <fx:application refId="fxApplication"/>
        <fx:resources refid="appRes"/>
    </fx:deploy>


</target>

错误

 Buildfile: /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/build.xml
    setup-staging-area:
       [delete] Deleting directory /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/externalLibs
       [delete] Deleting directory /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/project
       [delete] Deleting directory /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/projectRefs
        [mkdir] Created dir: /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/externalLibs
         [copy] Copying 1 file to /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/externalLibs
        [mkdir] Created dir: /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/project
         [copy] Copying 10 files to /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/project
         [copy] Copied 7 empty directories to 1 empty directory under /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/project
        [mkdir] Created dir: /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/projectRefs
    do-compile:
       [delete] Deleting directory /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/build
        [mkdir] Created dir: /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/build/src
        [mkdir] Created dir: /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/build/libs
        [mkdir] Created dir: /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/build/classes
         [copy] Copying 1 file to /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/build/libs
         [copy] Copying 10 files to /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/build/src
         [copy] Copied 6 empty directories to 1 empty directory under /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/build/src
        [javac] Compiling 6 source files to /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/build/classes
         [copy] Copying 4 files to /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/build/classes
         [copy] Copied 1 empty directory to 1 empty directory under /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/build/classes
    init-fx-tasks:
    do-deploy:
         [copy] Copying 1 file to /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/dist/libs
        [mkdir] Created dir: /Users/ej/Documents/workspace/workspace for javafx/Office Management System/build/build/classes/META-INF
    Using base JDK at: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk
    The jar libs/aocr.jar has a main class com.asprise.ocr.Ocr that does not match the declared main ej.dogar.oms.MainApp
    The jar libs/aocr.jar has a main class com.asprise.ocr.Ocr that does not match the declared main ej.dogar.oms.MainApp
    Bundler DMG Installer skipped because of a configuration problem: Main application jar is missing.  
    Advice to fix: Make sure to use fx:jar task to create main application jar.
    BUILD SUCCESSFUL
    Total time: 5 seconds

0 个答案:

没有答案