wegus
MU Team
- Dabei seit
- 13.09.2004
- Beiträge
- 19.705
- Reaktionspunkte
- 7.557
Folgen Sie dem Video unten, um zu sehen, wie Sie unsere Website als Icon auf Ihrem Homescreen erstellen.
Anmerkung: This feature may not be available in some browsers.
<?xml version="1.0" encoding="UTF-8"?>
<project name="JSF2test" basedir=".." default="create-target">
<!-- project-specific variables -->
<property name="appname" value="JSF2test" />
<property name="package.name" value="${appname}.war" />
<!--
webapps ist ein symbolischer Link der zum webapps
Verzeichnis eines aktuell genutzten Tomcat zeigen sollte!
-->
<property name="webapp.dir" value="/Users/Shared/webapps/" />
<!-- ein paar Verzeichnisse: -->
<property environment="env" />
<property name="build.dir" value="build" />
<property name="lib.dir" value="lib" />
<property name="src.dir" value="src" />
<property name="dest.dir" value="target" />
<property name="web.dir" value="web" />
<property name="web.xml" value="${web.dir}/WEB-INF/web.xml" />
<property name="web.dir.classes" value="${web.dir}/WEB-INF/classes" />
<property name="web.lib" value="${web.dir}/WEB-INF/lib" />
<!-- Der Name der .war-Datei: -->
<property name="package.file" value="${dest.dir}/${package.name}" />
<!-- Eine id für den libs-Ordner der Appliaktion: -->
<path id="build.class.path">
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
<!--
diese libs werden nicht kopiert, sie sind schon im tomcat/lib
vorhanden. Sie dienen allein dem compilier-Vorgang
-->
<fileset dir="tomcatLibs">
<include name="**/*.jar" />
</fileset>
</path>
<target name="clean">
<delete>
<fileset dir="${dest.dir}" includes="**/*"/>
</delete>
<delete dir="${web.dir.classes}" />
</target>
<target name="prepare" depends="clean">
<mkdir dir="${dest.dir}" />
<mkdir dir="${web.dir.classes}" />
</target>
<!-- compile-target -->
<target name="compile" >
<echo>=== compiling now ===</echo>
<echo>Compiling ${src.dir} files ...</echo>
<javac debug="on" srcdir="${src.dir}" destdir="${web.dir.classes}" includes="**/*">
<classpath refid="build.class.path" />
</javac>
<echo>=== compiling done ===</echo>
</target>
<!-- create-target -->
<target name="create-target" depends="compile">
<echo>=== create-target: kopieren ===</echo>
<!-- src kopieren -->
<copy todir="${web.dir.classes}">
<fileset dir="${src.dir}">
<include name="**/*.class"/>
<include name="**/*.xml"/>
<include name="**/*.xsl"/>
</fileset>
</copy>
<!-- lib in den Web-Container kopieren -->
<copy todir="${web.lib}">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</copy>
<!-- the ant war task. with all resources in place, create the war file -->
<war destfile="${package.file}" webxml="${web.xml}" basedir="${web.dir}">
<fileset dir="${web.dir}"/>
<lib dir="${web.lib}" />
<classes dir="${web.dir.classes}" />
</war>
<echo>=== create-target: kopiert nach ${package.file} ===</echo>
</target>
<!-- INSTALL -->
<target name="deploy" depends="create-target">
<echo>=== depoly ${package.file} ===</echo>
<copy file="${package.file}" tofile="${webapp.dir}/${package.name}" overwrite="true" />
</target>
</project>
nur deutlich mächtiger.
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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="TutServlet">
<property environment="env"/>
<property name="ECLIPSE_HOME" value="../../../eclipse"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="Apache Tomcat v7.0 [Apache Tomcat v7.0].libraryclasspath">
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/annotations-api.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/catalina-ant.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/catalina-ha.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/catalina-tribes.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/catalina.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/ecj-3.6.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/el-api.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/jasper-el.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/jasper.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/jsp-api.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/servlet-api.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/tomcat-api.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/tomcat-coyote.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/tomcat-dbcp.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/tomcat-i18n-es.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/tomcat-i18n-fr.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/tomcat-i18n-ja.jar"/>
<pathelement location="${ECLIPSE_HOME}/apache-tomcat-7.0.11/lib/tomcat-util.jar"/>
</path>
<path id="Web App Libraries.libraryclasspath"/>
<path id="EAR Libraries.libraryclasspath"/>
<path id="TutServlet.classpath">
<pathelement location="build/classes"/>
<path refid="Apache Tomcat v7.0 [Apache Tomcat v7.0].libraryclasspath"/>
<path refid="Web App Libraries.libraryclasspath"/>
<path refid="EAR Libraries.libraryclasspath"/>
</path>
<target name="init">
<mkdir dir="build/classes"/>
<copy includeemptydirs="false" todir="build/classes">
<fileset dir="src">
<exclude name="**/*.uad"/>
<exclude name="**/*.ucd"/>
<exclude name="**/*.uld"/>
<exclude name="**/*.upd"/>
<exclude name="**/*.cop"/>
<exclude name="**/*.udd"/>
<exclude name="**/*.uod"/>
<exclude name="**/*.usd"/>
<exclude name="**/*.utd"/>
<exclude name="**/*.uud"/>
<exclude name="**/*.ame"/>
<exclude name="**/*.odd"/>
<exclude name="**/*.ead"/>
<exclude name="**/*.ecd"/>
<exclude name="**/*.eld"/>
<exclude name="**/*.epd"/>
<exclude name="**/*.edd"/>
<exclude name="**/*.eod"/>
<exclude name="**/*.esd"/>
<exclude name="**/*.etd"/>
<exclude name="**/*.eud"/>
<exclude name="**/*.eame"/>
<exclude name="**/*.urd*.uml"/>
<exclude name="**/*.ecore"/>
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="build/classes"/>
</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="build/classes" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="TutServlet.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>
</project>
ich hab mir mit eclipse eine build-file erzeugen lassen...
@ebm:OT: Glaub ich nicht *grins breit*
OT: Glaub ich nicht *grins breit*
hat alles seine vor-/nachteile...
Ach wegus, beide sind durch programmiersprachliche Anbindung faktisch beliebig erweiterbar. make versteht Shellscript, mit Ant kann man beliebigen Java-Code ausführen, der in einen Ant-Task eingebunden ist.
bei wegus file trau ich mich nicht, was zu ändern...das sieht so ordentlich aus...
weitere blöde frage: wenn das build file steht, reicht der einfache aufruf ant im entsprechenden verzeichnis?
ant liefert Dir auch frische Brötchen und nen Kaffee wenns sein muß! Ein Beispiel wie man war-targets baut ist in meinem Beispiel enthalten! Auch automatisches Deployen ist möglich!und wenn ich das richtig sehe, dann erzeugt ant keine war-file.
Da verläßt Du Dich wieder auf Eclipse. Das kann klappen, wird aber nicht immer reichen und vor allem: Du vermutest wieder zu wissen was im war-file wo steht. Wenn Du es mit ant selbst erzeugst, dann weißt Du eshab ich das richtig gesehen, daß es völlig ausreicht das projekt als .war-file zu exportieren?