Solved

classpath needed inside build.xml file

Posted on 2006-11-07
5
178 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

752 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