Prova ad usare Ant creando un build file (build.xml)
ti faccio un esempio:
build.xml
codice:
<property name="project.root" value="." />
<property name="build.dir" value="${project.root}/build" />
<property name="dist.dir" value="${build.dir}/dist" />
<property name="work.dir" value="${build.dir}/tmp" />
<property name="warroot.dir" value="${build.dir}/war" />
<property name="src.web" value="${project.root}/src/main/web" />
<property name="app.name" value="nome_app" />
<target name="war">
<mkdir dir="${dist.dir}" />
<mkdir dir="${warroot.dir}" />
<copy todir="${warroot.dir}/WEB-INF/classes" flatten="no">
<fileset dir="${generated.classes.dir}" excludes="WEB-INF/**" />
</copy>
<copy todir="${warroot.dir}/WEB-INF/lib" flatten="yes">
<path refid="project.runtime.class.path"></path>
</copy>
<copy todir="${warroot.dir}" flatten="no">
<fileset dir="${src.web}">
<exclude name="com/**" />
<exclude name="org/**" />
</fileset>
</copy>
<property name="generated.war.file" value="${dist.dir}/${app.name}.war"></property>
<war destfile="${generated.war.file}" basedir="${warroot.dir}" includes="**/*" webxml="${src.web}/WEB-INF/web.xml" />
</target>
Ti installi Ant, poi con il plug-in per eclipse esegui il target e il gioco è fatto!
Saluti
Gengi.