Bug 112830 - Warning "couldn't find aspectjrt.jar on classpath"
Summary: Warning "couldn't find aspectjrt.jar on classpath"
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M4   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 1.5.0RC1   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-17 14:01 EDT by Eduardo Rocha CLA
Modified: 2017-11-17 19:01 EST (History)
5 users (show)

See Also:


Attachments
aspectj error (194.99 KB, image/png)
2017-11-17 18:36 EST, Jay malonzo CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eduardo Rocha CLA 2005-10-17 14:01:44 EDT
The compiler makes this warning if "aspectrt.jar" file has a different name like
"aspectrt-1.3.jar", which is the case when compiling with maven.
Comment 1 Wes Isberg CLA 2005-10-21 14:22:37 EDT
I thought we fixed this last year.  Has no one been using AspectJ with Maven?

AjBuildManager.checkRtJar(..) is looking for "aspectjrt.jar", not
  
  if (p.isFile() && p.getName().startsWith("aspectjrt") 
      && p.getName().toLowerCase().endsWith(".jar")) {

AjcTask.findAspectjtoolsJar(..) has more specific logic to find versioned jars.
 Neither would select the correct version from a classpath.
Comment 2 Eduardo Rocha CLA 2005-10-21 14:46:37 EDT
Wes,

This warning occurs if I am compiling with ajc command line, ant or maven, the
three of them.

It does not seem that either classes (AjBuildManager and AjcTask) is giving the
warning.

AjBuildManager has to do with ajdt, and not with command line/ant/maven.

AjcTask is used by ant and maven, but not with the command line, right? Either
way, AjcTask.findAspectjtoolsJar(..) find aspectjtools.jar, and not
aspecjrt.jar, which is the source of this issue.
Comment 3 Adrian Colyer CLA 2005-10-28 09:48:28 EDT
needs resolving for RC1
Comment 4 Adrian Colyer CLA 2005-11-08 11:42:37 EST
I've just commited a fix for this to tolerate variations on aspectjrt.jar as proposed by Wes. Will be available 
in next published developer build on aspectj downloads page. Let me know how this works out with 
Maven... should be ok for you now I hope.
Comment 5 Eduardo Rocha CLA 2005-11-10 08:59:21 EST
It's OK for aspectj-DEVELOPMENT-20051110113650.jar.
Comment 6 Matthew Adams CLA 2012-02-10 11:53:28 EST
Ok, I'm seeing this using aspectj-maven-plugin 1.4 with aspectjrt & aspectjtools 1.6.12 & maven 3.0.3:

[INFO] --- aspectj-maven-plugin:1.4:compile (default) @ configuration ---
[WARNING] couldn't find aspectjrt.jar on classpath, checked: C:\dev\jdks\...

Parent pom <pluginManagement> contains:

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>aspectj-maven-plugin</artifactId>
                    <version>1.4</version>
                    <dependencies>
                        <!-- Avoids "bad version" warning -->
                        <dependency>
                            <groupId>org.aspectj</groupId>
                            <artifactId>aspectjrt</artifactId>
                            <version>1.6.12</version>
                        </dependency>
                        <dependency>
                            <groupId>org.aspectj</groupId>
                            <artifactId>aspectjtools</artifactId>
                            <version>1.6.12</version>
                        </dependency>
                    </dependencies>
                </plugin>

Parent pom <plugins> contains:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>UTF-8</encoding>
                    <complianceLevel>${java.version}</complianceLevel>
                    <preserveAllLocals>true</preserveAllLocals>
                    <showWeaveInfo>false</showWeaveInfo>
                    <aspectLibraries>
                    	<aspectLibrary>
                    		<groupId>org.springframework</groupId>
                    		<artifactId>spring-aspects</artifactId>
                    	</aspectLibrary>
                    </aspectLibraries>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Any ideas?
Comment 7 Pankesh C CLA 2012-10-11 08:26:40 EDT
We're compiling with ant task and see the same error even though the jar is present in the classpath

[aspectj:iajc] warning couldn't find aspectjrt.jar on classpath, checked: D:\cc_tools\tools\tpv\was\7.0\java\jre\lib\vm.jar;D:\cc_tools\tools\tpv\was\7.0\java\jre\lib\annotation.jar;D:\cc_tools\tools\tpv\was\7.0\java\jre\lib\beans.jar;D:\cc_tools\tools\tpv\was\7.0\java\jre\lib\java.util.jar;
.......
Z:\my_module\module\dependencies\lib\main\SUI_Common_UI.jar;Z:\my_module\module\dependencies\lib\main\com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar;Z:\my_module\module\dependencies\lib\main\com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar;Z:\my_module\module\dependencies\lib\main\com.springsource.org.aspectj.tools-1.6.6.RELEASE.jar;


Is there any way/place to define the name of this jar? How do i get around this? We're using aspectj jars rebundled by spring.

I also see the same issue when i use the 1.7.0 version.
Comment 8 Andrew Clement CLA 2012-10-11 12:26:45 EDT
the code was fixed to allow for 'org.aspectj.runtime' anywhere in the jar name - that was changed years ago but you need to update to a version with the fix in.

I notice you are on 1.6.8 weaver and 1.6.6 tools.  You should stick to just one version - and I *think* if you update to 1.6.8 tools you will pickup the change that will avoid this message. (Or you could jump to 1.6.12, the most recent 1.6 fix level).
Comment 9 Jay malonzo CLA 2017-11-17 18:36:49 EST
Created attachment 271540 [details]
aspectj error
Comment 10 Jay malonzo CLA 2017-11-17 18:37:38 EST
error when executing this in cmd line
mvn clean test jacoco:report -DskipITs=true

error is as attached
Comment 11 Andrew Clement CLA 2017-11-17 19:01:59 EST
The error in that picture says it cant find the JoinPoint class which does come from the runtime module. On the classpath it shows in the error I don't see the runtime module (I don't think it is saying it must be called aspectjrt.jar but the runtime needs to be there somewhere so the classes can be found).