From: Sahil Dave on 2 Aug 2010 11:32 Hi All i am trying to create a simple web application. The project's build.xml looks like this: <project name="DemoApp" default="all"> <property environment="env" /> <property name="build.dir" location="build" /> <property name="root.dir" location="." /> <property name="src.dir" value="src" /> <property name="web.dir" value="WebContent/WEB-INF" /> <target name="all" depends="compile"/> <target name="compile"> <mkdir dir="${web.dir}/classes"/> <javac fork="yes" executable="${env.JAVA5_HOME}/bin/javac.exe" destdir="${web.dir}/classes"> <src> <pathelement path="${src.dir}" /> </src> </javac> </target> </project> When i try to run the ant build, compilation fails, reporting that javax.servlet package not found. I have checked in the project build path, on the 'libraries' tab, the api.jar for J2EE is present. I am using the weblogic9.2 app server, and the api.jar is the one that comes along with it. Any pointers or suggestions
From: Lew on 2 Aug 2010 13:40 On Aug 2, 11:32 am, Sahil Dave <sahil.dav...(a)gmail.com> wrote: > Hi All > > i am trying to create a simple web application. The project's > build.xml looks like this: > > <project name="DemoApp" default="all"> > <property environment="env" /> > <property name="build.dir" location="build" /> > <property name="root.dir" location="." /> > <property name="src.dir" value="src" /> > <property name="web.dir" value="WebContent/WEB-INF" /> > > <target name="all" depends="compile"/> > <target name="compile"> > <mkdir dir="${web.dir}/classes"/> > <javac fork="yes" executable="${env.JAVA5_HOME}/bin/javac.exe" > destdir="${web.dir}/classes"> > <src> > <pathelement path="${src.dir}" /> > </src> > </javac> > </target> > </project> > > When i try to run the ant build, compilation fails, reporting that > javax.servlet package not found. > I have checked in the project build path, on the 'libraries' tab, the > api.jar for J2EE is present. > I am using the weblogic9.2 app server, and the api.jar is the one that > comes along with it. > > Any pointers or suggestions > I spent five minutes googling for "ant build.xml web project" and the third hit was <http://tomcat.apache.org/tomcat-4.1-doc/appdev/build.xml.txt> which is old because Tomcat is up to rev 6.0 so I experimented and came up with <http://tomcat.apache.org/tomcat-6.0-doc/appdev/build.xml.txt> whence comes this gem: <path id="compile.classpath"> <!-- Include all JAR files that will be included in /WEB-INF/lib -- > <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** --> <!-- <pathelement location="${foo.jar}"/> --> <!-- Include all elements that Tomcat exposes to applications --> <fileset dir="${catalina.home}/bin"> <include name="*.jar"/> </fileset> <pathelement location="${catalina.home}/lib"/> <fileset dir="${catalina.home}/lib"> <include name="*.jar"/> </fileset> </path> That path in turn is referenced by the compile task. In other words, you have to include the Java EE JARs (in this example, Tomcat's) in the classpath actually used by the Ant build. -- Lew
|
Pages: 1 Prev: Reg exp question Next: Very Hot Rek: SQL Developer - San Antanio, TX. |