Execute Ant Script with Ant Tasks Programmatically - java

I have an Ant Script which uses Ant Task (I use this Task to execute QVTo Transformations).
The Ant Script is the following one:
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="default" xmlns:qvto="http://www.eclipse.org/qvt/1.0.0/Operational">
<target name="default">
<taskdef name="http://www.eclipse.org/qvt/1.0.0/Operational:transformation" classname="org.eclipse.m2m.internal.qvt.oml.runtime.ant.QvtoAntTransformationTask">
<classpath>
<pathelement location="${basedir}/libAnt/antTasks.jar"/>
</classpath>
</taskdef>
<qvto:transformation uri="platform:/resource/QVToTransformation/transforms/QVTTransformation.qvto">
<in uri="platform:/resource/QVToTransformation/In/In.ecp" />
<out uri="platform:/resource/QVToTransformation/Out/Out.uml" />
<trace uri="platform:/resource/QVToTransformation/Trace/trace.qvtotrace"
generate="true" incrementalUpdate="false" />
</qvto:transformation>
</target>
</project>
The code I use in Java to execute Ant Script is the following one:
File AntFile = new File(this.getClass().getResource("qvto/AntQVTo.xml").getFile());
Project p = new Project();
p.setUserProperty(
"ant.file",
this.getClass().getResource("qvto/AntQVTo.xml").getFile()
);
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, AntFile);
p.executeTarget(p.getDefaultTarget());
The problem when I run my Java code is that it seems that Ant Task is not recognized at all, when I run the following error is returned:
Exception in thread "AWT-EventQueue-0" C:\path\to\AntTask\AntQVTo.xml:5: Problem: failed to create task or type http://www.eclipse.org/qvt/1.0.0/Operational:transformation
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet
I don't have any problem if I execute my Ant Script directly in Eclipse, as this Task is by default defined in the Eclipse Preferences, into Ant->Runtime->Tasks.
The problem could be that Ant Script executed within Java Code isn't run as "Run in the same JRE as project".
I have that Ant Task defined in the plugin.xml which runs the Eclipse Application in the classpath, and also as an extension:
<extension point="org.eclipse.ant.core.antTasks">
<antTask
class="org.eclipse.m2m.internal.qvt.oml.runtime.ant.QvtoAntTransformationTask"
eclipseRuntime="true"
headless="true"
library="libAnt/antTasks.jar"
name="transformation"
uri="http://www.eclipse.org/qvt/1.0.0/Operational"
/>
</extension>
Does anyone know how could I fix my issue?
Thanks in advance and regards.

missing Apache IVY library, Download this library from here - apache and Copy the jar in your ant lib directory and add into class path.
Download the jar and install Ant (e.g., C:\Apps\Tools\apache-ant-1.9).
Download the jar and extract Ivy (e.g., C:\Users\UserName\Downloads\apache-ivy-2.4)
Copy C:\Users\UserName\Downloads\apache-ivy-2.4\ivy-2.4.jar into C:\Apps\Tools\apache-ant-1.9\lib.

Can you try changing
From:
<taskdef name="http://www.eclipse.org/qvt/1.0.0/Operational:transformation" classname="org.eclipse.m2m.internal.qvt.oml.runtime.ant.QvtoAntTransformationTask">
To:
<taskdef name="transformation" classname="org.eclipse.m2m.internal.qvt.oml.runtime.ant.QvtoAntTransformationTask">
And remove the namespace prefix to transformation task/element.

Related

error while cleaning and building javafx app in netbeans, XML document structures must start and end within the same entity

I'm new to xml, and trying to deploy my javafx program, getting to run and clean I've got the following error, and couldn't find any answer regarding the solution thereof, so would appreciate if you helped me:
F:\IT\PROGRAMMING\LJPROJECTS\MyShutDownTheCompProgram\build.xml:67: XML document structures must start and end within the same entity.
The xml code goes as follows:
<?xml version="1.0" encoding="UTF-8"?><!-- You may freely edit this file. See commented blocks below for --><!-- some examples of how to customize the build. --><!-- (If you delete it and reopen the project it will be recreated.) --><!-- By default, only the Clean and Build commands use this build script. --><project name="MyShutDownTheCompProgram" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
<description>Builds, tests, and runs the project MyShutDownTheCompProgram.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. Those of them relevant for JavaFX project are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-jfx-jar: called before FX SDK specific <fx:jar> task
-post-jfx-jar: called after FX SDK specific <fx:jar> task
-pre-jfx-deploy: called before FX SDK specific <fx:deploy> task
-post-jfx-deploy: called after FX SDK specific <fx:deploy> task
-pre-jfx-native: called just after -pre-jfx-deploy if <fx:deploy> runs in native packaging mode
-post-jfx-native: called just after -post-jfx-deploy if <fx:deploy> runs in native packaging mode
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting a HTML postprocessor after javaFX SDK deployment:
<target name="-post-jfx-deploy">
<basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/>
<property name="jfx.deployment.html" location="${jfx.deployment.dir}${file.separator}${jfx.deployment.base}.html"/>
<custompostprocess>
<fileset dir="${jfx.deployment.html}"/>
</custompostprocess>
</target>
Example of calling an Ant task from JavaFX SDK. Note that access to JavaFX SDK Ant tasks must be
initialized; to ensure this is done add the dependence on -check-jfx-sdk-version target:
<target name="-post-jfx-jar" depends="-check-jfx-sdk-version">
<echo message="Calling jar task from JavaFX SDK"/>
<fx:jar ...>
...
</fx:jar>
</target>
For more details about JavaFX SDK Ant tasks go to
http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm
For list of available properties check the files
nbproject/build-impl.xml and nbproject/jfx-impl.xml.
-->
<target name="-post-jfx-deploy">
<fx:deploy width="${javafx.run.width}" height="${javafx.run.height}"
nativeBundles="all"
outdir="${basedir}/${dist.dir}" outfile="${application.title}">
<fx:application name="${application.title}"
mainClass="${javafx.main.class}"/>
<fx:resources>
<fx:fileset dir="${basedir}/${dist.dir}"
includes="*.jar"/>
</fx:resources>
<fx:info title="${application.title}"
vendor="${application.vendor}"/>
</fx:deploy>
</target>
You must have to end the tags you started before.
You have to use </project> at end of your XML file.
Open build.xml file from your Files tab. Usually there put two tags with the same name, and does the same job.The first one is <build> and the second is <defend> you should delete these extra two tags.

Failed due to exception from main class in others computers

i developed a JavaFX application and i deployed as .exe , and when i install at my computer everything works fine. but after i install .exe to another computer and i try to open app , it shows me an error:
Failed due to Exception from main class.
Can someone please help me with this error?
build.fxml
<?xml version="1.0" encoding="UTF-8"?><!-- You may freely edit this file. See commented blocks below for --><!-- some examples of how to customize the build. --><!-- (If you delete it and reopen the project it will be recreated.) --><!-- By default, only the Clean and Build commands use this build script. --><project name="Main" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
<description>Builds, tests, and runs the project Main.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. Those of them relevant for JavaFX project are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-jfx-jar: called before FX SDK specific <fx:jar> task
-post-jfx-jar: called after FX SDK specific <fx:jar> task
-pre-jfx-deploy: called before FX SDK specific <fx:deploy> task
-post-jfx-deploy: called after FX SDK specific <fx:deploy> task
-pre-jfx-native: called just after -pre-jfx-deploy if <fx:deploy> runs in native packaging mode
-post-jfx-native: called just after -post-jfx-deploy if <fx:deploy> runs in native packaging mode
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting a HTML postprocessor after javaFX SDK deployment:
<target name="-post-jfx-deploy">
<basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/>
<property name="jfx.deployment.html" location="${jfx.deployment.dir}${file.separator}${jfx.deployment.base}.html"/>
<custompostprocess>
<fileset dir="${jfx.deployment.html}"/>
</custompostprocess>
</target>
Example of calling an Ant task from JavaFX SDK. Note that access to JavaFX SDK Ant tasks must be
initialized; to ensure this is done add the dependence on -check-jfx-sdk-version target:
<target name="-post-jfx-jar" depends="-check-jfx-sdk-version">
<echo message="Calling jar task from JavaFX SDK"/>
<fx:jar ...>
...
</fx:jar>
</target>
For more details about JavaFX SDK Ant tasks go to
http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm
For list of available properties check the files
nbproject/build-impl.xml and nbproject/jfx-impl.xml.
-->
</project>
I also tried to change build.fxml to this but still the same:
<?xml version="1.0" encoding="UTF-8"?><!-- You may freely edit this file. See commented blocks below for --><!-- some examples of how to customize the build. --><!-- (If you delete it and reopen the project it will be recreated.) --><!-- By default, only the Clean and Build commands use this build script. --><project name="AutoMekanikAdmin" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
<description>Builds, tests, and runs the project AutoMekanikAdmin.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. Those of them relevant for JavaFX project are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-jfx-jar: called before FX SDK specific <fx:jar> task
-post-jfx-jar: called after FX SDK specific <fx:jar> task
-pre-jfx-deploy: called before FX SDK specific <fx:deploy> task
-post-jfx-deploy: called after FX SDK specific <fx:deploy> task
-pre-jfx-native: called just after -pre-jfx-deploy if <fx:deploy> runs in native packaging mode
-post-jfx-native: called just after -post-jfx-deploy if <fx:deploy> runs in native packaging mode
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting a HTML postprocessor after javaFX SDK deployment:
<target name="-post-jfx-deploy">
<basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/>
<property name="jfx.deployment.html" location="${jfx.deployment.dir}${file.separator}${jfx.deployment.base}.html"/>
<custompostprocess>
<fileset dir="${jfx.deployment.html}"/>
</custompostprocess>
</target>
Example of calling an Ant task from JavaFX SDK. Note that access to JavaFX SDK Ant tasks must be
initialized; to ensure this is done add the dependence on -check-jfx-sdk-version target:
<target name="-post-jfx-jar" depends="-check-jfx-sdk-version">
<echo message="Calling jar task from JavaFX SDK"/>
<fx:jar ...>
...
</fx:jar>
</target>
For more details about JavaFX SDK Ant tasks go to
http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm
For list of available properties check the files
nbproject/build-impl.xml and nbproject/jfx-impl.xml.
-->
<target name="post-jfx-deploy">
<fx:deploy verbose="true" nativeBundles="exe" outdir="${basedir}/${dist.dir}" outfile="${application.title}">
<fx:application name="${application.title}" mainClass="${javafx.main.class}" />
<fx:resources>
<fx:fileset dir="${basedir}/${dist.dir}" include="*.jar"/>
<fx:fileset dir="${basedir}/${dist.dir}" include=";ib/*.jar"/>
</fx:resources>
<fx:info title="${application.title}" vendor="${application.vendor}" />
<fx:info>
<fx:icon href="${basedir}/icon.ico"></fx:icon>
</fx:info>
<fx:preferences shortcut="true" />
</fx:deploy>
</target>
did you use any VM parameters while building? This SE post comes up when searching the error:JavaFX failed due to exception in main class.
try running the executable and the jar from the console, for debugging:
What is the exception? Try running the executable from the console and try running the executable jar from the console with java -jar . And post the results as part of your question.
running from console
This is java problem. If you don't add java to your exe bundle, then application use system java. You can add java to your exe bundle. Then, application use that java. If you use to create exe with ant then add this parameter in build.xml;
<javac includeantruntime="false" source="1.8" target="1.8" srcdir="build/src" destdir="build/classes" encoding="Cp1252">
<classpath>
<fileset dir="build/libs">
<include name="*"/>
</fileset>
</classpath>
</javac>
The problem was that these other computers didnt had JavaJDK installed , but they had only JavaJRE. So i executed jar file from CMD java -jar , and while it was executed it created database tables , that it should to .

Exclude a file or package from the Clover report using ant build script

I am using a short ant script to generate my Clover coverage report. I want to exclude certain source files from the report. The code is already fully instrumented, it's not feasible for me to exclude the file during instrumentation.
Excerpt of the ant build xml (trimmed):
<project name="Clover Coverage" default="clover.report" basedir="${basedir}">
<target name="clover.report">
<clover-report initstring="${cloverdb}" >
<current outfile="${reportdir}" title="${title}" >
<format type="html"/>
<sourcepath>
<pathelement path="${srcdir1}"/>
</sourcepath>
</current>
</clover-report>
</target>
</project>
I've tried to exclude this using fileset, but when I do this, Clover gives an error message saying that no coverage info could be found. But if I remove the fileset then it works fine.
My attempted fix that doesn't work:
<current outfile="${reportdir}" title="${title}" >
<format type="html"/>
<fileset dir="${srcdir1}">
<exclude name="**/ExcludeThisClass.java"/>
</fileset>
<sourcepath>
<pathelement path="${srcdir1}"/>
</sourcepath>
</current>
Is the exclusion of files from the Clover report not possible?
Please run your Ant with debug logging (ant -d). The <clover-report> task should print more details then. The most probably you instrumented and/or executed your source code not at once but in several build/test sessions.
And it's probable that Clover rejected some of recording files because it found them out of date.
See these knowledge base articles:
https://confluence.atlassian.com/cloverkb/ignoring-coverage-recording-files-300816998.html
https://confluence.atlassian.com/cloverkb/no-coverage-recordings-found-no-report-will-be-generated-611812757.html

FindBugs scanning external jars

I am using the following link to create an ant script to run findbugs on a web application:
Chapter 6. Using the FindBugs™ Ant task
I am setting the auxClasspath parameter to my jars folder.
But when i run the task using ant findbugs from the command prompt, it takes a very long time(~45 minutes) and the output xml contains analysis of the jars in the auxClasspath as well as my source code.
I want only my source code to be analyzed.
This is the code in my build.xml:
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>
<property name="findbugs.home" value="C:/Software/FindBugs" />
<target name="findbugs" >
<echo message="Finding Bugs From ${basedir}/src/java"/>
<findbugs home="${findbugs.home}"
output="xml:withMessages"
outputFile="${basedir}\findbugs.xml"
stylesheet="fancy-hist.xsl"
timeout="6000000"
jvmargs="-Xmx1200m">
<auxClasspath path="${basedir}/Jars/*.jar" />
<sourcePath path="${basedir}/src/java"/>
<class location="${basedir}/build/myApp-1.0.jar" />
</findbugs>
</target>
I have added findbugs-ant.jar to lib of my ant installation.
The findbugs directory exists.
Other information:
IDE: Netbeans 7.3
OS: Microsoft Windows XP
Ant Version: 1.8.4
Find Bugs Version: 2.0.2
Update
If i leave out this line:
<auxClasspath path="${basedir}/Jars/*.jar" />
I get my desired output(i.e. analysis of only my source code).
But it raises a warning:
[findbugs] The following classes needed for analysis were missing:
[findbugs] javax.servlet.http.HttpServlet
[findbugs] javax.servlet.http.HttpServletRequestWrapper
[list continues]....
Any idea, why find bugs is analyzing jars which it should not analyze(according to the documentation)
I tried to track which Jars are being used in the source code.
In the findbugs xml output, i found a line: ${basedir}\Jars\antlr-2.7.2.jar
The findbugs analysis report showed that all the other jars(except antlr-2.7.2.jar) were missing.
There were no more auxClassPath entries. Solved this by specifying each class path entry in a different line.
If anyone has any better ideas, kindly contribute.
I used the following auxClasspath settings to pull in all my jars in my lib folder and all the jars in directories under my lib folder.
<auxClasspath>
<fileset dir="${lib.dir}">
<include name="*/**"/>
<include name="*.jar"/>
</fileset>
</auxClasspath>
Place it inside the findbugs tag.
Try to remove this line
<class location="${basedir}/build/myApp-1.0.jar" />
Now to try to analyze both jar and source files, that's it takes so long time.
This line is needed and used to find a class if it encounters during analysis of your source.
<auxClasspath path="${basedir}/Jars/*.jar" />
Maybe to can limit it to only really needed jars, not all in the folder.

FindBugs refuses to find bcel jar on classpath

For the life of me, I am trying to get FindBugs (2.0.1) to run as part of my command-line Ant build. I downloaded the FindBugs JAR and extracted it to /home/myuser/java/repo/umd/findbugs/2.0.1/findbugs-2.0.1:
As you can see in the screenshot, under /home/myuser/java/repo/umd/findbugs/2.0.1/findbugs-2.0.1/lib there is a JAR called bcel-1.0.jar, and if you open it, you can see that I have drilled down to a class called org.apache.bcel.classfile.ClassFormatException. Hold that thought.
I then copied /home/myuser/java/repo/umd/findbugs/2.0.1/findbugs-2.0.1/lib/findbugs-ant.jar to ${env.ANT_HOME}/lib to make it accessible to the version of Ant that is ran from the command-line (instead of the Ant instance that comes built-into Eclipse).
My project directory structure is as follows:
/home/myuser/sandbox/workbench/eclipse/workspace/myapp/
src/
main/
java/
test/
java/
build/
build.xml
build.properties
gen/
bin/
main/ --> where all main Java class files compiled to
test/ --> where all test Java class files compiled to
audits/
qual/
staging/
Inside build.xml:
<project name="myapp-build" basedir=".." default="package"
xmlns:fb="antlib:edu.umd.cs.findbugs">
<path id="findbugs.source.path">
<fileset dir="src/main/java">
<include name="**.*java"/>
</fileset>
<fileset dir="src/main/test">
<include name="**.*java"/>
</fileset>
</path>
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
uri="antlib:edu.umd.cs.findbugs"/>
<!-- Other Ant target omitted for brevity. -->
<target name="run-findbugs">
<!-- Create a temp JAR that FindBugs can use for analysis. -->
<property name="fb.tmp.jar" value="gen/staging/${ant.project.name}-findbugs-temp.jar"/>
<echo message="Creating ${fb.tmp.jar} for FindBugs."/>
<jar destfile="gen/staging/${ant.project.name}-findbugs-temp.jar">
<fileset dir="gen/bin/main" includes="**/*.class"/>
<fileset dir="gen/bin/test" includes="**/*.class"/>
</jar>
<echo message="Conducting code quality tests with FindBugs."/>
<fb:findbugs home="/home/myuser/java/repo/umd/findbugs/2.0.1/findbugs-2.0.1"
output="html" outputFile="gen/audits/qual/findbugs.html" stylesheet="fancy-hist.xsl" failOnError="true">
<sourcePath refid="findbugs.source.path"/>
<class location="${fb.tmp.jar}"/>
</fb:findbugs>
</target>
<target name="echoMsg" depends="run-findbugs">
<echo message="The build is still alive!!!"/>
</target>
</project>
But when I run ant -buildfile build.xml echoMsg from the command-line, I get an error in FindBugs:
run-findbugs:
[echo] Creating gen/staging/myapp-build-findbugs-temp.jar for FindBugs.
[jar] Building jar: /home/myuser/sandbox/workbench/eclipse/workspace/myapp/gen/staging/myapp-build-findbugs-temp.jar
[echo] Conducting code quality tests with FindBugs.
[fb:findbugs] Executing findbugs from ant task
[fb:findbugs] Running FindBugs...
[fb:findbugs] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/bcel/classfile/ClassFormatException
[fb:findbugs] Caused by: java.lang.ClassNotFoundException: org.apache.bcel.classfile.ClassFormatException
[fb:findbugs] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[fb:findbugs] at java.security.AccessController.doPrivileged(Native Method)
[fb:findbugs] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[fb:findbugs] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[fb:findbugs] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[fb:findbugs] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[fb:findbugs] Could not find the main class: edu.umd.cs.findbugs.FindBugs2. Program will exit.
[fb:findbugs] Java Result: 1
[fb:findbugs] Output saved to gen/audits/qual/findbugs.html
echoMsg:
[echo] The build is still alive!!!
Here's what has me amazed:
Even with failOnError="true", FindBugs is not halting the build even when this runtime exception is encountered
The last piece of output "Output saved to gen/audits/qual/findbugs.html" is a lie! There is nothing in gen/audits/qual!
The bcel-1.0.jar is absolutely under FindBugs home, just like every other JAR in the lib/ directory.
Please note: the findbugs-ant.jar is definitely copied to ANT_HOME/lib; otherwise I would be getting a failed build complaining that it couldn't find the Ant tasks. As a sanity check, I went ahead and did this (I deleted the findbugs-ant.jar from ANT_HOME/lib and got a failed build). This build doesn't fail (it succeeds!). It just doesn't run findbugs.
Can anyone spot what is going on here? Thanks in advance!
You can debug where BCEL is being loaded from using the -verbose:class argument to the jvm.
To pass this argument to the jvm running findbugs, use the jvmargs flag on the find bugs plugin
jvmargs
Optional attribute. It specifies any arguments that should be
passed to the Java virtual machine used to run FindBugs. You may need
to use this attribute to specify flags to increase the amount of
memory the JVM may use if you are analyzing a very large program.
How did you populate the find bugs lib jar? When I download findbugs.zip, I get a lib directory which looks very different than what you show. In particular, mine contains a bcel with a version of 5.3, not 1.0 as you show.
Funny thing because I am using the same version of Findbugs and the jar file is named bcel.jar not bcel-1.0.jar. I am also running Findbugs from an Ant script. As crazy as it might sound, try to download the Findbugs once again, unpack it in the place of your current one and run your script once again.
My guess is that you actually have BCEL in the classpath twice. And the file is being loaded from the jar outside the FindBugs library. Then, when FindBugs tries to load the jar, it finds the BCEL in the FindBugs library and cannot load it, because it's already loaded.
The solution would be to find where else BCEL exists in the classpath and remove it.
You might have to define a AuxClasspath to include the classpath that your <javac> task used when compiling your class files.
You don't show how the compile took place, so I am assuming your created a compile.classapath classpath reference:
<javac destdir="gen/bin/main"
srcdir="src/main/java"
classpathref="compile.classpath"/>
<fb:findbugs home="/home/myuser/java/repo/umd/findbugs/2.0.1/findbugs-2.0.1"
output="html" outputFile="gen/audits/qual/findbugs.html" stylesheet="fancy-hist.xsl" failOnError="true">
<auxClasspath refid="compile.classpath"/>
<sourcePath refid="findbugs.source.path"/>
<class location="${fb.tmp.jar}"/>
</fb:findbugs>
I don't see from your Ant script that bcel is landing on any classpath that the findbugs task would be able to load it from. You might want to try making your taskdef explicitly include everything findbugs needs.
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
uri="antlib:edu.umd.cs.findbugs">
<classpath>
<fileset dir="/home/java/repo/umd/findbugs/2.0.1/findbugs-2.0.1">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
most classpath problems you can debug with tattle. it will report you all jars in your project. all duplicated classes etc. saved me a lot of time.
there is also ant task ready: http://docs.jboss.org/tattletale/userguide/1.2/en-US/html/ant.html

Categories

Resources