Ошибка запуска apt-компилятора в версии Java 1.8 - PullRequest
0 голосов
/ 21 октября 2019

Я новичок и его унаследованные Java-приложения, я пытаюсь создать это приложение с помощью Ant, но оно собирается только с версией 6 Java, но когда я собираю его с версией Java 8, я получаю ниже Ошибка Может кто-нибудь предложить мне, пожалуйста?

Я не могу решить эту проблему, так как 2 недели, пожалуйста, предложите один из них.

build.xml

<project name="CDMWeb" default="cdmwebweblogic.war" basedir=".">
<!-- =========================================================================================  -->
    <!--                    CDMWeb APPLICATION ANT BUILD FILE                               -->
    <!-- =========================================================================================  -->

    <!-- *****************************************************************  -->
    <!--  @author       : Muhammad Azeem                    -->
    <!--  @date         : 10/16/2008                    -->
    <!--  @description  : Ant Build file for CDMWeb Application.        -->
    <!-- *****************************************************************  -->

<!-- ============================= START CDMWeb BUILD ===================================   --> 
    <property environment="env" />

    <import file="resource/apache-beehive-1.0.2\beehive-imports.xml"/>
    <import file="resource/apache-beehive-1.0.2\ant\beehive-tools.xml"/>

    <property name="build.dir" location="build"/>
    <property name="libs" value="web/WEB-INF/lib"/>
    <property name="webapp.dir" location="${basedir}/web"/>
    <property name="web.dir" location="${basedir}/web"/>
    <property name="tmp.sourcegen.dir" value=".tmpbeansrc"/>
    <property name="dist.dir" location="${basedir}/dist"/>
    <property name="exploded.dir" location="${dist.dir}/CDMWeb.war"/>
    <property name="mqapp.dir" location="${build.dir}/mqapp.war"/>
    <property name="explodedmqwebapp.dir" location="${exploded.dir}/MQWeb.war/"/>

    <!-- BGW RT interface related Properties -->
        <property name="bgw.final.dir" location="${exploded.dir}/WEB-INF/lib" />
    <property name="bgw.dir" location="src/bgw"/>
    <property name="bgw.build.dir" location="${build.dir}/bgw"/>
    <property name="bgw.stager" location="${bgw.dir}/BGWStager"/>
    <property name="bgw.stager.generated" location="${bgw.stager}/generated"/>
    <property name="bgw.extractor" location="${bgw.dir}/BGWEventExtractor"/>
    <property name="bgw.sqlrunner" location="${bgw.dir}/SqlRunner"/>
    <property name="bgw.build.stager.dir" location="${bgw.build.dir}/stager"/>
    <property name="bgw.build.extractor.dir" location="${bgw.build.dir}/extractor"/>
        <property name="bgw.build.extractor.dir" location="${bgw.build.dir}/sqlrunner"/>
    <property name="bgw.stager.notification.pkg.name" value="com.verizon.vi.bgw.notification"/>
    <property name="bgw.stager.notification.pkg.dir" value="${bgw.stager.generated}/com/verizon/vi/bgw/notification"/>
    <!-- Define the classpath used to build the BGW Stager and extractor app -->
    <property name="bgw.stager.classpath" value="lib/mail.jar lib/ifxjdbc.jar lib/cem_client.jar lib/cdm_data_dictionary.jar lib/ojdbc6_11.2.0.3.jar"/>
    <property name="bgw.extractor.classpath" value="lib/jaas.jar lib/jtds.jar lib/mail.jar lib/ifxjdbc.jar lib/cem_client.jar lib/log4j.jar lib/jta-spec1_0_1.jar lib/jms.jar       lib/bgw_vi.jar lib/namespace.jar lib/cdm_data_dictionary.jar lib/BaaisIntfUtils.jar lib/weblogic.jar"/> 
        <property name="bgw.sqlrunner.classpath" value="lib/ifxjdbc.jar lib/log4j.jar lib/ojdbc6_11.2.0.3.jar"/>    

    <!-- Define the classpath used to build the app -->
    <path id="app.classpath">
        <fileset dir="${libs}">
            <include name="*.jar"/>
        </fileset>
    </path>
    <path id="webapp.classpath"> 
            <pathelement location="${servlet-api.jar}"/>
            <pathelement location="${jsp-api.jar}"/>
            <pathelement location="${build.dir}/WEB-INF/classes"/>
            <fileset dir="${libs}">
            <include name="*.jar"/>
            </fileset>      
    </path>
    <path id="webapp.sourcepath">
        <pathelement location="${web.dir}"/>
    <pathelement location="${web.dir}/src"/>
    </path>


<taskdef name="xjc" classpathref="app.classpath" classname="com.sun.tools.xjc.XJCTask"></taskdef>

    <target name="clean">
            <delete dir="${build.dir}"/>
            <delete dir="${dist.dir}"/>
    </target>
    <target name="init">
        <mkdir dir="${build.dir}/WEB-INF/classes"/>
    </target>
    <target name="compile.dbgen">
        <echo message="[ * --- Compiling dbgen --- * ]"/>
        <javac  destdir="${build.dir}/WEB-INF/classes" classpathref="app.classpath" debug="on" debuglevel="lines,source">
             <src path="dbgen/src"/>
       </javac>
    </target>
    <target name="compile.src">
        <echo message="[ * --- Compiling src --- * ]"/>
           <javac  destdir="${build.dir}/WEB-INF/classes" classpathref="app.classpath" debug="on" debuglevel="lines,source">
                 <src path="src/com"/>
           </javac>
    </target>
    <target name="compile.web">
        <echo message="[ * --- Compiling web --- * ]"/>
       <javac  destdir="${build.dir}/WEB-INF/classes" classpathref="app.classpath" debug="on" debuglevel="lines,source">
         <src path="web/src"/>
       </javac>
    </target>
    <target name="compile.all" depends="init,compile.dbgen,compile.src,compile.web">
        <echo message="[ * --- Compiled dbgen,src,web --- * ]"/>
    </target>
    <target name="copy.web">
        <copy todir="${build.dir}/WEB-INF/lib">
                <fileset dir="web/WEB-INF/lib">
                    <include name="*.*"/>
                    <exclude name="weblogic.jar"/>
                </fileset>
        </copy>
        <copy todir="${build.dir}/WEB-INF">
        <fileset dir="web/WEB-INF">
            <include name="*.*"/>
        </fileset>
        </copy>
        <copy todir="${build.dir}">
        <fileset dir="web">
            <include name="*.*"/>
        </fileset>
        </copy>
        <copy todir="${build.dir}">
        <fileset dir="web">
            <include name="**/*.*"/>
            <exclude name="src/**"/>
        </fileset>
        </copy>
        <copy todir="${build.dir}/WEB-INF/classes">
        <fileset dir="resource">
            <include name="*.properties"/>
            <include name="*.xml"/>
        </fileset>
        </copy>
        <copy todir="${build.dir}/WEB-INF">
        <fileset dir="resource/beans">
            <include name="cdm*.xml"/>
        </fileset>
        </copy>
    </target>
    <target name="deploy-beehive" description="Copy the Beehive Page Flow rutime into the target webapp">
            <deploy-netui webappDir="${build.dir}"/>
    </target>
    <target name="compile.jpf" depends="deploy-beehive" description="Build the webapp">
            <available property="webapp.dir.available" file="${webapp.dir}" type="dir"/>
            <fail unless="webapp.dir.available" message="Can't find the webapp directory ${webapp.dir}"/>

            <!-- compile JPFs -->
            <echo>Building Page Flows</echo>
            <build-pageflows srcdir="${basedir}/web"
                             webcontentdir="${web.dir}"
                             destdir="${build.dir}/WEB-INF/classes"
                             tempdir="${build.dir}/${tmp.sourcegen.dir}" 
                             sourcepathref="webapp.sourcepath"
                             classpathref="webapp.classpath"/>
    </target>

    <target name="build" depends="compile.all,copy.web,compile.jpf">
    </target>

    <target name="buildwar" depends="build" description="Builds a compressed WAR file that can be deployed to Tomcat application container">
            <echo message="[ * --- Creating WAR file for Deployment into Tomcat--- * ]"/>
            <mkdir dir="${dist.dir}"/>
            <war destfile="${dist.dir}/CDMWeb.war" webxml="${build.dir}/WEB-INF/web.xml">
                <fileset dir="${build.dir}">
                    <exclude name="WEB-INF/web.xml"/>
                </fileset>
            </war>
    </target>

    <target name="cdmweb.war" depends="clean,init,build,buildwar">
    </target>


  <!-- ===================== BGW Stager and Extractor Build - BEGIN =======================     --> 

    <target name="bgw.build" depends="bgw.init,bgw.build.stager,bgw.build.extractor,bgw.build.sqlrunner,copy.bgw,bgw.clean">
            <echo message="[ * --- Created BGWStager.jar and BGWEventExtractor.jar Successfully...."/>  
        </target>
    <!-- Creation of BGW Stager and extractor related directories -->
    <target name="bgw.init">
        <mkdir dir="${bgw.stager.generated}"/>
        <mkdir dir="${bgw.build.dir}"/>
        <mkdir dir="${bgw.build.stager.dir}"/>
        <mkdir dir="${bgw.build.extractor.dir}"/>
                <mkdir dir="${bgw.build.sqlrunner.dir}"/>
        <mkdir dir="${dist.dir}"/>
    </target>

    <!-- Clean up of BGW Stager and extractor related directories -->       
    <target name="bgw.clean">
        <delete dir="${bgw.stager.generated}"/>
        <delete dir="${bgw.build.dir}"/>
        <delete dir="${bgw.build.stager.dir}"/>
        <delete dir="${bgw.build.extractor.dir}"/>
                <delete dir="${bgw.build.sqlrunner.dir}"/>
                <!-- If this causes issues may need to move the orginal dest -->
                <delete file="${dist.dir}/BGWStager.jar"/>
                <delete file="${dist.dir}/BGWEventExtractor.jar"/>
                <delete file="${dist.dir}/SqlRunner.jar"/>
    </target>

    <!-- XJC for creating Java classes for BGW Notification schema -->
    <target name="bgw.compile.schema.prepare">
        <echo message="Started XJC Compilation of BGW Notification" />
        <xjc schema="${bgw.stager}/xml-resources/jaxb/BGWNotification/bgwNotification.xsd" package="${bgw.stager.notification.pkg.name}" destdir="${bgw.stager.generated}">
            <produces dir="${bgw.stager.notification.pkg.dir}" />
        </xjc>
    </target>

    <!-- Compilation of Generated BGW Notification Java Classes. -->
    <target name="bgw.compile.schema" depends="bgw.compile.schema.prepare">
        <echo message="Started Compiling generated BGW Notification" />
        <javac destdir="${bgw.build.stager.dir}" classpathref="app.classpath" debug="on" debuglevel="lines,source">
                <src path="${bgw.stager.generated}"/>
        </javac>
    </target>

    <!-- BGW Stager Soruces Compilation -->
    <target name="bgw.compile.stager" depends="bgw.compile.schema">
        <echo message="[ * --- Compiling BGW Stager --- * ]"/>
         <javac destdir="${bgw.build.stager.dir}" classpathref="app.classpath" classpath="${bgw.build.stager.dir}" debug="on" debuglevel="lines,source">
              <src path="${bgw.stager}/src"/>
          </javac>
    </target>

    <!-- BGW Stager Build -->
    <target name="bgw.build.stager" depends="bgw.compile.stager">
        <echo message="[ * --- Preparing BGW Stager jar --- * ]"/>
          <jar jarfile="${dist.dir}/BGWStager.jar"
                basedir="${bgw.build.stager.dir}">
                <include name="**/*.class"/>
            <manifest>
            <attribute name="Main-class" value="com.verizon.vi.bgw.stager.StagerMain"/>
            <attribute name="Class-Path" value="${bgw.stager.classpath}"/>
            </manifest>
          </jar>
    </target>

    <!-- BGW extractor Soruces Compilation -->  
    <target name="bgw.compile.extractor">
        <echo message="[ * --- Compiling extractor --- * ]"/>
        <javac destdir="${bgw.build.extractor.dir}" classpathref="app.classpath" debug="on" debuglevel="lines,source">
             <src path="${bgw.extractor}/src"/>
        </javac>
    </target>

    <!-- BGW extractor Build -->
    <target name="bgw.build.extractor" depends="bgw.compile.extractor">
        <echo message="[ * --- Preparing BGW extractor jar --- * ]"/>
          <jar jarfile="${dist.dir}/BGWEventExtractor.jar"
                basedir="${bgw.build.extractor.dir}">
                <include name="**/*.class"/>
            <manifest>
            <attribute name="Main-class" value="com.verizon.vi.bgweventextractor.ExtractorMain"/>
            <attribute name="Class-Path" value="${bgw.extractor.classpath}"/>
            </manifest>
          </jar>
    </target>

       <!-- BGW SQLRunner Soruces Compilation -->
        <target name="bgw.compile.sqlrunner">
                <echo message="[ * --- Compiling extractor --- * ]"/>
                <javac destdir="${bgw.build.sqlrunner.dir}" classpathref="app.classpath" debug="on" debuglevel="lines,source">
                     <src path="${bgw.sqlrunner}/src"/>
        </javac>
        </target>

        <!-- BGW extractor Build -->
        <target name="bgw.build.sqlrunner" depends="bgw.compile.sqlrunner">
                <echo message="[ * --- Preparing BGW SQLRunner --- * ]"/>
                  <jar jarfile="${dist.dir}/SqlRunner.jar"
                        basedir="${bgw.build.sqlrunner.dir}">
                        <include name="**/*.class"/>
                        <manifest>
                        <attribute name="Main-class" value="sqlrunner.SqlMain"/>
                        <attribute name="Class-Path" value="${bgw.sqlrunner.classpath}"/>
                        </manifest>
                  </jar>
        </target>

        <target name="copy.bgw">
            <copy todir="${bgw.final.dir}">
                <fileset dir="${dist.dir}">
                    <include name="*.jar"/>
                </fileset>
            </copy>
        </target>

    <target name="cdmwebweblogic.war" depends="clean,init,buildweblogic,buildweblogicwar,mqweblogicapp.war,bgw.build">
    </target>

    <target name="buildweblogic" depends="compile.all,copyweblogic.web,compile.jpf">
    </target>

    <target name="copyweblogic.web">
     <copy todir="${build.dir}/WEB-INF/lib">
         <fileset dir="web/WEB-INF/lib">
                 <include name="*.*"/>
                 <exclude name="weblogic.jar"/>
         </fileset>
     </copy>
     <copy todir="${build.dir}/WEB-INF">
        <fileset dir="web/WEB-INF">
            <include name="*.*"/>
        </fileset>
     </copy>
     <!--<move file="${build.dir}/WEB-INF/web_weblogic.xml" tofile="${build.dir}/WEB-INF/web.xml"/>-->
     <echo>
            web.xml:Replacing cdm-app-context.xml with cdm-app-context_weblogic.xml
         </echo>
     <replace file="${build.dir}/WEB-INF/web.xml" token="cdm-app-context.xml" value="cdm-app-context_weblogic.xml"/>
     <copy todir="${build.dir}">
        <fileset dir="web">
            <include name="*.*"/>
        </fileset>
     </copy>
     <copy todir="${build.dir}">
        <fileset dir="web">
            <include name="**/*.*"/>
            <exclude name="src/**"/>
        </fileset>
     </copy>
     <copy todir="${build.dir}/WEB-INF/classes">
        <fileset dir="resource">
            <include name="*.properties"/>
            <exclude name="jndi.properties"/>
            <exclude name="*.xml"/>
        </fileset>
     </copy>
     <copy todir="${build.dir}/WEB-INF">
        <fileset dir="resource/beans">
            <include name="cdm*.xml"/>
        </fileset>
     </copy>
    </target>

    <target name="buildweblogicwar" depends="buildweblogic" description="Builds a exploded WAR Directory that can be deployed to Weblogic application container">
                <echo message="[ * --- Creating Exploded WAR Directory for Deployment into Weblogic--- * ]"/>
                <mkdir dir="${exploded.dir}"/>
                <copy todir="${exploded.dir}">
            <fileset dir="${build.dir}">
                <include name="**/*.*"/>
            </fileset>
            </copy>
    </target>

    <!-- ============================= Above enclosed tasks are for Weblogic alone ===================================  --> 

    <target name="usage" description="Print usage information for this build file">
            <echo>
            To Create the CDM web deployment WAR:ant cdmweb.war
            The WAR gets created in dist directory.
            Once the webapp is built, it's ready to deploy onto your application container.
            </echo>    
    </target>

     <target name="mqweblogicapp.war" depends="buildmqweblogicwar">
     </target>

    <target name="mqwebapp.war" depends="buildmqwar">
        </target>

    <target name="buildmq" depends="cleanmq,initmq,compile.mq,copy.mq">
        <echo message="[ * --- Compiled compile.mq --- * ]"/>
     </target>

    <target name="initmq">
            <mkdir dir="${mqapp.dir}/WEB-INF/classes"/>
    </target>

    <target name="cleanmq">
            <delete dir="${mqapp.dir}"/>
    </target>

    <target name="copy.mq">
            <mkdir dir="${mqapp.dir}/WEB-INF/lib"/>
            <copy todir="${mqapp.dir}/WEB-INF/lib">
                    <fileset dir="web/WEB-INF/lib">
                        <include name="connector.jar"/>
                        <include name="jta.jar"/>
                        <include name="com.ibm.mq.jar"/>
                        <include name="com.ibm.mqjms.jar"/>
                        <include name="dhbcore.jar"/>
                        <include name="log4j-1.2.15.jar"/>
                    </fileset>
            </copy>
            <copy todir="${mqapp.dir}/WEB-INF/classes">
                    <fileset dir="resource">
                        <include name="mq.properties"/>
                    </fileset>
            </copy>     
            <copy todir="${mqapp.dir}/WEB-INF">
                <fileset dir="web/WEB-INF">
                    <include name="web_mq.xml"/>
                </fileset>
            </copy>
            <move file="${mqapp.dir}/WEB-INF/web_mq.xml" tofile="${mqapp.dir}/WEB-INF/web.xml"/>
    </target>

    <target name="compile.mq">
            <echo message="[ * --- Compiling mq related classes--- * ]"/>
               <javac  destdir="${mqapp.dir}/WEB-INF/classes" includes = "com/vzb/ions/common/mq/*.java" classpathref="app.classpath" debug="on" debuglevel="lines,source">
                     <src path="src"/>
               </javac>
    </target>

    <target name="buildmqwar" depends="buildmq" description="Builds a compressed WAR file that can be deployed to Tomcat application container">
                <echo message="[ * --- Creating MQ WAR file for Deployment into Tomcat--- * ]"/>
                <mkdir dir="${dist.dir}"/>
                <war destfile="${dist.dir}/MQWeb.war" webxml="${mqapp.dir}/WEB-INF/web.xml">
                    <fileset dir="${mqapp.dir}">
                        <exclude name="WEB-INF/web.xml"/>
                    </fileset>
                </war>
        </target>

    <target name="buildmqweblogicwar" depends="buildmq" description="Builds a exploded WAR Directory that can be deployed to Weblogic application container">
                    <echo message="[ * --- Creating Exploded MQWeb.WAR Directory for Deployment into Weblogic--- * ]"/>
                    <mkdir dir="${explodedmqwebapp.dir}"/>
                    <copy todir="${explodedmqwebapp.dir}">
                <fileset dir="${mqapp.dir}">
                    <include name="**/*.*"/>
                </fileset>
                </copy>
        </target>

</project>

beehive-tools.xml

<apt srcdir="@{srcdir}" 
             destdir="@{destdir}"
             gendir="@{tempdir}"
             classpathref="_pageflow.build.classpath"
             sourcepathref="@{sourcepathref}"
             srcExtensions="*.jpf,*.jpfs,*.app,*.jsfb,*.java" 
             processorOptions="web.content.root=@{webcontentdir}"
             debug="true"
             nocompile="@{nocompile}"/>//This line i am getting error
        <delete dir="@{tempdir}"/>

    BUILD FAILED

        C:\Spring Boot\Jagan Apps\vi_cdm\build.xml:145: The following error occurred while executing this line:
        C:\Spring Boot\Jagan Apps\vi_cdm\resource\apache-beehive-1.0.2\ant\beehive-tools.xml:148: Error running apt compiler

1 Ответ

0 голосов
/ 25 октября 2019

Я ответил на этот вопрос в вашем другом вопросе: Как запустить задачу ant apt в версии java 1.8

По существу apt не существует в java8;только через 5-7. Это задокументировано на странице документации ant apt ...

Просто убедитесь, что файл jar, который требуется для вашего пользовательского процессора аннотаций, находится в classpath;и javac выполнит его соответствующим образом.

   <javac source="${javac.version}" target="${javac.version}" destdir="${classes.build.dir}" srcdir="${src.dir}" debug="on" debuglevel="source,lines">
      <classpath>
        <!-- make sure this has "my-annotation-processor.jar" -->
        <path refid="main.classpath"/>
      </classpath>
    </javac>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...