Duvida Ant(Eclipse)[Resolvido(FatJar)]

4 respostas
Marky.Vasconcelos

Eu tenho uma aplicação em Swing rodando perfeitamente no eclipse mas se exportar para um jar não funciona o banco de dados

pelo que vi é necessario criar um build.xml(Ant) eu criei pelo eclipse com Export… Ant BuildFiles e cria um build.xml sózinho
agora quando compilo pra .jar minha aplicação pesa 20Mb

e depois de tudo isso ainda não funciona

como eu crio o Ant pelo eclipse?

4 Respostas

s4nchez

O Ant você não se cria, o que se cria é o build.xml (New -> File -> “build.xml”), que pode ser editado no próprio eclipse para atender às suas necessidades.

Marky.Vasconcelos

que eu saiba o eclipse já possui essa ferramenta mas eu vou ter que escrever tudo na mão??
sabe algum site??

do jeito que falei o eclipse crio assim o build.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
              Any modifications will be overwritten.
              To include a user specific buildfile here, simply create one in the same
              directory with the processing instruction <?eclipse.ant.import?>
              as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="Sistema Genesis">
    <property environment="env"/>
    <property name="ECLIPSE_HOME" value="../../eclipse"/>
    <property name="debuglevel" value="source,lines,vars"/>
    <property name="target" value="1.5"/>
    <property name="source" value="1.5"/>
    <path id="Sistema Genesis.classpath">
        <pathelement location="bin"/>
        <pathelement location="lib/ant-1.6.5.jar"/>
        <pathelement location="lib/ant-antlr-1.6.5.jar"/>
        <pathelement location="lib/ant-contrib.jar"/>
        <pathelement location="lib/ant-junit-1.6.5.jar"/>
        <pathelement location="lib/ant-launcher-1.6.5.jar"/>
        <pathelement location="lib/antlr-2.7.6.jar"/>
        <pathelement location="lib/ant-swing-1.6.5.jar"/>
        <pathelement location="lib/asm.jar"/>
        <pathelement location="lib/asm-attrs.jar"/>
        <pathelement location="lib/aspectjrt.jar"/>
        <pathelement location="lib/aspectjtools.jar"/>
        <pathelement location="lib/c3p0-0.9.1.jar"/>
        <pathelement location="lib/c3p0-0.9.1-pre6.jar"/>
        <pathelement location="lib/cglib-2.1.3.jar"/>
        <pathelement location="lib/checkstyle-all.jar"/>
        <pathelement location="lib/cleanimports.jar"/>
        <pathelement location="lib/commons-collections-2.1.1.jar"/>
        <pathelement location="lib/commons-logging.jar"/>
        <pathelement location="lib/commons-logging-1.0.4.jar"/>
        <pathelement location="lib/concurrent-1.3.2.jar"/>
        <pathelement location="lib/connector.jar"/>
        <pathelement location="lib/dom4j-1.6.1.jar"/>
        <pathelement location="lib/ehcache-1.2.3.jar"/>
        <pathelement location="lib/ejb3-persistence.jar"/>
        <pathelement location="lib/hibernate3.jar"/>
        <pathelement location="lib/hibernate-annotations.jar"/>
        <pathelement location="lib/hibernate-commons-annotations.jar"/>
        <pathelement location="lib/hibernate-entitymanager.jar"/>
        <pathelement location="lib/hibernate-validator.jar"/>
        <pathelement location="lib/jaas.jar"/>
        <pathelement location="lib/jacc-1_0-fr.jar"/>
        <pathelement location="lib/javassist.jar"/>
        <pathelement location="lib/jaxen-1.1-beta-7.jar"/>
        <pathelement location="lib/jboss-archive-browsing.jar"/>
        <pathelement location="lib/jboss-cache.jar"/>
        <pathelement location="lib/jboss-common.jar"/>
        <pathelement location="lib/jboss-common-jdbc-wrapper.jar"/>
        <pathelement location="lib/jboss-jmx.jar"/>
        <pathelement location="lib/jboss-system.jar"/>
        <pathelement location="lib/jdbc2_0-stdext.jar"/>
        <pathelement location="lib/jgroups-2.2.8.jar"/>
        <pathelement location="lib/jta.jar"/>
        <pathelement location="lib/jta-spec1_0_1.jar"/>
        <pathelement location="lib/junit.jar"/>
        <pathelement location="lib/junit-3.8.1.jar"/>
        <pathelement location="lib/log4j-1.2.11.jar"/>
        <pathelement location="lib/log4j-1.2.9.jar"/>
        <pathelement location="lib/mysql-connector-java-5.0.5-bin.jar"/>
        <pathelement location="lib/mysql-connector-java-5.0.5-bin-g.jar"/>
        <pathelement location="lib/oscache-2.1.jar"/>
        <pathelement location="lib/proxool-0.8.3.jar"/>
        <pathelement location="lib/swarmcache-1.0rc2.jar"/>
        <pathelement location="lib/swing-layout-1[1].0.1.jar"/>
        <pathelement location="lib/syndiag2.jar"/>
        <pathelement location="lib/versioncheck.jar"/>
        <pathelement location="lib/xerces-2.6.2.jar"/>
        <pathelement location="lib/xml-apis.jar"/>
    </path>
    <target name="init">
        <mkdir dir="bin"/>
        <copy includeemptydirs="false" todir="bin">
            <fileset dir="src" excludes="**/*.launch, **/*.java"/>
        </copy>
    </target>
    <target name="clean">
        <delete dir="bin"/>
    </target>
    <target depends="clean" name="cleanall"/>
    <target depends="build-subprojects,build-project" name="build"/>
    <target name="build-subprojects"/>
    <target depends="init" name="build-project">
        <echo message="${ant.project.name}: ${ant.file}"/>
        <javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
            <src path="src"/>
            <classpath refid="Sistema Genesis.classpath"/>
        </javac>
    </target>
    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
    <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
        <copy todir="${ant.library.dir}">
            <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
        </copy>
        <unzip dest="${ant.library.dir}">
            <patternset includes="jdtCompilerAdapter.jar"/>
            <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
        </unzip>
    </target>
    <target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
        <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
        <antcall target="build"/>
    </target>
    <target name="Entrada (1)">
        <java classname="Entrada" failonerror="true" fork="yes">
            <classpath refid="Sistema Genesis.classpath"/>
        </java>
    </target>
    <target name="GeraTabelas (2)">
        <java classname="Hibernate.GeraTabelas" failonerror="true" fork="yes">
            <classpath refid="Sistema Genesis.classpath"/>
        </java>
    </target>
</project>
Marky.Vasconcelos

e um debug Ant file… nesse arquivo

Buildfile: D:\Java - Junior\workspace\Sistema Genesis\build.xml build-subprojects: init: build-project: [echo] Sistema Genesis: D:\Java - Junior\workspace\Sistema Genesis\build.xml build: BUILD SUCCESSFUL Total time: 10 seconds
falta algo?

matheusmaraujo

Cara, estou com o mesmo problema! Você conseguiu solução para isso?

Criado 16 de maio de 2007
Ultima resposta 31 de mai. de 2007
Respostas 4
Participantes 3