• 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

Compile EJB using ant target

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody,
I am new to dealing with EJBs. When i tried to compile a simple EJB using the following ant target, it prompts the message that the build was successful but still the .class files are not generated atthe specified target. Does anybody have any idea of why the .class files are not generated???

<?xml version="1.0"?>
<project name="test build" default="build" basedir=".">
<property name= "src.dir" value= "src/example"/>
<property name= "build.dir" value= "classes/example"/>

<target name = "build">
<javac srcdir="${src.dir}" destdir="${build.dir}" debug="true">
<include name="lib/j2ee.jar" />
</javac>
</target>


</project>

Thanks in advance.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anuradha,
Welcome to JavaRanch!

Does the build give any output from the javac task? If not, try setting it to run in verbose mode.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note we have a forum further down just for Ant. I'll move this thread for you.
 
Anuradha Karunamuni
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jeanne...
When I run it in the verbose mode, it goes in to the javac task and says that it is unable to find the sources.

[javac] No sources found.

But I have put the EJBs inside the specified source folder.
Can anybody think of a reason why this happens?
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, at least there is a clearer message now.

Are there existing compiled files? Maybe they have a later timestamp than the source? Another thing to try is to use the absolute path of the source directory in case Ant isn't pointing to where you think it is.
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The j2ee.jar should be in classpath, not in the javac "includes". By "including" the jar, the .java files are NOT included.


Take a look at some examples ant manual Javac task documentation


[ February 15, 2008: Message edited by: Carol Enderlin ]
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It should be worth noting that even when you have sorted out your classpath problem, the compiled classes will be unusable. The reason is that the classes which implement the interfaces and stubs also have to be generated, and everything is normally packaged in a JAR file after compilation. This JAR file must also contain any EJB server-specific deployment descriptor files.

You should refer to your server documentation which will describe how the Ant scripts or GUI (supplied by the EJB server provider) are used to build the EJB JAR file.
 
Anuradha Karunamuni
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have set all my classpaths correct. But still it doesn't generate the .class files. When I run it in the verbose mode it went in to javac and suppose that the following part of the output may be giving a clue of why this happens;

[antlib rg.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.

I'm still trying to figure out the reason for this. Anyway thanks for the help so far...
 
Your mother was a hamster and your father was a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic