9

我正在使用 Maven 来构建我的项目。它之前编译成功。当我这样做时,它已经开始出现错误mvn clean install

[ERROR] classpath error: unable to find org.aspectj.lang.JoinPoint (check that aspectjrt.jar is in your classpath)

下面是我的 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>
4

4 回答 4

8

我猜你缺少一个依赖项?一些谷歌搜索建议您可能需要导入:

<dependency>
  <groupId>aspectj</groupId>
  <artifactId>aspectjrt</artifactId>
  <version>1.5.4</version>
</dependency>

请注意,这1.5.4是报告的最新版本:http: //mvnrepository.com/artifact/aspectj/aspectjrt

于 2013-01-21T12:35:02.593 回答
1

这似乎来自

<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>

您最近是否通过更改更改了以下行?

<aspectj.version>1.6.10</aspectj.version>
于 2013-01-21T15:26:28.977 回答
1

对于即时运行,只需更改 aspectj 依赖项的范围,如下所示:

<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjrt</artifactId>
    <version>${aspectj.version}</version>
    <scope>runtime</scope>
</dependency>
于 2017-06-28T09:09:50.590 回答
0

我得到了同样的错误,

[ERROR] error classpath error: unable to find org.aspectj.lang.JoinPoint (check that aspectjrt.jar is in your classpath)

<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>

aspectj.version标签中提到的地方,

<aspectj.version>1.8.1</aspectj.version>
于 2015-09-02T11:32:12.903 回答