You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Roland Piazzi <ro...@gmx.net> on 2007/10/11 15:28:31 UTC

searching help for: class org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter can not be found

Hi!

I try to run the aspectj-compiler with ant but it gives me the following
error:

A class needed by class org.aspectj.tools.ant.taskdefs.compilers.Ajc can not
be found: 
org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter


This class is contained within the file ant.jar which also is in a
lib-folder which is added to the path.

I don't know how to go on, hope that someone can help me about this?

I attach my build file... http://www.nabble.com/file/p13155870/build.xml
build.xml 

Thanks, Roland
-- 
View this message in context: http://www.nabble.com/searching-help-for%3A-class-org-apache-tools-ant-taskdefs-compilers-DefaultCompilerAdapter-can-not-be-found-tf4607267.html#a13155870
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: searching help for: class org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter can not be found

Posted by rolando80 <ro...@hotmail.com>.
Hi Peter and all!

when i run this it doesn't work. there is the error:

A class needed by class org.aspectj.tools.ant.taskdefs.Ajc10 cannot be
found: org/apache/tools/ant/taskdefs/MatchingTask

but the class MatchingTask is in ant.jar which is on the classpath and
quoted directly.

could it be that i make some mistake in setting the classpath within
build.xml

again I append my build.xml

hope that someone could help...

http://www.nabble.com/file/p13585386/build.xml build.xml 


Peter Reilly-2 wrote:
> 
> I downloaded aspectj, it seems that there been changes
> since 1.0 - check the doc.
> Placing all the jar files in $EXAMPLE/lib, the following works
> for me:
> <project default="run">
>   <target name="run">
>     <taskdef name="ajc"
>              classname="org.aspectj.tools.ant.taskdefs.Ajc10">
>       <classpath>
>         <fileset dir="lib" includes="*.jar"/>
>       </classpath>
>     </taskdef>
>     <mkdir dir="classes"/>
>     <ajc srcdir="src" destdir="classes">
>       <classpath>
>         <fileset dir="lib" includes="*.jar"/>
>       </classpath>
>     </ajc>
>   </target>
> </project>
> 
> 
> Peter
> 
> 
> On 10/23/07, Dominique Devienne <dd...@gmail.com> wrote:
>> On 10/23/07, rolando80 <ro...@hotmail.com> wrote:
>> > I've tried the possibilities proposed by you but it didn't work.
>>
>> Bummer.
>>
>> > Could it be that its because the class DefaultCompilerAdapter is within
>> > ant.jar and aspectjtools.jar?
>>
>> It rarely a good idea to have duplicate classes in jar. Have you tried
>> removing the duplicate class from aspectjtools.jar. BTW, have you
>> asked a question on the aspectj forum?
>>
>> > But i can't leave aspectjtools.jar because it contains the class Ajc
>> which
>> > is required.
>>
>> There's a switch of the JVM which allows you to see a very verbose
>> output of all class loading activities, showing you precisely where
>> classes are loaded from.
>>
>> Not much to go on, I know, sorry. --DD
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/searching-help-for%3A-class-org-apache-tools-ant-taskdefs-compilers-DefaultCompilerAdapter-can-not-be-found-tf4607267.html#a13585386
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: searching help for: class org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter can not be found

Posted by Peter Reilly <pe...@gmail.com>.
I downloaded aspectj, it seems that there been changes
since 1.0 - check the doc.
Placing all the jar files in $EXAMPLE/lib, the following works
for me:
<project default="run">
  <target name="run">
    <taskdef name="ajc"
             classname="org.aspectj.tools.ant.taskdefs.Ajc10">
      <classpath>
        <fileset dir="lib" includes="*.jar"/>
      </classpath>
    </taskdef>
    <mkdir dir="classes"/>
    <ajc srcdir="src" destdir="classes">
      <classpath>
        <fileset dir="lib" includes="*.jar"/>
      </classpath>
    </ajc>
  </target>
</project>


Peter


On 10/23/07, Dominique Devienne <dd...@gmail.com> wrote:
> On 10/23/07, rolando80 <ro...@hotmail.com> wrote:
> > I've tried the possibilities proposed by you but it didn't work.
>
> Bummer.
>
> > Could it be that its because the class DefaultCompilerAdapter is within
> > ant.jar and aspectjtools.jar?
>
> It rarely a good idea to have duplicate classes in jar. Have you tried
> removing the duplicate class from aspectjtools.jar. BTW, have you
> asked a question on the aspectj forum?
>
> > But i can't leave aspectjtools.jar because it contains the class Ajc which
> > is required.
>
> There's a switch of the JVM which allows you to see a very verbose
> output of all class loading activities, showing you precisely where
> classes are loaded from.
>
> Not much to go on, I know, sorry. --DD
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: searching help for: class org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter can not be found

Posted by Dominique Devienne <dd...@gmail.com>.
On 10/23/07, rolando80 <ro...@hotmail.com> wrote:
> I've tried the possibilities proposed by you but it didn't work.

Bummer.

> Could it be that its because the class DefaultCompilerAdapter is within
> ant.jar and aspectjtools.jar?

It rarely a good idea to have duplicate classes in jar. Have you tried
removing the duplicate class from aspectjtools.jar. BTW, have you
asked a question on the aspectj forum?

> But i can't leave aspectjtools.jar because it contains the class Ajc which
> is required.

There's a switch of the JVM which allows you to see a very verbose
output of all class loading activities, showing you precisely where
classes are loaded from.

Not much to go on, I know, sorry. --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: searching help for: class org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter can not be found

Posted by rolando80 <ro...@hotmail.com>.
I've tried the possibilities proposed by you but it didn't work.

Could it be that its because the class DefaultCompilerAdapter is within
ant.jar and aspectjtools.jar?

But i can't leave aspectjtools.jar because it contains the class Ajc which
is required.

Can anyone help?


Dominique Devienne-2 wrote:
> 
> On 10/11/07, Roland Piazzi <ro...@gmx.net> wrote:
>> I try to run the aspectj-compiler with ant but it gives me the following
>> error:
>>
>> A class needed by class org.aspectj.tools.ant.taskdefs.compilers.Ajc can
>> not
>> be found:
>> org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter
>>
>>
>> This class is contained within the file ant.jar which also is in a
>> lib-folder which is added to the path.
>>
>> I don't know how to go on, hope that someone can help me about this?
>>
>> I attach my build file... http://www.nabble.com/file/p13155870/build.xml
>> build.xml
> 
> Sounds like a classloader issue (just a guess). You don't specify a
> classpath when you taskdef Ajc, which implies that it's on the Java
> classpath, while Ant's classes are loaded from a classloader "higher"
> level classloader.
> 
> <taskdef name="ajc"
> classname="org.aspectj.tools.ant.taskdefs.compilers.Ajc">
>      </taskdef>
> 
> I thought Ant set the context class loader to its classloader, so Ajc
> should be able to see the Ant classes... Are you sure you are not
> mixing up several versions of Ant on the classpath?
> 
> Try running Ant with the switch to disables the use of a global
> CLASSPATH, and explicitly tell Ant where the jar for Ajc is, either:
> (1) in the taskdef, (2) via -lib on the command line, or (3) by
> putting the jar in $ANT_HOME/lib. If none of these methods work,
> that's a more difficult issue likely related to a bad classpath (or
> issues in Ajc). --DD
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/searching-help-for%3A-class-org-apache-tools-ant-taskdefs-compilers-DefaultCompilerAdapter-can-not-be-found-tf4607267.html#a13365206
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: searching help for: class org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter can not be found

Posted by Dominique Devienne <dd...@gmail.com>.
On 10/11/07, Roland Piazzi <ro...@gmx.net> wrote:
> I try to run the aspectj-compiler with ant but it gives me the following
> error:
>
> A class needed by class org.aspectj.tools.ant.taskdefs.compilers.Ajc can not
> be found:
> org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter
>
>
> This class is contained within the file ant.jar which also is in a
> lib-folder which is added to the path.
>
> I don't know how to go on, hope that someone can help me about this?
>
> I attach my build file... http://www.nabble.com/file/p13155870/build.xml
> build.xml

Sounds like a classloader issue (just a guess). You don't specify a
classpath when you taskdef Ajc, which implies that it's on the Java
classpath, while Ant's classes are loaded from a classloader "higher"
level classloader.

<taskdef name="ajc" classname="org.aspectj.tools.ant.taskdefs.compilers.Ajc">
     </taskdef>

I thought Ant set the context class loader to its classloader, so Ajc
should be able to see the Ant classes... Are you sure you are not
mixing up several versions of Ant on the classpath?

Try running Ant with the switch to disables the use of a global
CLASSPATH, and explicitly tell Ant where the jar for Ajc is, either:
(1) in the taskdef, (2) via -lib on the command line, or (3) by
putting the jar in $ANT_HOME/lib. If none of these methods work,
that's a more difficult issue likely related to a bad classpath (or
issues in Ajc). --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org