Solved

Build problem

Posted on 2011-03-14
53
354 Views
Last Modified: 2012-05-11
Hi ,

I have some ant script to build my project , I think it was working fine before . but now its not ? It reffer my old files and old folders . i have create some folder in web content  called wsdl . some days back i deleted that folder . in my project (eclispse work sepace ) today i bulid the
project . i saw the files again how can it possible ?  is this build error or some other error ?
 
<?xml version="1.0" encoding="UTF-8"?>
<project name="Deploy From Eclipse to Tomcat" basedir=".">
<property name="warfile" value="x"/>
<target name="unpack">
<unwar src="${warfile}.war" dest="${warfile}" />
</target>
<target name="create">
<war destfile="${warfile}.war" webxml="WebContent/WEB-INF/web.xml" update="true">
<classes dir="build\classes"/>
<fileset dir="WebContent">
<exclude name="WEB-INF/web.xml"/>
</fileset>
</war>
</target>
<target name="copy">
<copy todir="c:\Tomcat55\webapps" overwrite="true">
<fileset dir=".">
<include name="*.war"/>
</fileset>
</copy>
</target>
<target name="deploy">
<antcall target="create"/>
<antcall target="copy"/>
</target>
</project>

Open in new window

0
Comment
  • 28
  • 17
  • 7
  • +1
53 Comments
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
And i deleted some jars --- its maintain the same size not reduce . old war and new war file size are same !!
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
And aslo

I put some hard code value in one Jsp file . but that value not present in that war file(after deploy i checked)
0
 
LVL 47

Expert Comment

by:for_yan
Comment Utility
So, if it is not working, do you see some error message?
I think some more details could be helpful
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Make sure that particular build file is actually getting run.

>>I put some hard code value in one Jsp file . but that value not present in that war file(after deploy i checked)

Also, is that jsp under directory WebContent? If it isn't, it won't be included

Please run ant thus and please post the file ant.log
ant -d -f <absolute path to ant build file here without angle brackets> deploy >ant.log 2>&1

Open in new window

0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
>>>>>>>>if it is not working, do you see some error message?
no its created successfully .

>>>>I think some more details could be helpful

I dont know which type of deatils will give .Please ask me question


>>>>>>>>Make sure that particular build file is actually getting run.

yes i am sure build is running ,  because  while running the target values are printed in console.

>>>>>>>>Also, is that jsp under directory WebContent? If it isn't, it won't be included

ya that file is webcontent/jsp folder only

>>>>>>>Please run ant thus and please post the file ant.log
i will run this 2mmorrow because i am room now !
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
>>yes i am sure build is running ,  because  while running the target values are printed in console.

Yes, but it might not be the build file you think it is
0
 
LVL 92

Assisted Solution

by:objects
objects earned 150 total points
Comment Utility
eclipse could be creating them, check your eclipse setup
and your build should have a clean option that first deletes all generated content before building
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
>>>>>>>your build should have a clean option that first deletes all generated content before building

How to do that ??
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
ant -d -f <absolute path to ant build file here without angle brackets> deploy >ant.log 2>&1

how to run this ?? give  an example ??
0
 
LVL 92

Assisted Solution

by:objects
objects earned 150 total points
Comment Utility
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
2 build folder are created ??

outside the webcontent and inside webcontent/web-inf/build  which one will be reffred by the deployement code ??
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
it deploys from build.home
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
Sorry i am not getting ?
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
the directory ${build.home} is what is deployed to tomcat, which what that property is set to
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
in my ant script >>
<classes dir="build\classes"/>

which hulid path its reffer ? its out side or inside the web content !!
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
>>how to run this ?? give  an example ??

ant -d -f "c:\my projects\webstuff\build.xml" deploy >ant.log 2>&1

Open in new window

0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 350 total points
Comment Utility
To subsequently view as well (but attach the file please):
ant -d -f "c:\my projects\webstuff\build.xml" deploy >ant.log 2>&1
notepad ant.log

Open in new window

0
 
LVL 92

Expert Comment

by:objects
Comment Utility
> which hulid path its reffer ? its out side or inside the web content !!

its the build/classes folder, not really anything to do with the build path
Its the folder containing your compiled classes
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
ant -d -f "C:\sathishkumar\new1103\xxbuild.xml" deploy >ant.log 2>&1 notepad ant.log

i run this in command promt it nothing is happend .
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
That's two separate commands:


ant -d -f "C:\sathishkumar\new1103\xxbuild.xml" deploy >ant.log 2>&1
notepad ant.log

Open in new window

0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
>>>>> the directory ${build.home} is what is deployed to tomcat, which what that property is set to


I put echo message in ant builder with ${build.home} but it reuturn nothing
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
the result is

'ant' is not recognized as an internal or external command,
operable program or batch file.
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
which build file are you referring to?
the one you posted in the question does not do a deploy, it just creates the war
the one I posted sets it to

  <property name="build.home"    value="${basedir}/build"/>
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
${warfile} is the only variable used, so if you haven't set it subsequently in the build file, you'd need to do it something like this. Please attach the file ant.log
ant -Dwarfile=mywar.war -d -f "C:\sathishkumar\new1103\xxbuild.xml" deploy >ant.log 2>&1

Open in new window

0
 
LVL 92

Expert Comment

by:objects
Comment Utility
Creating a build file from scratch is rarely needed, better to start with an existing one and tune it to your needs.
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
@CEHJ: same result

>>>>Creating a build file from scratch is rarely needed, better to start with an existing one and tune it to your needs.

I am tring with exiting ant builder but have some
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
>>@CEHJ: same result

You won't see anything happening. The result is in ant.log in the directory in which you run the command
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
>>>You won't see anything happening. The result is in ant.log in the directory in which you run the command

c:\ant -Dwarfile=mywar.war -d -f "C:\sathishkumar\new1103\xxbuild.xml" deploy >ant.log 2>&1

C:\ notepad ant.log

'ant' is not recognized as an internal or external command,
operable program or batch file.

0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 350 total points
Comment Utility
>>
ant' is not recognized as an internal or external command,
operable program or batch file.
>>

You need to make sure that either

a. the ant.bat directory is on PATH
b. you use the full path to ant.bat

(The former is preferable)
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
>>>>>>>a. the ant.bat directory is on PATH
b. you use the full path to ant.bat


Where it should be? ant.bat file there but i dont it on path

path means enviroment varibale ?
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
>>path means enviroment varibale ?

Yes. See'Environment Variables' in Windows help
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
yes i add in ant.bat in envi path
but same result only coming
'ant' is not recognized as an internal or external command,
operable program or batch file.
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 350 total points
Comment Utility
Did you start a new command window? You need to
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
OK, so what do you think you're missing in the result, or what is unexpected?
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
see the last 2 lines

   [copy] Copying C:\sathishkumar\new1103\x\x.war to c:\Tomcat55\webapps\x.war
     [copy] Copying C:\sathishkumar\new1103\x\x.war.war to c:\Tomcat55\webapps\x.war.war

that 2war size are diffrent ?

U dont how its create 2 time . This is the 1st time i am seeing
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Just in case there have been any changes in build.xml, can you attach the version you're using?
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
if i deploy \x.war
then unwanted files are created (i already delete folder are there)
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Your copy task (if still the same as the original) can be simplified to
<target name="copy">
	<copy todir="c:\Tomcat55\webapps" overwrite="true" file="${warfile}" />
    </target>

Open in new window

0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
You also must decide whether you're going to enter either

x

or

x.war

as the ${warfile} parameter. If the latter, then you must decide whether

${warfile}.war

should appear in the build file - probably not
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
>>file="${warfile}" />

build fails !!
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
file="${warfile}.war" /> working fine but it still reffer wrong folders
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Try the following as

ant deploy

(in the correct directory)
build.xml
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
your build.xml and mine are same right ??
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
Devlopement view    deploy dev
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 350 total points
Comment Utility
Delete all the stuff from the deploy directory and run the one i just gave you from the correct directory. It should be OK. You need to do this from the command line, in the same directory as the build.xml
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
ya while i deploy i dellted the extact folder no use ...

>>>>>>>>>>>>>>>>>see the last 2 lines

   [copy] Copying C:\sathishkumar\new1103\x\x.war to c:\Tomcat55\webapps\x.war
     [copy] Copying C:\sathishkumar\new1103\x\x.war.war to c:\Tomcat55\webapps\x.war.warthat 2war size are diffrent ?

U dont how its create 2 time . This is the 1st time i am seeing

while i deploy that code its having correct file and my hard coded values also !!


0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
But now its not genrating !!  :(
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
Yes its done it ! i delted only in tomcat folder but now i deleted in my project folder aslo now its working

Thanks a lot !!
0
 
LVL 20

Author Closing Comment

by:Sathish David Kumar N
Comment Utility
Thanks lot ........
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
That's OK. Can you confirm that you can run the deploy task from the ide successfully too?
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
http:#35137358   replace file with old one ant.txt
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
Comment Utility
yes i can deploy from IDE also.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Updating Java 9 86
countAbc challenge 9 49
groovy example issue 10 65
thymeleaf natural templating vs JSP 2 22
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

762 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

9 Experts available now in Live!

Get 1:1 Help Now