[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 364
  • Last Modified:

Build problem

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
Sathish David  Kumar N
Asked:
Sathish David  Kumar N
  • 28
  • 17
  • 7
  • +1
6 Solutions
 
Sathish David Kumar NAuthor Commented:
And i deleted some jars --- its maintain the same size not reduce . old war and new war file size are same !!
0
 
Sathish David Kumar NAuthor Commented:
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
 
for_yanCommented:
So, if it is not working, do you see some error message?
I think some more details could be helpful
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
CEHJCommented:
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
 
Sathish David Kumar NAuthor Commented:
>>>>>>>>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
 
CEHJCommented:
>>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
 
objectsCommented:
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
 
Sathish David Kumar NAuthor Commented:
>>>>>>>your build should have a clean option that first deletes all generated content before building

How to do that ??
0
 
Sathish David Kumar NAuthor Commented:
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
 
objectsCommented:
0
 
Sathish David Kumar NAuthor Commented:
2 build folder are created ??

outside the webcontent and inside webcontent/web-inf/build  which one will be reffred by the deployement code ??
0
 
objectsCommented:
it deploys from build.home
0
 
Sathish David Kumar NAuthor Commented:
Sorry i am not getting ?
0
 
objectsCommented:
the directory ${build.home} is what is deployed to tomcat, which what that property is set to
0
 
Sathish David Kumar NAuthor Commented:
in my ant script >>
<classes dir="build\classes"/>

which hulid path its reffer ? its out side or inside the web content !!
0
 
CEHJCommented:
>>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
 
CEHJCommented:
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
 
objectsCommented:
> 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
 
Sathish David Kumar NAuthor Commented:
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
 
CEHJCommented:
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
 
Sathish David Kumar NAuthor Commented:
>>>>> 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
 
Sathish David Kumar NAuthor Commented:
the result is

'ant' is not recognized as an internal or external command,
operable program or batch file.
0
 
objectsCommented:
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
 
CEHJCommented:
${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
 
objectsCommented:
Creating a build file from scratch is rarely needed, better to start with an existing one and tune it to your needs.
0
 
Sathish David Kumar NAuthor Commented:
@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
 
CEHJCommented:
>>@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
 
Sathish David Kumar NAuthor Commented:
>>>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
 
CEHJCommented:
>>
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
 
Sathish David Kumar NAuthor Commented:
>>>>>>>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
 
CEHJCommented:
>>path means enviroment varibale ?

Yes. See'Environment Variables' in Windows help
0
 
Sathish David Kumar NAuthor Commented:
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
 
CEHJCommented:
Did you start a new command window? You need to
0
 
Sathish David Kumar NAuthor Commented:
0
 
CEHJCommented:
OK, so what do you think you're missing in the result, or what is unexpected?
0
 
Sathish David Kumar NAuthor Commented:
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
 
CEHJCommented:
Just in case there have been any changes in build.xml, can you attach the version you're using?
0
 
Sathish David Kumar NAuthor Commented:
if i deploy \x.war
then unwanted files are created (i already delete folder are there)
0
 
CEHJCommented:
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
 
CEHJCommented:
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
 
Sathish David Kumar NAuthor Commented:
>>file="${warfile}" />

build fails !!
0
 
Sathish David Kumar NAuthor Commented:
file="${warfile}.war" /> working fine but it still reffer wrong folders
0
 
CEHJCommented:
Try the following as

ant deploy

(in the correct directory)
build.xml
0
 
Sathish David Kumar NAuthor Commented:
your build.xml and mine are same right ??
0
 
Sathish David Kumar NAuthor Commented:
Devlopement view    deploy dev
0
 
CEHJCommented:
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
 
Sathish David Kumar NAuthor Commented:
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
 
Sathish David Kumar NAuthor Commented:
But now its not genrating !!  :(
0
 
Sathish David Kumar NAuthor Commented:
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
 
Sathish David Kumar NAuthor Commented:
Thanks lot ........
0
 
CEHJCommented:
That's OK. Can you confirm that you can run the deploy task from the ide successfully too?
0
 
Sathish David Kumar NAuthor Commented:
http:#35137358   replace file with old one ant.txt
0
 
Sathish David Kumar NAuthor Commented:
yes i can deploy from IDE also.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 28
  • 17
  • 7
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now