0

I want to generate derby database using ant and build.xml (source class java as model table)?
In normal(I mean development phase). I've no problem to build that. Just right click to the ant file and build (using eclipse) the database is generated.
The problem is when I met the implementation step (in linux).

I'm using bin/ant -f build.xml command but its not generate and give some error like this:

[HibernateTools] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
[HibernateTools] 1. task: hbm2ddl (Generates database schema)
[HibernateTools] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
[HibernateTools] log4j:WARN Please initialize the log4j system properly.
[HibernateTools] log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

Build successfull But i cannot find the file database is?
Anyone with some exp?
@ alonso hi thanks i think so, i try with -v and give me this :

[root@APPTTPDEV01 TimesheetEJB_jar]# /home/rpangemanan/apache-ant-1.7.0/bin/ant  -v build.xml
Apache Ant version 1.7.0 compiled on December 13 2006
Buildfile: build.xml
Detected Java version: 1.6 in: /usr/java/jdk1.6.0_32/jre
Detected OS: Linux
parsing buildfile /home/rpangemanan/glassfish/domains/domain1/applications/j2ee-apps/Timesheet/TimesheetEJB_jar/build.xml with URI = file:/home/rpangemanan/glassfish/domains/domain1/applications/j2ee-apps/Timesheet/TimesheetEJB_jar/build.xml
Project base dir set to: /home/rpangemanan/glassfish/domains/domain1/applications/j2ee-apps/Timesheet/TimesheetEJB_jar

BUILD FAILED
Target "build.xml" does not exist in the project "HelloWorld".
        at org.apache.tools.ant.Project.tsort(Project.java:1821)
        at org.apache.tools.ant.Project.topoSort(Project.java:1729)
        at org.apache.tools.ant.Project.topoSort(Project.java:1692)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
3
  • can you post your build.xml file please? Commented Sep 5, 2012 at 11:18
  • 2
    I dont see any "errors" there. It is just a warning about log4j initialization. The error must be something else. For more information, add -verbose (or) -v to ant execution command. For more and more information, add -debug to ant command. Commented Sep 5, 2012 at 11:32
  • hi, i follow your instruction with -v Commented Sep 6, 2012 at 2:24

2 Answers 2

1

By default ant will always use the build.xml, so providing it's name should be redundant.

Providing a build target however is important. What you try to execute is the target build.xml inside the file build.xml, which doesn't exist in your project? Ant documentation says:

When omitted [..the target..], the target that is specified in the default attribute of the project tag is used.

Try just

bin/ant

This should execute the build.xml and the default target of your project. Also did you put your ant file into the ANT_HOME directory? If not you need to specify with -f the absolute location of your file (like /home/user/build.xml).

A good practice is to add /<path to ant>/bin to you PATH and just use the ant command in the directory where your build.xml resides.

The warnings with log4j can be ignored. It just means, that you haven't defined a logging appender, which specifies how log messages are stored (e.g. in a file or multiple files or some other stream). In this case they are printed to the console, which should be okay for you (for now).

Sign up to request clarification or add additional context in comments.

Comments

1

hi i finally found what the problem was
first the builded was no error like Peter and exception says tq again.
that is missing is in 'ij'(found on javadb\bin) i must create true the database derby like this

connect 'jdbc:derby://localhost/1527/timesheet_db;create=true';

then just build again with ant

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.