具有Maven插件的Eclipse不适用于最新版本,但适用于较旧版本 [英] Eclipse with Maven plugin does not work with latest revisions, but works with older ones

查看:190
本文介绍了具有Maven插件的Eclipse不适用于最新版本,但适用于较旧版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 Spring AOP 的简单项目。它使用 AspectJ 中的注释。该项目在Maven中,它可以用 aspectjtools-1.7.4 编译。使用 aspectjtools-1.8.9 无法看到从 org导入的接受注释 @Aspect 。 aspectj.lang.annotation.Aspect 。相同的项目对于Gradle和相同的JAR没有任何问题。

I have a simple project that uses Spring AOP. It uses annotation from AspectJ. The project is in Maven and it compiles ok with aspectjtools-1.7.4. With aspectjtools-1.8.9 it fails to see accept annotation @Aspect imported from org.aspectj.lang.annotation.Aspect. The same project gives no problems with Gradle and same JARs.

为什么我的代码不能与AspectJ的最新版本配合使用,但是可以和旧的一样工作吗?

Why would my code not work with latest revision of AspectJ, but works ok with older one?

我附加了 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</groupId>
      <artifactId>aspectjproblem</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>jar</packaging>

      <name>aspectjproblem</name>
      <url>http://maven.apache.org</url>

      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>

      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-context</artifactId>
          <version>4.3.3.RELEASE</version>
        </dependency>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.11</version>
          <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>

            <!-- WITH 1.8.9: FAILS to see org.aspectj.lang.annotation.Aspect  -->
            <!-- <version>1.8.9</version> -->

            <!-- WITH 1.7.4: SEES OK: org.aspectj.lang.annotation.Aspect  --> 
            <version>1.7.4</version>
        </dependency>        
        </dependencies>
      </project>

我想它必须与合规级别或类似的东西有关。任何人都可以指向正确的方向吗?非常感谢。

I guess it must have something to do with compliance-levels or similar things. Can anyone point me in the right direction? Many thanks.

推荐答案

我花了一阵时间了解问题是什么。我试着移动到Java8,我玩依赖关系。我遇到的问题是:

It took me a while to understand what was the issue. I tried moving to Java8 and I played with dependencies. The problem I had was:

- 无效的LOC标题(不良签名)

什么意思我猜Maven下载了一个损坏的文件。我从repo(例如C:\Users\ $ USER.m2\repository\org\aspectj\aspectjtools)中删除它,更新的maven,并且都开始工作。

What means I guess Maven downloaded a corrupted file. I deleted it from repo (e.g. C:\Users\$USER.m2\repository\org\aspectj\aspectjtools ), updated maven and all started working again.

这篇关于具有Maven插件的Eclipse不适用于最新版本,但适用于较旧版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆