Solved

classpath needed inside build.xml file

Posted on 2006-11-07
5
170 Views
Last Modified: 2011-09-20
I have this scenario:

There is a text file(first.txt) and it is located in (souceApp/EAR/PresentationApp) and I need to copy this file to another file (first.jsp) and the first.jsp should be placed in the (sourceApp/WAR/testWebApp) .
This should be done in the build.xml file.
The build.xml file is present for each webapp inside WAR and also present in the souceAppdirectory.

The build.xml present in the sourceApp is the main/parent build.xml which will  refer to build.xml for WAR,EAR...etc..,

Here is what I did:

<target name="copy-file" des="copies file>
<copy file ="first.txt" tofile="first.jsp" overwrite="yes" />
</target>

I want to know the  what would be the classpath (the loactions )for "first.txt"  and first.jsp inside the above mentioned target .

first.jsp is not exiting in the testWebApp. I believe the copy target will create a new file called first.jsp before its copied from first.txt.

also wated to know if this target "copy file" should be written inside build.xml of testWebApp or build.xml of sourceApp?

Any help would be greatly appreciated.

 

0
Comment
Question by:pacchureddy
  • 2
5 Comments
 
LVL 10

Expert Comment

by:mbvvsatish
ID: 17895869
you can do like this
1. copy the file to the destination directory

 <copy file="myfile.txt" todir="../some/other/dir"/>

2. and Rename the file that is copied in the destination directory

<rename src="foo.jar" dest="${name}-${version}.jar" replace="yes" />

>> also wated to know if this target "copy file" should be written inside build.xml of testWebApp or build.xml of sourceApp?

that is up to you. you can write in any build.xml file.
i prefer writing in build.xml of testWebApp if you have only one webapp.
if you have more than one webapps and you want to do the same file copy for all the webapps, you better do it in your main build.xml
0
 

Author Comment

by:pacchureddy
ID: 17901382
why do we have to copy the myfile.txt to a directory and then rename.
instead copy "myfile.txt" to another file (here in my case i wanted to as myfile.jsp)

<copy file ="myfile.txt" tofile="myfile.jsp" overwrite="yes" />


i have more than one webapp , but the file to be copied(myfile.jsp) needs to be placed in testWebApp's root folder

if i am writing this copy target in build.xml of testWebApp then what should be correct way of specifying the file location for "myfile.txt"

<copy file="(classpath)myfile.txt" tofile="myfile.jsp"/>

need to know the classpath for myfile.txt..... myfile.txt is present in the following directory structure:

souceApp/EAR/PresentationApp and myfile.jsp should be in souceApp/WAR/testWebApp
0
 
LVL 10

Accepted Solution

by:
mbvvsatish earned 500 total points
ID: 17904324
ok. i understood wrongly.
in you  build.xml of testWebApp you might have pointed the project to a base directory
something like
<project name="TestWebapp" basedir="C:/souceApp">

so you can specify you classpath fo myfile.txt with respect to you basedir.

if your basedir is souceApp/EAR then you can use ${basedir}/EAR/PresentationApp/myfile.txt
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unexpected HttpURLConnection connection behavior 2 86
Basic Java Case or If-Else statement... 3 43
session migration servlets 2 26
use lov values 2 36
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now