• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with Ant Build

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am having a souce folder src.
Inside src I am having a package event
Inside event I am having a java file Event.java

package event;
public class Event{}

When I compile my java files using ant. Class files are created and in the class files the package declaration seems to be

package src.event;
public class Event{}

My question- Is it a problem with the build file? I have also added the build.xml below for you reference.


<project name="hibernate-tutorial" default="compile">

<property name="basedir" value="."/>
<property name="sourcedir" value="${basedir}/src"/>
<property name="targetdir" value="${basedir}/bin"/>
<property name="librarydir" value="${basedir}/lib"/>

<path id="libraries">
<fileset dir="${librarydir}">
<include name="*.jar"/>
</fileset>
</path>

<target name="compile">
<javac srcdir="${sourcedir}"
destdir="${targetdir}"
classpathref="libraries"/>
</target>
</project>


Thanks All
Ashok
[ July 25, 2006: Message edited by: Ashok Kumar Babu ]
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, I must say that it is not necessary that you create the basedir variable.

Ant already contains a set of built-in properties and basedir is one of them. See about it here.

Now, that you want to do, I typically do it this way, and it works.

Look how I declare the basedir property in the project tag. You are missing that, and that could be causing you trouble.

Another important issue is that the build.xml file should be in the same directory where the src, bin and lib directories are.

In other words

project
|
x------src
|
x------bin
|
x------lib
|
x------build.xml



I hope this helps!
[ July 25, 2006: Message edited by: Edwin Dalorzo ]
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi am giving the link for a build file which is working fine.

Make a look over it.

http://www.geocities.com/rudra4_w/ANT.doc


Open the doc and see the build.xml written on the button of this file.

web page
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're really distributing a build.xml file as a DOC? You didn't want to provide it as a txt or even an XML file? I'm not trying to be rude, but DOC files are of limitted use and may contain viruses.

Dave
 
reply
    Bookmark Topic Watch Topic
  • New Topic