eclipse 我有一个build.xml文件,但没有一个pom文件用于一个预先存在的项目,它们可以互换吗?

bvk5enib  于 2022-11-23  发布在  Eclipse
关注(0)|答案(1)|浏览(156)

我遇到了一个问题,我看到其他人通过向他们的pom文件添加依赖项来处理它。我没有这样的文件,但我有一个名为build.xml的文件,它看起来像这样...

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project PM_DEV with libraries in sub-folder">
    <!--this file was created by Eclipse Runnable JAR Export Wizard-->
    <!--ANT 1.7 is required                                        -->
    <!--define folder properties-->
    <property name="dir.buildfile" value="."/>
    <property name="dir.workspace" value="C:/Users/SENIOR/eclipse-workspace"/>
    <property name="dir.jarfile" value="C:/Users/SENIOR/Desktop/9.9"/>
    <target name="create_run_jar">
        <jar destfile="${dir.jarfile}/9.9.jar">
            <manifest>
                <attribute name="Main-Class" value="ui.MainMenuFrame"/>
                <attribute name="Class-Path" value=". 9.9_lib/activation.jar 9.9_lib/apache-mime4j-core-0.8.5.jar 9.9_lib/arial.jar 9.9_lib/commons-beanutils-1.8.2.jar 9.9_lib/commons-digester-2.1.jar 9.9_lib/commons-logging-1.2.jar 9.9_lib/dom4j-1.6.1.jar 9.9_lib/GoodDatePicker-10.3.1.jar 9.9_lib/hamcrest-core-1.3.jar 9.9_lib/itextpdf-5.3.4.jar 9.9_lib/javax.mail-1.6.2.jar 9.9_lib/jcalendar-1.3.3.jar 9.9_lib/jcommon-1.0.23.jar 9.9_lib/jfreechart-1.0.19-experimental.jar 9.9_lib/jfreechart-1.0.19-swt.jar _9.9_lib/jfreechart-1.0.19.jar 9.9_lib/jfreesvg-2.0.jar 9.9_lib/joda-time-2.4-javadoc.jar 9.9_lib/joda-time-2.4-sources.jar 9.9_lib/joda-time-2.4.jar 9.9_lib/junit-4.11.jar 9.9_lib/orsoncharts-1.4-eval-nofx.jar 9.9_lib/orsoncharts-1.5.jar 9.9_lib/orsonpdf-1.6-eval.jar 9.9_lib/orsonpdf-1.7.jar 9.9_lib/poi-3.14.jar 9.9_lib/poi-ooxml-3.14.jar 9.9_lib/poi-ooxml-schemas-3.14.jar 9.9_lib/rs2xml.jar 9.9_lib/servlet.jar 9.9_lib/sqljdbc4.jar 9.9_lib/swingx-1.6.1.jar 9.9_lib/swtgraphics2d.jar 9.9_lib/xmlbeans-2.6.0.jar 9.9_lib/mssql-jdbc-10.2.1.jre8.jar 9.9_lib/sqljdbc42.jar 9.9_lib/AbsoluteLayout.jar 9.9_lib/eclipselink.jar 9.9_lib/javax.persistence_2.1.0.v201304241213.jar 9.9_lib/org.eclipse.persistence.jpa.jpql_2.5.2.v20140319-9ad6abd.jar 9.9_lib/swing-layout-1.0.4.jar 9.9_lib/commons-collections4-4.4.jar 9.9_lib/itext-2.1.7.js8.jar 9.9_lib/jasperreports-6.20.0.jar"/>
            </manifest>
            <fileset dir="${dir.buildfile}/build/classes"/>
        </jar>
        <delete dir="${dir.jarfile}/9.9_lib"/>
        <mkdir dir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/activation.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/apache-mime4j-core-0.8.5.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/arial.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/commons-beanutils-1.8.2.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/commons-digester-2.1.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/commons-logging-1.2.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/dom4j-1.6.1.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/GoodDatePicker-10.3.1.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/hamcrest-core-1.3.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/itextpdf-5.3.4.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/javax.mail-1.6.2.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/jcalendar-1.3.3.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/jcommon-1.0.23.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/jfreechart-1.0.19-experimental.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/jfreechart-1.0.19-swt.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/jfreechart-1.0.19.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/jfreesvg-2.0.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/joda-time-2.4-javadoc.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/joda-time-2.4-sources.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/joda-time-2.4.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/junit-4.11.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/orsoncharts-1.4-eval-nofx.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/orsoncharts-1.5.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/orsonpdf-1.6-eval.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/orsonpdf-1.7.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/poi-3.14.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/poi-ooxml-3.14.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/poi-ooxml-schemas-3.14.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/rs2xml.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/servlet.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/sqljdbc4.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/swingx-1.6.1.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/swtgraphics2d.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/xmlbeans-2.6.0.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/mssql-jdbc-10.2.1.jre8.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/sqljdbc42.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/AbsoluteLayout.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/eclipselink.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/javax.persistence_2.1.0.v201304241213.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/org.eclipse.persistence.jpa.jpql_2.5.2.v20140319-9ad6abd.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/swing-layout-1.0.4.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/commons-collections4-4.4.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/itext-2.1.7.js8.jar" todir="${dir.jarfile}/9.9_lib"/>
        <copy file="${dir.buildfile}/libs/jasperreports-6.20.0.jar" todir="${dir.jarfile}/9.9_lib"/>
    </target>
</project>

我可以像pom文件一样使用这个文件并在这里添加依赖项吗?或者这是完全不同的东西,我不能在这里添加依赖项。

oyxsuwqo

oyxsuwqo1#

基本上build.xml是另一个名为Apache Ant的构建系统的脚本,在maven和后来的gradle发布之前它确实很流行。
当时maven / gradle中出现的依赖关系管理还不存在,所以Ant没有提供类似的功能。
但是,还有另一个名为Apache Ivy的项目,它为Ant脚本添加了依赖项管理,因此,如果您不想开始使用(并迁移到pom.xml)并继续使用Ant,我相信这是您的最佳选择。
Ant和Ivy仍然是活跃的项目,但Maven和Gradle多年来在行业中越来越受欢迎。

相关问题