eclipse - Create build.xml file independant of the location of the libraries on a computer -
in order generate war file , i've created build.xml file via eclipse. build.xml shown below:
<?xml version="1.0" encoding="utf-8" standalone="no"?> <!-- warning: eclipse auto-generated file. modifications overwritten. include user specific buildfile here, create 1 in same directory processing instruction <?eclipse.ant.import?> first entry , export buildfile again. --><project basedir="." default="build" name="project"> <property environment="env"/> <property name="eclipse_home" value="../../../documents/eclipse ee/eclipse/"/> <property name="debuglevel" value="source,lines,vars"/> <property name="target" value="1.6"/> <property name="source" value="1.6"/> <path id="weblogic system libraries.libraryclasspath"> <pathelement location="../../../../../oracle/middleware/modules/javax.persistence_1.1.0.0_2-0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.oracle.jpa2support_1.0.0.0_2-1.jar"/> <pathelement location="../../../../../oracle/middleware/wlserver_10.3/server/lib/api.jar"/> <pathelement location="../../../../../oracle/middleware/modules/glassfish.jstl_1.2.0.1.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.jsf_1.1.0.0_1-2.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.ejb_3.0.1.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.enterprise.deploy_1.2.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.interceptor_1.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.jms_1.1.1.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.jsp_1.3.0.0_2-1.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.jws_2.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.activation_1.1.0.0_1-1.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.mail_1.1.0.0_1-4-1.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.xml.soap_1.3.1.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.xml.rpc_1.2.1.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.xml.ws_2.1.1.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.management.j2ee_1.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.resource_1.5.1.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.servlet_1.0.0.0_2-5.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.transaction_1.0.0.0_1-1.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.xml.stream_1.1.1.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.security.jacc_1.0.0.0_1-1.jar"/> <pathelement location="../../../../../oracle/middleware/modules/javax.xml.registry_1.0.0.0_1-0.jar"/> <pathelement location="../../../../../oracle/middleware/wlserver_10.3/server/lib/wls-api.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.apache_1.3.0.1.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.i18n_1.9.0.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.logging_1.9.0.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.utils.full_1.10.0.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.utils.wrapper_1.4.0.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.utils.classloaders_2.0.0.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.common.security.providers.env_1.0.0.0_6-2-0-0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.common.security.saml2.manage_1.0.0.0_6-2-0-0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.weblogic.web.api_1.4.0.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.weblogic.rmi.client_1.11.0.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.transaction_2.7.1.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.workarea_1.8.0.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.xml.weblogic.xpath_1.5.0.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.datasource6_1.10.0.0.jar"/> <pathelement location="../../../../../oracle/middleware/modules/com.bea.core.weblogic.stax_1.10.0.0.jar"/> </path> <path id="web app libraries.libraryclasspath"> <pathelement location="webcontent/web-inf/lib/log4j-1.2.17.jar"/> </path> <path id="ear libraries.libraryclasspath"/> <path id="project.classpath"> <pathelement location="boum/classes"/> <path refid="weblogic system libraries.libraryclasspath"/> <path refid="web app libraries.libraryclasspath"/> <path refid="ear libraries.libraryclasspath"/> </path> <path id="run.test.bootclasspath"> <fileset dir="${java.home}/lib" includes="*.jar"/> <fileset dir="${java.home}/lib/ext" includes="*.jar"/> <path refid="weblogic system libraries.libraryclasspath"/> </path> <target name="init"> <mkdir dir="boum/classes"/> <copy includeemptydirs="false" todir="boum/classes"> <fileset dir="client"> <exclude name="**/*.java"/> </fileset> </copy> <copy includeemptydirs="false" todir="boum/classes"> <fileset dir="test"> <exclude name="**/*.java"/> </fileset> </copy> <copy includeemptydirs="false" todir="boum/classes"> <fileset dir="src"> <exclude name="**/*.java"/> </fileset> </copy> </target> <target name="clean"> <delete dir="boum/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="boum/classes" includeantruntime="false" source="${source}" target="${target}"> <src path="client"/> <src path="test"/> <src path="src"/> <classpath refid="project.classpath"/> </javac> </target> <target description="build projects reference project. useful propagate changes." name="build-refprojects"/> <target description="copy eclipse compiler jars 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 eclipse compiler" name="build-eclipse-compiler"> <property name="build.compiler" value="org.eclipse.jdt.core.jdtcompileradapter"/> <antcall target="build"/> </target> <target name="test"> <java classname="test" failonerror="true" fork="yes"> <classpath refid="project.classpath"/> <bootclasspath> <path refid="run.test.bootclasspath"/> </bootclasspath> </java> </target> <target name="war" description="bundles application war file" depends="clean, build"> <mkdir dir="webcontent/web-inf/classes"/> <copy includeemptydirs="false" todir="webcontent/web-inf/classes"> <fileset dir="boum/classes"> <include name="**/**"/> </fileset> </copy> <war destfile="boumboum.war" basedir="webcontent" needxmlfile="false"> </war> </target> </project>
so question is: how can write build.xml file in way independant location of libraries computer ? let's run build file in computer doesn't contains folders oracle/middleware. in case guess wont generate war file. there way make work ? if ,could show me example or point me tutorials it. because i'm new ant.
the third-party libraries can stored
- in shared folder on network
- in source control system (git, svn, perforce)
- in repository (artifactory, nexus)
- etc
before creating war should fetch these libraries (the method depends on solution choose) , place them locally.
Comments
Post a Comment