Bug 100813

Summary: kdevelop applies CLASSPATH to cd instead of ant on a java Project
Product: [Applications] kdevelop Reporter: Stephen Leaf <smileaf>
Component: generalAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: greg_g
Priority: NOR    
Version: 3.1.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Move the classpath to the right hand side.

Description Stephen Leaf 2005-03-04 14:38:24 UTC
Version:           3.1.2 (using KDE 3.4.0, Gentoo)
Compiler:          gcc version 3.3.5 (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)
OS:                Linux (i686) release 2.6.10-gentoo-r6

I'm trying to build a Kde/Qt Java program and even using the example code and setting the correct class path the compile still blows up saying it can't find org.kde.qt
then I look at the command that's being ran:

CLASSPATH=/usr/kde/3.4/lib/java/qtjava.jar:/usr/kde/3.4/lib/java/koala.jar cd /home/smileaf/Programs/jortage && ant dist -buildfile build.xml -quiet 


the problem should be very easy to pick out.
CLASSPATH is being set.. but only for the cd Command.

Solution?

cd /home/smileaf/Programs/jortage && CLASSPATH=/usr/kde/3.4/lib/java/qtjava.jar:/usr/kde/3.4/lib/java/koala.jar ant dist -buildfile build.xml -quiet 

cd .. THEN set the CLASSPATH and execute ant.
Comment 1 Douglas Russell 2005-07-28 18:24:15 UTC
Wow, what a schoolboy error this is. :-)
I can confirm that it is an accurate report.

For anyone that isn't wised up on ant you can get around this temporarily by editing your build.xml file. So, instead (or as well as, so that it works when kdevelop gets fixed) of setting your classpath in the classpath tab, edit build.xml and put in a property line like this:
<property name="classpath"  location="/home/douglas/sunxacml-1.2/src/sunxacml/build/classes" />
but obviously putting in your classpaths instead of mine and also edit the javac line with a classpath element so it reads something like this:
<javac srcdir="${src}" destdir="${build}" classpath="${classpath}"/>

Comment 2 Douglas Russell 2005-07-30 18:39:34 UTC
Created attachment 12002 [details]
Move the classpath to the right hand side.

This patch simply moves the CLASSPATH="stuff" to the right hand side of the &&
following the cd command.
Comment 3 Gregorio Guidi 2005-10-18 17:25:03 UTC
Can this be applied? Thanks.
Comment 4 Matt Rogers 2005-10-18 18:58:23 UTC
SVN commit 471757 by mattr:

Fix bug 100813. put CLASSPATH in the right place


BUG: 100813


 M  +2 -2      antprojectpart.cpp  


--- branches/KDE/3.5/kdevelop/buildtools/ant/antprojectpart.cpp #471756:471757
@@ -431,7 +431,7 @@
 
 void AntProjectPart::ant(const QString &target)
 {
-  QString cmd = "%0 cd %1 && ant %2 -buildfile %3 %4 %5";
+  QString cmd = "cd %0 && %1 ant %2 -buildfile %3 %4 %5";
 
   QString verb = "";
   switch (m_antOptions.m_verbosity)
@@ -457,7 +457,7 @@
   if (!m_classPath.count() == 0)
     cp = "CLASSPATH="+m_classPath.join(":");
   
-  makeFrontend()->queueCommand(m_projectDirectory, cmd.arg(cp).arg(m_projectDirectory).arg(target).arg(m_antOptions.m_buildXML).arg(verb).arg(options));
+  makeFrontend()->queueCommand(m_projectDirectory, cmd.arg(m_projectDirectory).arg(cp).arg(target).arg(m_antOptions.m_buildXML).arg(verb).arg(options));
 }