java 类路径错误:无法找到 org.aspectj.lang.JoinPoint
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14433569/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
classpath error: unable to find org.aspectj.lang.JoinPoint
提问by Archit Thakur
I am using maven to build my project. It was compiling successfully earlier. It has started to give an error when I do mvn clean install
.
我正在使用 maven 来构建我的项目。之前编译成功。当我这样做时它已经开始出现错误mvn clean install
。
[ERROR] classpath error: unable to find org.aspectj.lang.JoinPoint (check that aspectjrt.jar is in your classpath)
[ERROR] classpath error: unable to find org.aspectj.lang.JoinPoint (check that aspectjrt.jar is in your classpath)
Below is my pom.xml
下面是我的 pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.guavus</groupId>
<artifactId>Exporter</artifactId>
<version>atlas2.1</version>
<packaging>jar</packaging>
<name>Exporter</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<aspectj.version>1.6.10</aspectj.version>
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-2</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.1</version>
<configuration>
<aggregate>true</aggregate>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.4</version>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
</configuration>
</plugin>
<!--
plugin> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.6</version> </plugin
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.5</version>
<configuration>
<rulesets>
<ruleset>/rulesets/basic.xml</ruleset>
<ruleset>/rulesets/design.xml</ruleset>
<ruleset>/rulesets/logging-java.xml</ruleset>
</rulesets>
<targetJdk>1.5</targetJdk>
<format>xml</format>
<linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding>
<minimumTokens>100</minimumTokens>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.3.1</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<aspectDirectory>src/main/aspect</aspectDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal> <!-- use this goal to weave all your main classes -->
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<!-- local snapshots -->
<dependency>
<groupId>com.guavus</groupId>
<artifactId>CubeCreator</artifactId>
<version>atlas2.1</version>
</dependency>
<dependency>
<groupId>com.guavus</groupId>
<artifactId>ConcurrentFlows</artifactId>
<version>atlas2.1</version>
</dependency>
<dependency>
<groupId>ps</groupId>
<artifactId>thriftGenerated</artifactId>
<version>atlas2.1</version>
</dependency>
<!-- local snapshots -->
<!-- local 3rd Party -->
<dependency>
<groupId>apache</groupId>
<artifactId>libthrift</artifactId>
<version>0.5.0</version>
</dependency>
<!-- local 3rd Party -->
<!-- remote 3rd Party -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>0.20.203.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.7.1</version>
</dependency>
<!-- remote 3rd Party -->
<!-- test libs -->
<!-- test libs -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
</project>
采纳答案by Duncan Jones
I would guess you are missing a dependency? Some Googlingsuggests you might need to import:
我猜你错过了一个依赖?一些谷歌搜索建议您可能需要导入:
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.5.4</version>
</dependency>
Note that 1.5.4
is the latest version as reported by: http://mvnrepository.com/artifact/aspectj/aspectjrt
请注意,这1.5.4
是报告的最新版本:http: //mvnrepository.com/artifact/aspectj/aspectjrt
回答by Samuel EUSTACHI
It seems that this comes from
这似乎来自
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
Did you by change recently changed the following line ?
您最近是否通过更改更改了以下行?
<aspectj.version>1.6.10</aspectj.version>
回答by Lucky
I got the same error,
我得到了同样的错误,
[ERROR] error classpath error: unable to find org.aspectj.lang.JoinPoint (check that aspectjrt.jar is in your classpath)
The <plugin>
tag has aspectj-maven-plugin
included when it tries to run the plugin the dependency is not found which is the aspectjrt.jar file. If you are using the aspectj-maven-plugin then you need to add the following dependency in your pom.xml,
当它尝试运行插件时,该<plugin>
标签已aspectj-maven-plugin
包含未找到依赖项,即 aspectjrt.jar 文件。如果您使用的是 aspectj-maven-plugin,那么您需要在 pom.xml 中添加以下依赖项,
<!-- AspectJ -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
where the aspectj.version
is mentioned in the tag as,
在aspectj.version
标签中提到的地方,
<aspectj.version>1.8.1</aspectj.version>
回答by Michal Krzaczynski
For instant run, just change the scope of the aspectj dependency as follows:
对于即时运行,只需更改 aspectj 依赖项的范围,如下所示:
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
<scope>runtime</scope>
</dependency>