• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Creating a Build File for a Web App

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im just starting to learn ANT and havent been able to figure out how to compile and move an antire directory structure full of code. Can anyone help me with this.

So this is the directory structure of our apps.

Development Area:

Project Root:
-src
-com
-acme
-sales
-*.java
-servlet
-*.java
-ProjectName
-*.htm
-*.jsp
-*.js
-WEB-INF
-META-INF
-classes




Now to deploy this to a web container, Im assuming i need to do the following steps.

1 Create the same folder\package structure under the classes older
2 Compile java classes under sales,servlet foldersto the corresponding folder under the classes subdir
3.Add the classes and {ProjectName} folder to a jar


Problem.
1. Is this the correct idea ?
2/ how to include multiple folders into a jar file since the *.* does not include folders.
3.How to compile java files across folders. Will this have to be broken into multiple tasks that look like:
a. mkdir the whole dir structure under classes folder
b. compile the java files under src\com\acme\sales into classes\com\acme\sales
c. compile the java files under src\com\acme\sales\servlet into classes\com\acme\sales\servlet
 
Udit Manektala
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Development Area:

Project Root:
-src
-com
-acme
-sales
-*.java
-servlet
-*.java
-ProjectName
-*.htm
-*.jsp
-*.js
-WEB-INF
-META-INF
-classes

 
Udit Manektala
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more try:

Development Area:

Project Root:
----src
------com
--------acme
-----------sales
-------------*.java
-------------servlet
---------------*.java
----ProjectName
-------*.htm
-------*.jsp
-------*.js
-------WEB-INF
-------META-INF
----classes
 
Saloon Keeper
Posts: 26019
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you need to understand javac a little better, actually. Most of what you're asking is provided by the java compiler itself.

The javac '-d' option, for example, indicates the root of the directories into which javac will compile the source classes. All package-related subdirectories will be created automatically under that directory. That should answer one of your questions.

Using the javac task in Ant, you only need to specify the root of your source directory to ensure that all java files under it will be compiled. You can refine the list of files to be compiled by using the include/exlude path structures of Ant. By default, all the .java files under the root of the source are compiled. If you have 2 or more source trees, supply their filesystem paths to the javac task. I believe that you can separate them with commas. Other seperators also work, though I think the semicolon has OS-specific issues.
 
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic