开发者

Generating Ant build.xml automatically

开发者 https://www.devze.com 2023-01-15 08:30 出处:网络
I have an existing J2EE project which is very big and old. Therefore, my current building process is to open eclipse, file/export, and clic on War archive.

I have an existing J2EE project which is very big and old. Therefore, my current building process is to open eclipse, file/export, and clic on War archive.

While our company turn over is as fast as new build is needed, we have to create an automated process. However, I'm searching the fastest way to automate building. I'm first looking to Maven2, but our application has a JDK开发者_StackOverflow中文版1.4, which is lesser than the minimum 1.5.

I was looking to Maven1, but after some weirds bugs and some reading, it seems to be only an overlay to Ant. Why I'm not using directly Ant?

Here we are, I'm looking at Ant documentation and try to writing build.xml but it seems to be too much arduous with my big project. For god's sake, when I clic to Export/War, Eclipse do the job. Why I can't in the simplest way, reproduce or export the way Eclipse export the war file, into a build.xml or what else?

Some tools which convert Eclipse-metadata into ant-build.xml should exists. But does anyone know them ?


I don't think that creating the ant script to be so hard. Anyway, maybe this link could help: Creating a deployable WAR file from Eclipse Project

Here is an example Ant file (copied from the linked page):

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Deploy From Eclipse to Tomcat" basedir=".">
    <property name="warfile" value="sanfran"/>
    <target name="unpack">
       <unwar src="${warfile}.war" dest="${warfile}" />
    </target>
    <target name="create">
        <war destfile="${warfile}.war" webxml="WebContent/WEB-INF/web.xml" update="true">
            <classes dir="build\classes"/>
            <fileset dir="WebContent">
                <exclude name="WEB-INF/web.xml"/>
            </fileset>
        </war>
    </target>
    <target name="copy">
        <copy todir="c:\tomcat5517\webapps" overwrite="true">
            <fileset dir=".">
                <include name="*.war"/>
            </fileset>
        </copy>
    </target>
    <target name="deploy">
        <antcall target="create"/>
        <antcall target="copy"/>
    </target>
</project>


Did you try http://www.testingreflections.com/node/view/1129.

Anotherway may be to use IntelliJ to load eclipse project and the use intellij to create ant file

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号