Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently I'm trying to install Pentaho Reports for OpenERP. I have installed Pentaho Reports on Windows based laptops and they are working fine. Currently I'm trying on Ubuntu 11.04 and it gives me this error:

error build.xml: 18: failed to create task or type.

Below are the steps I performed:

  1. Installed java-6-openjdk from the repository

    apt-get install java-6-openjdk
    
  2. Then I set installed Java JDK into java_home environment

    nano /etc/environment
    

    Added environment with this new line:

    JAVA_HOME="/usr/lib/jvm/java-6-openjdk"
    
  3. I then installed Apache ant from the repository

    apt-get install ant
    
  4. Followed by setting the environment

    nano /etc/environment
    

    Added environment with this new line:

    ANT_HOME="/usr/share/ant"
    
  5. Tried to check installation with command ant... and I get messages like this:

    Buildfile: build.xml does not exist!
    Build failed
    
  6. Then downloaded Java server from Pentaho Reports for OpenERP and then copied to Ubuntu share folder. And then from command line, I went to extracted path which is the share folder. I mentioned and executed command ant war and I got this error message:

    BUILD FAILED
    /share/java_server/build.xml: 18: problem: failed to create task or
    type antlibrg:apacge.ivy.ant: retrieve
    cause: The name is undefined.
    Action: Check the spelling.
    Action: Check that any custom taks/types have been declared
    Action: Check that any <presetdef>/<macrodef>declarations have taken place.
    No types or taks have been defined in this namespace yet
    This appears to be an antlib declaration. 
    Action: Check that the implementing library exists in one of:
       - /usr/share/ant/lib
       -/root/.ant/lib
       - A directory added on the command line with the -lib argument
    
    Total time: 0 seconds
    

Is there any compatibility issue? Or am I missing out some steps?

share|improve this question
    
You are updating your environment but your current session is unaware of those changes, thus using the old settings. Either use the export JAVA_HOME=/usr/lib/jvm/java-6-openjdk and export ANT_HOME=/usr/share/ant or log out and log back in. – grs Oct 7 '12 at 5:01

Try these steps (they worked for me):

  • Update openjdk-6-jdk

  • In /etc/environment add:

    JAVA_HOME="/usr/lib/jvm/java-6-openjdk"
    JRE_HOME="/usr/lib/jvm/java-6-openjdk/jre"
    ANT_HOME="/usr/share/ant/bin"
    PATH = ".....:$JAVA_HOME:$JRE_HOME:$ANT_HOME:/usr/share/ant/lib"
    
  • Restart your system

  • In java_server input the command ant war. You should get this message:

    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
    Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    Could not find the main class: org.apache.tools.ant.launch.Launcher. Program will exit.
    
share|improve this answer

This is caused by the fact the build system cannot find ivy libraries. You have to install ivy first:

apt-get install ivy

If still complaining with the same error, run the ant job using:

ant -lib /usr/share/java/ war

where /usr/share/java/ is a path, where ivy installs the .jar files.

BTW: I don't know what exactly did you clone from git, but on the link you sent is the ivy resource defined on the line 27, not 18, like you say.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .