Maven: compile aspectj project containing Java 1.6 source

前端 未结 4 432
名媛妹妹
名媛妹妹 2020-12-05 03:08

Primary Question

What I want to do is fairly easy. Or so you would think. However, nothing is working properly.

Requirement: Using maven

4条回答
  •  粉色の甜心
    2020-12-05 03:48

    How do you specify a custom compilerId that points to your own ajc compiler (that is make compile:compile use an aspectj compiler other than the plexus one)?

    I don't know how to specify another compilerId than the "official" ones. Not sure it's possible.

    My understanding is that http://jira.codehaus.org/browse/MCOMPILER-107 would solve your problem (AspectJ 1.6+ does support Java 1. 6 right?). Sadly, it's still open.

    How do you ignore the failure of compile:compile?

    The compiler:compile goal of the Maven Compiler plugin has a failOnError optional parameter allowing to Indicate whether the build will continue even if there are compilation errors.

    
      ...
      
        ...
        
          ...
          
            maven-compiler-plugin
            2.2
            
              false
              ...
            
          
        
      
    
    

    This could be a ugly workaround to the above problem.

    How do you get maven to run the aspectj:compile goal directly, without ever running compile:compile?

    The problem is that compiler:compile is bound to the compile phase and that you can't remove a default lifecyle binding. So there is maybe another option but the only one I can think of would be to turn everything off by using a pom and to rebind all the goals manually (at least for these phases: process-resources, compile, process-test-resources, test-compile, test, package). Schematically, something like this:

    process-resources       resources:resources
    compile                 aspectj:compile
    process-test-resources  resources:testResources
    test-compile            compiler:testCompile
    test                    surefire:test
    package                 ejb:ejb or ejb3:ejb3 or jar:jar or par:par or rar:rar or war:war
    install                 install:install
    deploy                  deploy:deploy
    

    That could be another ugly workaround. Disclaimer: not tested but should work.

提交回复
热议问题