AspectJ Maven Plugin cannot compile my project

前端 未结 5 1508
鱼传尺愫
鱼传尺愫 2021-02-18 18:53

I try to use aspectj maven plugin for compile project with aspectj compiler and then I try to package classes into \"war\" file. Unfortunately, it doesn\'t work with following c

5条回答
  •  伪装坚强ぢ
    2021-02-18 19:19

    Having looked at your Maven project https://github.com/dmitrievanthony/test-aspectj I found out that

    • the problem is totally unrelated to AspectJ Maven Plugin,
    • the same compilation errors also occur in Maven Compiler Plugin and
    • that the root cause of your problem is simply bad dependency management.

    Here is a screenshot (full size here) from IntelliJ IDEA's "find class":

    Class LockModeType is found 3x in the project

    As you can see, class LockModeType is found in 3 (three!) dependencies, one of which contains a version of the class which does not contain the expected enum values. Your code compiles if you remove this dependency.

        
            org.hibernate
            ejb3-persistence
            1.0.2.GA
        
    

    Maybe you should clean up your dependencies. You can use the Maven Dependency Plugin with goals like dependency:analyze and dependency:tree for that purpose.

提交回复
热议问题