Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pde-dev] Unable to setup API Tooling ANT tasks for Headless Reporting

In addition to the "same JRE as the workspace" trick. From the command line the "eclipse.install.dir" property should point to
as most recent a build of Eclipse as possible.

In your example (it appears) you have a 3.4.x install which does not contain the classes for the Ant tasks. Try using a 3.6 build.

When using the build file from the command line (the one from the /scripts folder) it is important to note that during the initialize task it takes the "eclipse.install.dir" and uses that
to find the API tools jar to extract the apitooling-ant.jar. After that it uses the "eclipse.install.dir" to load relevant bundles on the Ant classpath
i.e. the API tools jar with the Ant classes in it. Lastly it sets the properties file to know the names of the tasks and the classes that implement them.

Also note that from the command line the Ant task names are NOT qualified with "apitooling" - for example

<?xml version="1.0" encoding="UTF-8"?>
<!-- removed a bunch of property settings -->
<target name="run">
 <analysis
   baseline="${baseline}"
   profile="">    report="${report_location}"
   debug="true"
 />
 <analysis_reportconversion
   htmlfiles="${html_report_location}"
   xmlfiles="${report_location}"
   debug="true"
 />
</target>
</project>


Hope this helps...

Michael Rennie

Inactive hide details for Puneet Kapur ---11/23/2009 07:48:47 PM---Problem: Trying to use the ANT scripts provided in various iPuneet Kapur ---11/23/2009 07:48:47 PM---Problem: Trying to use the ANT scripts provided in various introductory tutorials to use the API Too

From: Puneet Kapur <pkapur@xxxxxxxxx>
To: pde-dev@xxxxxxxxxxx
Date: 11/23/2009 07:48 PM
Subject: [pde-dev] Unable to setup API Tooling ANT tasks for Headless Reporting
Sent by: pde-dev-bounces@xxxxxxxxxxx





Problem: Trying to use the ANT scripts provided in various
introductory tutorials to use the API Tooling in headless mode leads
to a) ant task not found [when run in eclipse] or b) required classes
not found errors [when run from command line or eclipse]

Environment:

Windows XP
Eclipse 3.4.2 and Eclipse 3.5.x
Java 1.6
Ant 1.7.x

Approach:

1. Attempts at using the XML script provided by Chris Aniszczyk at
[
http://eclipsesource.com/blogs/2009/07/08/osgi-eclipse-and-api-management/]
over at EclipseSource.com

<?xml version="1.0" encoding="UTF-8"?>
<!-- removed a bunch of property settings -->

<target name="run">
    <apitooling.analysis
      baseline="${baseline}"
    profile="">       report="${report_location}"
      debug="true"
     />
    <apitooling.analysis_reportconversion
      htmlfiles="${html_report_location}"
      xmlfiles="${report_location}"
      debug="true"
    />
  </target>
</project>

Gives rise to the following error:

BUILD FAILED
C:\temp\workspace_eclipseTemp\IBMDevWorks3\sampleProject.xml:14:
Problem: failed to create task or type apitooling.analysis
Cause: The name is undefined.

Error occurs in both Eclipse 3.4.2 and 3.5.x.

This seems to imply that Ant does not "know" what the
"apitooling.analysis" tasks is (or how it should be run).

Attempted workaround: checked under Eclipse > Preferences > Ant >
Runtime > Tasks and all the API tooling tasks are listed as being
present including: apitooling.analysis and apitooling.apifreeze

Explicitly added the api-tooling.jar file to the eclipse project path
but still no luck.

2. In an attempt to workaround this problem using ANT from the command
line instead of inside Eclipse. A number of sources noted the
importance of api-tooling.jar and the relevant wiki provided a link
sample XML to help get users started by loading the relevant ANT tasks
(via the TaskDef feature in ant) and with help for the class path
issues:

Sample code in in the PDE repository at:
http://dev.eclipse.org/viewsvn/index.cgi/pde/apitools/org.eclipse.pde.api.tools/scripts/

The specific XML script from the PDE repository is:
http://dev.eclipse.org/viewsvn/index.cgi/pde/apitools/org.eclipse.pde.api.tools/scripts/api-tasks.xml?revision=1.3&content-type=text/plain

Using the following values for the properties:

<property name="eclipse.install.dir" value="/Eclipse_35x/eclipse/plugins"/>

or

<property name="eclipse.install.dir" value="/Eclipse_342/eclipse/plugins"/>
<property name="eclipse.lib.dir" value="/temp/apiSandbox/lib"/>
<property name="task.props" value="/temp/apiSandbox/api-tasks.properties"/>


Using either eclipse install in place of "eclipse.install.dir"
property the "extract-apitoolingjar" ANT target runs successfully but
the following error is generated in the command line:

********************************
Buildfile: fullbuild.xml

extract-apitoolingjar:
   [unjar] Expanding: C:\Eclipse_342\eclipse\plugins\org.eclipse.pde.api.tools_
1.0.0.v20081117_r342.jar into C:\temp\apiSandbox\lib
    [move] Moving 1 file to C:\temp\apiSandbox\lib
  [delete] Deleting directory C:\temp\apiSandbox\lib\lib

init:

BUILD FAILED
C:\temp\apiSandbox\fullbuild.xml:51: taskdef A class needed by class org.eclipse
.pde.api.tools.internal.tasks.APIFreezeTask cannot be found: org/eclipse/pde/api
/tools/internal/util/TarException

Total time: 11 seconds
********************************

Tried re-running the above scenario inside Eclipse 3.42/3.5.x (instead
of command line) with the same errors arising.  Looked around to see
where the TarException class might be and it is included in the jars
that ANT is able to find, namely:

org.eclipse.pde.api.tools.source_1.0.0.v20081117_r342.jar  --> comes
with Eclipse 3.4.2
org.eclipse.pde.api.tools.source_1.0.101.v20090714.jar --> comes with
Eclipse 3.5.x

Any suggestions for a solution are welcome.

thanks,
-pkapur


For the truly interested complete ANT verbose output is below:


Buildfile: fullbuild.xml
Detected Java version: 1.6 in: C:\Program Files\Java\jdk1.6.0_13\jre
Detected OS: Windows XP
parsing buildfile C:\temp\apiSandbox\fullbuild.xml with URI = file:/C:/temp/apiS
andbox/fullbuild.xml
Project base dir set to: C:\temp\apiSandbox
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apach
e/tools/ant/antlib.xml. It could not be found.
Build sequence for target(s) `run' is [extract-apitoolingjar, init, run]
Complete build sequence is [extract-apitoolingjar, init, run, debug, printDebug,
]

extract-apitoolingjar:
   [unjar] Expanding: C:\Eclipse_342\eclipse\plugins\org.eclipse.pde.api.tools_
1.0.0.v20081117_r342.jar into C:\temp\apiSandbox\lib
   [unjar] expanding lib/apitooling-ant.jar to C:\temp\apiSandbox\lib\lib\apito
oling-ant.jar
   [unjar] expand complete
    [move] Moving 1 file to C:\temp\apiSandbox\lib
    [move] Attempting to rename: C:\temp\apiSandbox\lib\lib\apitooling-ant.jar
to C:\temp\apiSandbox\lib\apitooling-ant.jar
  [delete] Deleting directory C:\temp\apiSandbox\lib\lib
  [delete] Deleting directory C:\temp\apiSandbox\lib\lib

init:

BUILD FAILED
C:\temp\apiSandbox\fullbuild.xml:51: taskdef A class needed by class org.eclipse
.pde.api.tools.internal.tasks.APIFreezeTask cannot be found: org/eclipse/pde/api
/tools/internal/util/TarException
       at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:613)

       at org.apache.tools.ant.taskdefs.Definer.loadProperties(Definer.java:412
)
       at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:268)
       at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
       at org.apache.tools.ant.Task.perform(Task.java:348)
       at org.apache.tools.ant.Target.execute(Target.java:357)
       at org.apache.tools.ant.Target.performTasks(Target.java:385)
       at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
       at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
       at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
       at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
       at org.apache.tools.ant.Main.runBuild(Main.java:758)
       at org.apache.tools.ant.Main.startAnt(Main.java:217)
       at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
       at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/pde/api/tools/internal/ut
il/TarException
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:247)
       at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:583)

       ... 19 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.pde.api.tools.internal.
util.TarException
       at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
       ... 22 more
--- Nested Exception ---
java.lang.NoClassDefFoundError: org/eclipse/pde/api/tools/internal/util/TarExcep
tion
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:247)
       at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:583)

       at org.apache.tools.ant.taskdefs.Definer.loadProperties(Definer.java:412
)
       at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:268)
       at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
       at org.apache.tools.ant.Task.perform(Task.java:348)
       at org.apache.tools.ant.Target.execute(Target.java:357)
       at org.apache.tools.ant.Target.performTasks(Target.java:385)
       at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
       at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
       at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
       at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
       at org.apache.tools.ant.Main.runBuild(Main.java:758)
       at org.apache.tools.ant.Main.startAnt(Main.java:217)
       at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
       at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.ClassNotFoundException: org.eclipse.pde.api.tools.internal.
util.TarException
       at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
       ... 22 more

Total time: 12 seconds
_______________________________________________
pde-dev mailing list
pde-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/pde-dev

GIF image


Back to the top