Meaningless Drivel is fun!*
The moose likes Ant, Maven and Other Build Tools and the fly likes Simple script to compile package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Simple script to compile package" Watch "Simple script to compile package" New topic
Author

Simple script to compile package

santoshkumar savadatti
Ranch Hand

Joined: Apr 27, 2010
Posts: 95
I'm learning automated unit testing. i can run tests on classes that are in default package e.g: my directory is src/java/main and the class is in the default package.I specify source location as {src.java.main.dir} and it works. What if i add the class to a package "com.xyz.org" under src/java/main?
How to modify the build file to compile a file in a package?
Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

You really shouldn't build anything in the default package. A lot of Java systems will get annoyed at you if you do.

Complex Java applications are too much trouble to build using generic OS script files. I recommend that you use a tool designed specifically to do that sort of work, such as Ant or Maven.


Customer surveys are for companies who didn't pay proper attention to begin with.
santoshkumar savadatti
Ranch Hand

Joined: Apr 27, 2010
Posts: 95
I'm sorry i wasn't clear
I'm using ant and need to know how to declare the package and how to specify the srcdir in javac task.
I will have src/java/main and src/java/test with java and junit classes in packages under them.
santoshkumar savadatti
Ranch Hand

Joined: Apr 27, 2010
Posts: 95
santoshkumar savadatti wrote:I'm learning automated unit testing. i can run tests on classes that are in default package e.g: my directory is src/java/main and the class is in the default package.I specify source location as {src.java.main.dir} and it works. What if i add the class to a package "com.xyz.org" under src/java/main?
How to modify the build file to compile a file in a package?
Thanks.

Found the solution.
i have to define a property


and in javac task,


i wasn't aware of the "includes" attribute
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple script to compile package