Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

What does ${user.home} means ? Where is build .properties ?

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi , I am new to ant can any one tell me what the below highlighet snippet achieves ?

I know basic ant scripts.


<!-- ================================================================ -->
<!-- Local system paths -->
<!-- ================================================================ -->
<property environment="env"/>
<property file="build.properties"/>
<property file="${user.home}/build.properties"/>

<property file="environment.properties"/>



Regards
Shaan

[ June 04, 2008: Message edited by: Shaan patil ]

[ June 04, 2008: Message edited by: Shaan patil ]
[ June 04, 2008: Message edited by: Shaan patil ]
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shaan,
Please refer to link
Property task page



regards,
PP
 
Shaan patil
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,

I read the manual but ,I am not able to find where the build p
roperties is located ?
when I echoed the user.home it pointing to C:\Documents and Settings\shaan
location.But there no build.properties exist.

Regards
Shaan Patil
 
prash patil
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shaan,

In your build file you will find
<project name="Name of your project " default="default-task-to-invoke" basedir="base-directory-from-where-to-run">


So if your base directory is C:\Documents and Settings\shaan then the build.property files default location will be the same

And for your information you need to crate the property file with key=value pairs.

If still have doubt, paste your build file contents and the problem propery.


regards,
PP
 
Shaan patil
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Prash,


The following is my build.xml in c:/struts-training/exercise01 folder.
I am still not able to locate the build.properties file.
But the script is working fine till check point 2 marked bold in the below script.
This is the content of my environment.properties located in C:/struts-training/exercise01
********************************
struts.training.home = C:/struts-training
weblogic.lib = C:/bea812/weblogic81/server/lib
deploy.domain = C:/bea812/user_projects/domains/mydomain
*************************************************************

How is the script loading the other properties when I dont have a
build .properties anywhere ?


<?xml version="1.0" encoding="UTF-8" ?>

<!-- ================================================================ -->
<!-- This Ant build script assumes the following directory structure. -->
<!-- ================================================================ -->
<!--
src
|
|\-java
|
\-web
|
|\-jsps go here
|
\-WEB-INF
|
\-web.xml and other xmls go here

At the end of the build, the war is created and hot deployed in weblogic
-->

<project name="exercise01" basedir="../" default="all">


<!-- ================================================================ -->
<!-- Local system paths -->
<!-- ================================================================ -->
<property environment="env"/>


<property file="build.properties"/>
<property file="${user.home}/build.properties"/>
<property file="environment.properties"/>

<echo> ${user.home} </echo>
<echo> env </echo>





<!-- ================================================================ -->
<!-- Name of project &context. When deployed, this application -->
<!-- will become accessible at http://localhost:7001/{context.name} -->
<!-- ================================================================ -->
<property name="project.name" value="exercise01"/>
<property name="context.name" value="${project.name}"/>


<!-- ================================================================ -->
<!-- Directories for source and build -->
<!-- ================================================================ -->
<property name="src.dir" value="${basedir}/${project.name}/src/java"/>
<property name="src.web.dir" value="${basedir}/${project.name}/src/web"/>
<property name="src.webinf.dir" value="${src.web.dir}/WEB-INF"/>
<property name="build.dir" value="${basedir}/${project.name}/build"/>
<property name="build.web.dir" value="${build.dir}/web"/>
<property name="build.webinf.dir" value="${build.dir}/WEB-INF"/>


<!-- ================================================================ -->
<!-- Temporary directory for EAR, WAR, JAR files -->
<!-- ================================================================ -->
<property name="build.deploy.dir" value="${build.dir}/deploy"/>

<!-- ================================================================ -->
<!-- Directory in Weblogic tree for hot-deployment of wars -->
<!-- ================================================================ -->
<property name="deploy.dir" value="${deploy.domain}/applications"/>


<!-- ============================================================== -->
<!-- Application targets -->
<!-- ============================================================== -->

<target name="clean" description="Clean project directory of generated files">
<delete dir="${build.dir}"/>
</target>

<!-- Create war file with servlets, JSPs, HTML pages, images, etc. -->
<target name="war" depends="clean" description="Generate packaged WAR file">

<mkdir dir="${build.deploy.dir}"/>
<mkdir dir="${build.web.dir}"/>
<mkdir dir="${build.web.dir}/css"/>
<mkdir dir="${build.web.dir}/images"/>
<mkdir dir="${build.webinf.dir}"/>
<mkdir dir="${build.webinf.dir}/lib"/>
<mkdir dir="${build.webinf.dir}/classes"/>

<!-- Copy jar files from struts-training folder -->
<copy todir="${build.webinf.dir}/lib">
<fileset dir="${basedir}/lib">
<include name="commons-beanutils.jar"/>
<include name="commons-collections.jar"/>
<include name="commons-digester.jar"/>
<include name="commons-fileupload.jar"/>
<include name="commons-lang.jar"/>
<include name="commons-logging.jar"/>
<include name="commons-resources.jar"/>
<include name="commons-validator.jar"/>
<include name="jakarta-oro.jar"/>
<include name="struts.jar"/>
</fileset>
</copy>

<echo> ************ Check point 1 *********** </echo>
<!-- Copy class files -->
<copy todir="${build.webinf.dir}/classes">
<fileset dir="${project.name}/classes">
<include name="**"/>
</fileset>
</copy>
<echo> ************ Check point 2 *********** </echo>


<echo> ${build.web.dir}</echo>
<!-- Copy JSP files -->
<copy todir="${build.web.dir}">
<fileset dir="${src.web.dir}">
<include name="**"/>
</fileset>
</copy>
<echo> ************ Check point 3 *********** </echo>
<!-- Copy deployment descriptors and Struts xmls -->
<copy todir="${build.webinf.dir}">
<fileset dir="${src.webinf.dir}">
<include name="**"/>
</fileset>
</copy>

<!-- Copy CSS from shared artifacts-->
<copy todir="${build.web.dir}/css">
<fileset dir="${basedir}/shared-artifacts/css">
<include name="**"/>
</fileset>
</copy>

<!-- Copy images from shared artifacts-->
<copy todir="${build.web.dir}/images">
<fileset dir="${basedir}/shared-artifacts/images">
<include name="**"/>
</fileset>
</copy>

<!-- Copy tlds from shared artifacts-->
<copy todir="${build.webinf.dir}">
<fileset dir="${basedir}/shared-artifacts/tlds">
<include name="**"/>
</fileset>
</copy>

<!-- Create war file by bundling all elements together -->
<war warfile="${build.deploy.dir}/${context.name}.war"
webxml="${build.webinf.dir}/web.xml">
<webinf dir="${build.webinf.dir}">
<include name="**"/>
<exclude name="web.xml"/>
</webinf>
<fileset dir="${build.web.dir}">
<include name="*.jsp"/>
<include name="css/*.css"/>
<include name="images/*.gif"/>
<include name="images/*.jpg"/>
</fileset>
</war>
</target>

<!-- Deploy the WAR file to WebLogic -->
<target name="deploy" depends="war" description="Deploy application to WebLogic">
<copy file="${build.deploy.dir}/${context.name}.war"
todir="${deploy.dir}"/>
</target>

<!-- Build project and create distribution-->
<target name="all" depends="clean,war,deploy"/>

</project>

Below is the error that I get when I run the build.xml from eclipse


Buildfile: C:\struts-training\exercise01\build.xml
[echo] C:\Documents and Settings\shaan
[echo] env
[echo] Number of Processors = 1
[echo] ANT_HOME is set to = C:\Eclipse Tool\eclipse\plugins\org.apache.ant_1.7.0.v200706080842
clean:
[delete] Deleting directory C:\struts-training\exercise01\build
war:
[mkdir] Created dir: C:\struts-training\exercise01\build\deploy
[mkdir] Created dir: C:\struts-training\exercise01\build\web
[mkdir] Created dir: C:\struts-training\exercise01\build\web\css
[mkdir] Created dir: C:\struts-training\exercise01\build\web\images
[mkdir] Created dir: C:\struts-training\exercise01\build\WEB-INF
[mkdir] Created dir: C:\struts-training\exercise01\build\WEB-INF\lib
[mkdir] Created dir: C:\struts-training\exercise01\build\WEB-INF\classes
[copy] Copying 10 files to C:\struts-training\exercise01\build\WEB-INF\lib
[echo] ************ Check point 1 ***********
[echo] ************ Check point 2 ***********
[echo] C:\struts-training/exercise01/build/web

BUILD FAILED
C:\struts-training\exercise01\build.xml:117: C:\struts-training\exercise01\src\web not found.

Total time: 2 seconds


*************************************************************************

[ June 04, 2008: Message edited by: Shaan patil ]

[ June 04, 2008: Message edited by: Shaan patil ]
[ June 04, 2008: Message edited by: Shaan patil ]
 
prash patil
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
While looking to you task it seems that you want to copy the files form
location C:\struts-training\exercise01\src\web to location C:\struts-training\exercise01\build\web

Check that the property ${src.web.dir} is pointing to desired location.
i.e. Is C:\struts-training\exercise01\src\web this path exist... ?
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Shaan patil:

I read the manual but ,I am not able to find where the build p
roperties is located ?



Did you also read this?


If the file is not there, nothing is printed except at -verbose log level. This lets you have optional configuration files for every project, that team members can customize.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic